diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/activities/MainActivity.kt index 023ee693..0dee0381 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/activities/MainActivity.kt @@ -361,7 +361,7 @@ class MainActivity : SimpleActivity(), RefreshContactsListener { FilePickerDialog(this, pickFile = false, showFAB = true) { ExportContactsDialog(this, it) { file, contactSources -> Thread { - ContactsHelper(this).getContacts(true) { + ContactsHelper(this).getContacts { val contacts = it.filter { contactSources.contains(it.source) } if (contacts.isEmpty()) { toast(R.string.no_entries_for_exporting) diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/activities/SelectContactActivity.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/activities/SelectContactActivity.kt index c6b82f3e..b7a10501 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/activities/SelectContactActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/activities/SelectContactActivity.kt @@ -75,7 +75,7 @@ class SelectContactActivity : SimpleActivity() { } private fun initContacts() { - ContactsHelper(this).getContacts(true) { + ContactsHelper(this).getContacts { if (isActivityDestroyed()) { return@getContacts } diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/adapters/ContactsAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/adapters/ContactsAdapter.kt index 0f8207a8..7b704bb6 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/adapters/ContactsAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/adapters/ContactsAdapter.kt @@ -168,7 +168,7 @@ class ContactsAdapter(activity: SimpleActivity, var contactItems: ArrayList activity.shareContacts(filtered) } 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 e0d6b711..c1423506 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/helpers/ContactsHelper.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/helpers/ContactsHelper.kt @@ -29,7 +29,7 @@ import com.simplemobiletools.contacts.extensions.getPhotoThumbnailSize import com.simplemobiletools.contacts.models.* class ContactsHelper(val activity: BaseSimpleActivity) { - fun getContacts(addOptionalFields: Boolean = false, callback: (ArrayList) -> Unit) { + fun getContacts(callback: (ArrayList) -> Unit) { val contacts = SparseArray() Thread { val uri = ContactsContract.Data.CONTENT_URI @@ -75,34 +75,32 @@ class ContactsHelper(val activity: BaseSimpleActivity) { contacts[key]?.phoneNumbers = phoneNumbers.valueAt(i) } - if (addOptionalFields) { - val emails = getEmails() - size = emails.size() - for (i in 0 until size) { - val key = emails.keyAt(i) - contacts[key]?.emails = emails.valueAt(i) - } + val emails = getEmails() + size = emails.size() + for (i in 0 until size) { + val key = emails.keyAt(i) + contacts[key]?.emails = emails.valueAt(i) + } - val addresses = getAddresses() - size = addresses.size() - for (i in 0 until size) { - val key = addresses.keyAt(i) - contacts[key]?.addresses = addresses.valueAt(i) - } + val addresses = getAddresses() + size = addresses.size() + for (i in 0 until size) { + val key = addresses.keyAt(i) + contacts[key]?.addresses = addresses.valueAt(i) + } - val events = getEvents() - size = events.size() - for (i in 0 until size) { - val key = events.keyAt(i) - contacts[key]?.events = events.valueAt(i) - } + val events = getEvents() + size = events.size() + for (i in 0 until size) { + val key = events.keyAt(i) + contacts[key]?.events = events.valueAt(i) + } - val notes = getNotes() - size = notes.size() - for (i in 0 until size) { - val key = notes.keyAt(i) - contacts[key]?.notes = notes.valueAt(i) - } + val notes = getNotes() + size = notes.size() + for (i in 0 until size) { + val key = notes.keyAt(i) + contacts[key]?.notes = notes.valueAt(i) } activity.dbHelper.getContacts().forEach {