From fbc1fd603473c9daa2a85093a8f1d5f05216adf8 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 30 Apr 2018 14:58:18 +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 0f3141e2..66191515 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/helpers/ContactsHelper.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/helpers/ContactsHelper.kt @@ -1240,6 +1240,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)