mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-04-16 19:07:21 +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()
|
val positions = getSelectedItemPositions()
|
||||||
contactItems.removeAll(contactsToRemove)
|
contactItems.removeAll(contactsToRemove)
|
||||||
|
|
||||||
|
ContactsHelper(activity).getContacts { allContacts ->
|
||||||
ensureBackgroundThread {
|
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 {
|
activity.runOnUiThread {
|
||||||
if (contactItems.isEmpty()) {
|
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
|
// used for removing contacts from groups or favorites, not deleting actual contacts
|
||||||
private fun removeContacts() {
|
private fun removeContacts() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user