mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-04-15 10:27:41 +02:00
update shown contact sources at the View screen if necessary
This commit is contained in:
parent
090c347e5f
commit
c07e70ab1c
@ -31,6 +31,7 @@ import kotlinx.android.synthetic.main.item_website.view.*
|
|||||||
class ViewContactActivity : ContactActivity() {
|
class ViewContactActivity : ContactActivity() {
|
||||||
private var isViewIntent = false
|
private var isViewIntent = false
|
||||||
private var wasEditLaunched = false
|
private var wasEditLaunched = false
|
||||||
|
private var shownContactSources = ArrayList<String>()
|
||||||
private var showFields = 0
|
private var showFields = 0
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
@ -473,15 +474,25 @@ class ViewContactActivity : ContactActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun addContactSources() {
|
private fun addContactSources() {
|
||||||
if (contact_sources_holder.childCount > 0) {
|
if (contact_sources_holder.childCount == 0) {
|
||||||
return
|
addContactSource(contact!!)
|
||||||
}
|
}
|
||||||
|
|
||||||
addContactSource(contact!!)
|
|
||||||
ContactsHelper(this).getDuplicatesOfContact(contact!!, false) { contacts ->
|
ContactsHelper(this).getDuplicatesOfContact(contact!!, false) { contacts ->
|
||||||
|
val currContactSources = contacts.map { it.source }
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
contacts.forEach {
|
if (currContactSources.toString() != shownContactSources.toString()) {
|
||||||
addContactSource(it)
|
for (i in (contact_sources_holder.childCount - 1) downTo 1) {
|
||||||
|
contact_sources_holder.removeView(contact_sources_holder.getChildAt(i))
|
||||||
|
shownContactSources.clear()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (shownContactSources.isEmpty()) {
|
||||||
|
contacts.forEach {
|
||||||
|
addContactSource(it)
|
||||||
|
shownContactSources.add(it.source)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user