mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-04-15 02:22:09 +02:00
delete contacts from all sources at deleting from the main screen
This commit is contained in:
parent
415ef33c09
commit
3d24a84248
@ -176,16 +176,23 @@ class ContactsAdapter(activity: SimpleActivity, var contactItems: ArrayList<Cont
|
|||||||
val positions = getSelectedItemPositions()
|
val positions = getSelectedItemPositions()
|
||||||
contactItems.removeAll(contactsToRemove)
|
contactItems.removeAll(contactsToRemove)
|
||||||
|
|
||||||
ensureBackgroundThread {
|
ContactsHelper(activity).getContacts { allContacts ->
|
||||||
ContactsHelper(activity).deleteContacts(contactsToRemove)
|
ensureBackgroundThread {
|
||||||
|
contactsToRemove.forEach {
|
||||||
|
val contactToRemove = it
|
||||||
|
val duplicates = allContacts.filter { it.id != contactToRemove.id && it.getHashToCompare() == contactToRemove.getHashToCompare() }.toMutableList() as ArrayList<Contact>
|
||||||
|
duplicates.add(contactToRemove)
|
||||||
|
ContactsHelper(activity).deleteContacts(duplicates)
|
||||||
|
}
|
||||||
|
|
||||||
activity.runOnUiThread {
|
activity.runOnUiThread {
|
||||||
if (contactItems.isEmpty()) {
|
if (contactItems.isEmpty()) {
|
||||||
refreshListener?.refreshContacts(ALL_TABS_MASK)
|
refreshListener?.refreshContacts(ALL_TABS_MASK)
|
||||||
finishActMode()
|
finishActMode()
|
||||||
} else {
|
} else {
|
||||||
removeSelectedItems(positions)
|
removeSelectedItems(positions)
|
||||||
refreshListener?.refreshContacts(CONTACTS_TAB_MASK or FAVORITES_TAB_MASK)
|
refreshListener?.refreshContacts(CONTACTS_TAB_MASK or FAVORITES_TAB_MASK)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user