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,8 +176,14 @@ class ContactsAdapter(activity: SimpleActivity, var contactItems: ArrayList<Cont
|
||||
val positions = getSelectedItemPositions()
|
||||
contactItems.removeAll(contactsToRemove)
|
||||
|
||||
ContactsHelper(activity).getContacts { allContacts ->
|
||||
ensureBackgroundThread {
|
||||
ContactsHelper(activity).deleteContacts(contactsToRemove)
|
||||
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 {
|
||||
if (contactItems.isEmpty()) {
|
||||
@ -190,6 +196,7 @@ class ContactsAdapter(activity: SimpleActivity, var contactItems: ArrayList<Cont
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// used for removing contacts from groups or favorites, not deleting actual contacts
|
||||
private fun removeContacts() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user