Merge pull request #26 from SimpleMobileTools/master

upd
This commit is contained in:
solokot 2019-09-17 15:05:31 +03:00 committed by GitHub
commit cd1e076c47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 13 deletions

View File

@ -1,6 +1,12 @@
Changelog
==========
Version 6.4.1 *(2019-09-16)*
----------------------------
* Made duplicate merging more aggressive, compare only by full name
* Fixed some theming and duplicate contact issues at the View details screen
Version 6.4.0 *(2019-09-15)*
----------------------------

View File

@ -15,8 +15,8 @@ android {
applicationId "com.simplemobiletools.contacts.pro"
minSdkVersion 21
targetSdkVersion 28
versionCode 47
versionName "6.4.0"
versionCode 48
versionName "6.4.1"
setProperty("archivesBaseName", "contacts")
}

View File

@ -572,7 +572,8 @@ class ViewContactActivity : ContactActivity() {
ContactsHelper(this).getDuplicatesOfContact(contact!!, false) { contacts ->
ensureBackgroundThread {
duplicateContacts.clear()
contacts.forEach {
val displayContactSources = getVisibleContactSources()
contacts.filter { displayContactSources.contains(it.source) }.forEach {
val duplicate = ContactsHelper(this).getContactWithId(it.id, it.isPrivate())
if (duplicate != null) {
duplicateContacts.add(duplicate)

View File

@ -53,7 +53,7 @@ class ContactsHelper(val context: Context) {
val contactsSize = contacts.size()
val showOnlyContactsWithNumbers = context.config.showOnlyContactsWithNumbers
var tempContacts = ArrayList<Contact>(contactsSize)
val tempContacts = ArrayList<Contact>(contactsSize)
val resultContacts = ArrayList<Contact>(contactsSize)
(0 until contactsSize).filter {
@ -67,11 +67,7 @@ class ContactsHelper(val context: Context) {
}
if (ignoredContactSources.isEmpty() && !getAll) {
tempContacts = tempContacts.distinctBy {
it.getHashToCompare()
} as ArrayList<Contact>
tempContacts.filter { displayContactSources.contains(it.source) }.groupBy { "${it.getNameToDisplay().toLowerCase()}${it.emails}" }.values.forEach { it ->
tempContacts.filter { displayContactSources.contains(it.source) }.groupBy { it.getNameToDisplay().toLowerCase()}.values.forEach { it ->
if (it.size == 1) {
resultContacts.add(it.first())
} else {

View File

@ -108,11 +108,8 @@ data class Contact(var id: Int, var prefix: String, var firstName: String, var m
}
fun getStringToCompare(): String {
val newEmails = ArrayList<Email>()
emails.mapTo(newEmails) { Email(it.value, 0, "") }
return copy(id = 0, prefix = "", firstName = getNameToDisplay().toLowerCase(), middleName = "", surname = "", suffix = "", nickname = "", photoUri = "",
phoneNumbers = ArrayList(), events = ArrayList(), source = "", addresses = ArrayList(), emails = newEmails, starred = 0, contactId = 0,
phoneNumbers = ArrayList(), emails = ArrayList(), events = ArrayList(), source = "", addresses = ArrayList(), starred = 0, contactId = 0,
thumbnailUri = "", notes = "", groups = ArrayList(), websites = ArrayList(), organization = Organization("", ""), IMs = ArrayList()).toString()
}