fix #174, make "Filter out duplicates" a bit more agressive

This commit is contained in:
tibbi 2018-06-19 16:10:55 +02:00
parent 824a8d18f0
commit b4c4691f1c
1 changed files with 13 additions and 2 deletions

View File

@ -85,8 +85,19 @@ data class Contact(val id: Int, var prefix: String, var firstName: String, var m
fun getHashToCompare(): Int { fun getHashToCompare(): Int {
val newPhoneNumbers = ArrayList<PhoneNumber>() val newPhoneNumbers = ArrayList<PhoneNumber>()
phoneNumbers.mapTo(newPhoneNumbers, { PhoneNumber(it.value.replace(pattern, ""), 0) }) phoneNumbers.mapTo(newPhoneNumbers) { PhoneNumber(it.value.replace(pattern, ""), 0) }
val newEvents = ArrayList<Event>()
events.mapTo(newEvents) { Event(it.value.replace(pattern, ""), 0) }
val newAddresses = ArrayList<Address>()
addresses.mapTo(newAddresses) { Address(it.value, 0) }
val newEmails = ArrayList<Email>()
emails.mapTo(newEmails) { Email(it.value, 0) }
return copy(id = 0, prefix = "", firstName = getFullName().toLowerCase(), middleName = "", surname = "", suffix = "", photoUri = "", return copy(id = 0, prefix = "", firstName = getFullName().toLowerCase(), middleName = "", surname = "", suffix = "", photoUri = "",
phoneNumbers = newPhoneNumbers, source = "", starred = 0, contactId = 0, thumbnailUri = "", notes = "").hashCode() phoneNumbers = newPhoneNumbers, events = newEvents, addresses = newAddresses, emails = newEmails, source = "", starred = 0,
contactId = 0, thumbnailUri = "", notes = "", groups = ArrayList(), websites = ArrayList(), organization = Organization("", "")).hashCode()
} }
} }