From 7e10bbce6d7ef07ecf6142d58a281d49728e8717 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 2 Aug 2018 16:17:49 +0200 Subject: [PATCH] show company contacts if they have at least company or title filled --- .../simplemobiletools/contacts/helpers/ContactsHelper.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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 a2829ff7..0d7ad2d1 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/helpers/ContactsHelper.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/helpers/ContactsHelper.kt @@ -380,8 +380,12 @@ class ContactsHelper(val activity: Activity) { if (cursor?.moveToFirst() == true) { do { val id = cursor.getIntValue(ContactsContract.Data.RAW_CONTACT_ID) - val company = cursor.getStringValue(CommonDataKinds.Organization.COMPANY) ?: continue - val title = cursor.getStringValue(CommonDataKinds.Organization.TITLE) ?: continue + val company = cursor.getStringValue(CommonDataKinds.Organization.COMPANY) ?: "" + val title = cursor.getStringValue(CommonDataKinds.Organization.TITLE) ?: "" + if (company.isEmpty() && title.isEmpty()) { + continue + } + val organization = Organization(company, title) organizations.put(id, organization) } while (cursor.moveToNext())