From cd4fceba1b518ddb0241ffa026391517fa594c4c Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 30 Apr 2018 11:57:10 +0200 Subject: [PATCH] use batching at contact deleting --- .../com/simplemobiletools/contacts/helpers/ContactsHelper.kt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/helpers/ContactsHelper.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/helpers/ContactsHelper.kt index 52977de6..1d90a9ff 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/helpers/ContactsHelper.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/helpers/ContactsHelper.kt @@ -1227,6 +1227,11 @@ class ContactsHelper(val activity: BaseSimpleActivity) { withSelection(selection, selectionArgs) operations.add(build()) } + + if (operations.size % BATCH_SIZE == 0) { + activity.contentResolver.applyBatch(ContactsContract.AUTHORITY, operations) + operations.clear() + } } activity.contentResolver.applyBatch(ContactsContract.AUTHORITY, operations)