mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-04-25 06:48:42 +02:00
avoid showing the same contact sources multiple times
This commit is contained in:
parent
c1db2701d8
commit
92288db197
@ -114,16 +114,6 @@ class ViewContactActivity : ContactActivity() {
|
|||||||
if (contactId != 0 && !wasLookupKeyUsed) {
|
if (contactId != 0 && !wasLookupKeyUsed) {
|
||||||
contact = ContactsHelper(this).getContactWithId(contactId, intent.getBooleanExtra(IS_PRIVATE, false))
|
contact = ContactsHelper(this).getContactWithId(contactId, intent.getBooleanExtra(IS_PRIVATE, false))
|
||||||
|
|
||||||
if (contact != null) {
|
|
||||||
ContactsHelper(this).getContacts { contacts ->
|
|
||||||
contacts.forEach {
|
|
||||||
if (it.id != contact!!.id && it.getHashToCompare() == contact!!.getHashToCompare()) {
|
|
||||||
addContactSource(it.source)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (contact == null) {
|
if (contact == null) {
|
||||||
if (!wasEditLaunched) {
|
if (!wasEditLaunched) {
|
||||||
toast(R.string.unknown_error_occurred)
|
toast(R.string.unknown_error_occurred)
|
||||||
@ -212,7 +202,7 @@ class ViewContactActivity : ContactActivity() {
|
|||||||
setupOrganization()
|
setupOrganization()
|
||||||
setupWebsites()
|
setupWebsites()
|
||||||
setupGroups()
|
setupGroups()
|
||||||
addContactSource(contact!!.source)
|
addContactSources()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun editContact() {
|
private fun editContact() {
|
||||||
@ -480,6 +470,22 @@ class ViewContactActivity : ContactActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun addContactSources() {
|
||||||
|
contact_sources_holder.removeAllViews()
|
||||||
|
addContactSource(contact!!.source)
|
||||||
|
ensureBackgroundThread {
|
||||||
|
ContactsHelper(this).getContacts { contacts ->
|
||||||
|
contacts.forEach {
|
||||||
|
if (it.id != contact!!.id && it.getHashToCompare() == contact!!.getHashToCompare()) {
|
||||||
|
runOnUiThread {
|
||||||
|
addContactSource(it.source)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun addContactSource(source: String) {
|
private fun addContactSource(source: String) {
|
||||||
if (showFields and SHOW_CONTACT_SOURCE_FIELD != 0) {
|
if (showFields and SHOW_CONTACT_SOURCE_FIELD != 0) {
|
||||||
layoutInflater.inflate(R.layout.item_view_contact_source, contact_sources_holder, false).apply {
|
layoutInflater.inflate(R.layout.item_view_contact_source, contact_sources_holder, false).apply {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user