mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-06-05 21:59:27 +02:00
tweak duplicate contact source adding a bit
This commit is contained in:
parent
a35e0513be
commit
2dc2fe01df
@ -482,7 +482,16 @@ class ViewContactActivity : ContactActivity() {
|
|||||||
|
|
||||||
private fun checkDuplicateContacts() {
|
private fun checkDuplicateContacts() {
|
||||||
ContactsHelper(this).getDuplicatesOfContact(contact!!, false) { contacts ->
|
ContactsHelper(this).getDuplicatesOfContact(contact!!, false) { contacts ->
|
||||||
val currContactSources = contacts.map { it.source }
|
ensureBackgroundThread {
|
||||||
|
val duplicates = ArrayList<Contact>()
|
||||||
|
contacts.forEach {
|
||||||
|
val duplicate = ContactsHelper(this).getContactWithId(it.id, it.isPrivate())
|
||||||
|
if (duplicate != null) {
|
||||||
|
duplicates.add(duplicate)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val currContactSources = duplicates.map { it.source }
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
if (currContactSources.toString() != shownContactSources.toString()) {
|
if (currContactSources.toString() != shownContactSources.toString()) {
|
||||||
for (i in (contact_sources_holder.childCount - 1) downTo 1) {
|
for (i in (contact_sources_holder.childCount - 1) downTo 1) {
|
||||||
@ -492,7 +501,7 @@ class ViewContactActivity : ContactActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (shownContactSources.isEmpty()) {
|
if (shownContactSources.isEmpty()) {
|
||||||
contacts.forEach {
|
duplicates.forEach {
|
||||||
addContactSource(it)
|
addContactSource(it)
|
||||||
shownContactSources.add(it.source)
|
shownContactSources.add(it.source)
|
||||||
}
|
}
|
||||||
@ -500,6 +509,7 @@ class ViewContactActivity : ContactActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun addContactSource(contact: Contact) {
|
private fun addContactSource(contact: Contact) {
|
||||||
if (showFields and SHOW_CONTACT_SOURCE_FIELD != 0) {
|
if (showFields and SHOW_CONTACT_SOURCE_FIELD != 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user