fix some filtering issues, show more contacts rather than less

This commit is contained in:
tibbi 2019-08-25 21:29:08 +02:00
parent a06ed027cd
commit 42ff471748
2 changed files with 3 additions and 4 deletions

View File

@ -66,7 +66,7 @@ class ContactsHelper(val context: Context) {
it.getHashToCompare()
} as ArrayList<Contact>
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 {

View File

@ -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()