do not mess with the phone numbers if they arent shown anyway

This commit is contained in:
tibbi 2019-09-15 12:04:38 +02:00
parent f9bd62b2a7
commit 72ccd10aa1
1 changed files with 33 additions and 28 deletions

View File

@ -200,10 +200,10 @@ class ViewContactActivity : ContactActivity() {
window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN)
setupFavorite()
setupNames()
setupContactSources()
getDuplicateContacts {
setupPhoneNumbers()
setupContactSources()
}
setupEmails()
@ -280,6 +280,7 @@ class ViewContactActivity : ContactActivity() {
}
private fun setupPhoneNumbers() {
if (showFields and SHOW_PHONE_NUMBERS_FIELD != 0) {
var phoneNumbers = contact!!.phoneNumbers.toMutableSet() as LinkedHashSet<PhoneNumber>
duplicateContacts.forEach {
phoneNumbers.addAll(it.phoneNumbers)
@ -294,7 +295,7 @@ class ViewContactActivity : ContactActivity() {
}.toMutableSet() as LinkedHashSet<PhoneNumber>
contact_numbers_holder.removeAllViews()
if (phoneNumbers.isNotEmpty() && showFields and SHOW_PHONE_NUMBERS_FIELD != 0) {
if (phoneNumbers.isNotEmpty()) {
phoneNumbers.forEach {
layoutInflater.inflate(R.layout.item_view_phone_number, contact_numbers_holder, false).apply {
val phoneNumber = it
@ -320,6 +321,10 @@ class ViewContactActivity : ContactActivity() {
contact_numbers_image.beGone()
contact_numbers_holder.beGone()
}
} else {
contact_numbers_image.beGone()
contact_numbers_holder.beGone()
}
}
private fun setupEmails() {