From 42ff471748b5420ee668e206d12041d0c22254d1 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 25 Aug 2019 21:29:08 +0200 Subject: [PATCH] fix some filtering issues, show more contacts rather than less --- .../simplemobiletools/contacts/pro/helpers/ContactsHelper.kt | 2 +- .../com/simplemobiletools/contacts/pro/models/Contact.kt | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/helpers/ContactsHelper.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/helpers/ContactsHelper.kt index 468980a0..1c10cd73 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/helpers/ContactsHelper.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/helpers/ContactsHelper.kt @@ -66,7 +66,7 @@ class ContactsHelper(val context: Context) { it.getHashToCompare() } as ArrayList - tempContacts.groupBy { "${it.getNameToDisplay().toLowerCase()}${it.emails}" }.values.forEach { + tempContacts.filter { displayContactSources.contains(it.source) }.groupBy { "${it.getNameToDisplay().toLowerCase()}${it.emails}" }.values.forEach { it -> if (it.size == 1) { resultContacts.add(it.first()) } else { diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/models/Contact.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/models/Contact.kt index e602c289..cc8ee32f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/models/Contact.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/models/Contact.kt @@ -112,9 +112,8 @@ data class Contact(var id: Int, var prefix: String, var firstName: String, var m emails.mapTo(newEmails) { Email(it.value, 0, "") } return copy(id = 0, prefix = "", firstName = getNameToDisplay().toLowerCase(), middleName = "", surname = "", suffix = "", nickname = "", photoUri = "", - phoneNumbers = ArrayList(), events = ArrayList(), addresses = ArrayList(), emails = newEmails, source = "", starred = 0, - contactId = 0, thumbnailUri = "", notes = "", groups = ArrayList(), websites = ArrayList(), organization = Organization("", ""), - IMs = ArrayList()).toString() + phoneNumbers = ArrayList(), events = ArrayList(), addresses = ArrayList(), emails = newEmails, starred = 0, contactId = 0, + thumbnailUri = "", notes = "", groups = ArrayList(), websites = ArrayList(), organization = Organization("", ""), IMs = ArrayList()).toString() } fun getHashToCompare() = getStringToCompare().hashCode()