remove the favorite item if needed at removing a contact

This commit is contained in:
tibbi
2017-12-30 21:13:42 +01:00
parent bc0b4a9622
commit ad46e83284
3 changed files with 5 additions and 1 deletions

View File

@ -518,6 +518,7 @@ class ContactsHelper(val activity: BaseSimpleActivity) {
fun deleteContacts(contacts: ArrayList<Contact>) {
try {
val contactIDs = HashSet<String>()
val operations = ArrayList<ContentProviderOperation>()
val selection = "${ContactsContract.Data.RAW_CONTACT_ID} = ?"
contacts.forEach {
@ -526,9 +527,11 @@ class ContactsHelper(val activity: BaseSimpleActivity) {
withSelection(selection, selectionArgs)
operations.add(this.build())
}
contactIDs.add(it.id.toString())
}
activity.contentResolver.applyBatch(ContactsContract.AUTHORITY, operations)
activity.config.removeFavorites(contactIDs)
} catch (e: Exception) {
activity.showErrorToast(e)
}