mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-02-03 09:17:34 +01:00
collect and show all duplicate contact IMs
This commit is contained in:
parent
671cb29a45
commit
a52bed4228
@ -17,10 +17,7 @@ import com.simplemobiletools.contacts.pro.R
|
|||||||
import com.simplemobiletools.contacts.pro.dialogs.CallConfirmationDialog
|
import com.simplemobiletools.contacts.pro.dialogs.CallConfirmationDialog
|
||||||
import com.simplemobiletools.contacts.pro.extensions.*
|
import com.simplemobiletools.contacts.pro.extensions.*
|
||||||
import com.simplemobiletools.contacts.pro.helpers.*
|
import com.simplemobiletools.contacts.pro.helpers.*
|
||||||
import com.simplemobiletools.contacts.pro.models.Address
|
import com.simplemobiletools.contacts.pro.models.*
|
||||||
import com.simplemobiletools.contacts.pro.models.Contact
|
|
||||||
import com.simplemobiletools.contacts.pro.models.ContactSource
|
|
||||||
import com.simplemobiletools.contacts.pro.models.PhoneNumber
|
|
||||||
import kotlinx.android.synthetic.main.activity_view_contact.*
|
import kotlinx.android.synthetic.main.activity_view_contact.*
|
||||||
import kotlinx.android.synthetic.main.item_event.view.*
|
import kotlinx.android.synthetic.main.item_event.view.*
|
||||||
import kotlinx.android.synthetic.main.item_view_address.view.*
|
import kotlinx.android.synthetic.main.item_view_address.view.*
|
||||||
@ -209,11 +206,11 @@ class ViewContactActivity : ContactActivity() {
|
|||||||
setupPhoneNumbers()
|
setupPhoneNumbers()
|
||||||
setupEmails()
|
setupEmails()
|
||||||
setupAddresses()
|
setupAddresses()
|
||||||
|
setupIMs()
|
||||||
setupContactSources()
|
setupContactSources()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setupIMs()
|
|
||||||
setupEvents()
|
setupEvents()
|
||||||
setupNotes()
|
setupNotes()
|
||||||
setupOrganization()
|
setupOrganization()
|
||||||
@ -285,6 +282,7 @@ class ViewContactActivity : ContactActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun setupPhoneNumbers() {
|
private fun setupPhoneNumbers() {
|
||||||
|
contact_numbers_holder.removeAllViews()
|
||||||
if (showFields and SHOW_PHONE_NUMBERS_FIELD != 0) {
|
if (showFields and SHOW_PHONE_NUMBERS_FIELD != 0) {
|
||||||
var phoneNumbers = contact!!.phoneNumbers.toMutableSet() as LinkedHashSet<PhoneNumber>
|
var phoneNumbers = contact!!.phoneNumbers.toMutableSet() as LinkedHashSet<PhoneNumber>
|
||||||
duplicateContacts.forEach {
|
duplicateContacts.forEach {
|
||||||
@ -300,8 +298,6 @@ class ViewContactActivity : ContactActivity() {
|
|||||||
}.toMutableSet() as LinkedHashSet<PhoneNumber>
|
}.toMutableSet() as LinkedHashSet<PhoneNumber>
|
||||||
|
|
||||||
phoneNumbers = phoneNumbers.sortedBy { it.type }.toMutableSet() as LinkedHashSet<PhoneNumber>
|
phoneNumbers = phoneNumbers.sortedBy { it.type }.toMutableSet() as LinkedHashSet<PhoneNumber>
|
||||||
|
|
||||||
contact_numbers_holder.removeAllViews()
|
|
||||||
if (phoneNumbers.isNotEmpty()) {
|
if (phoneNumbers.isNotEmpty()) {
|
||||||
phoneNumbers.forEach {
|
phoneNumbers.forEach {
|
||||||
layoutInflater.inflate(R.layout.item_view_phone_number, contact_numbers_holder, false).apply {
|
layoutInflater.inflate(R.layout.item_view_phone_number, contact_numbers_holder, false).apply {
|
||||||
@ -368,7 +364,6 @@ class ViewContactActivity : ContactActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
addresses = addresses.sortedBy { it.type }.toMutableSet() as LinkedHashSet<Address>
|
addresses = addresses.sortedBy { it.type }.toMutableSet() as LinkedHashSet<Address>
|
||||||
|
|
||||||
if (addresses.isNotEmpty()) {
|
if (addresses.isNotEmpty()) {
|
||||||
addresses.forEach {
|
addresses.forEach {
|
||||||
layoutInflater.inflate(R.layout.item_view_address, contact_addresses_holder, false).apply {
|
layoutInflater.inflate(R.layout.item_view_address, contact_addresses_holder, false).apply {
|
||||||
@ -397,19 +392,29 @@ class ViewContactActivity : ContactActivity() {
|
|||||||
|
|
||||||
private fun setupIMs() {
|
private fun setupIMs() {
|
||||||
contact_ims_holder.removeAllViews()
|
contact_ims_holder.removeAllViews()
|
||||||
val IMs = contact!!.IMs
|
if (showFields and SHOW_IMS_FIELD != 0) {
|
||||||
if (IMs.isNotEmpty() && showFields and SHOW_IMS_FIELD != 0) {
|
var IMs = contact!!.IMs.toMutableSet() as LinkedHashSet<IM>
|
||||||
IMs.forEach {
|
duplicateContacts.forEach {
|
||||||
layoutInflater.inflate(R.layout.item_view_im, contact_ims_holder, false).apply {
|
IMs.addAll(it.IMs)
|
||||||
val IM = it
|
}
|
||||||
contact_ims_holder.addView(this)
|
|
||||||
contact_im.text = IM.value
|
IMs = IMs.sortedBy { it.type }.toMutableSet() as LinkedHashSet<IM>
|
||||||
contact_im_type.text = getIMTypeText(IM.type, IM.label)
|
if (IMs.isNotEmpty()) {
|
||||||
copyOnLongClick(IM.value)
|
IMs.forEach {
|
||||||
}
|
layoutInflater.inflate(R.layout.item_view_im, contact_ims_holder, false).apply {
|
||||||
|
val IM = it
|
||||||
|
contact_ims_holder.addView(this)
|
||||||
|
contact_im.text = IM.value
|
||||||
|
contact_im_type.text = getIMTypeText(IM.type, IM.label)
|
||||||
|
copyOnLongClick(IM.value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
contact_ims_image.beVisible()
|
||||||
|
contact_ims_holder.beVisible()
|
||||||
|
} else {
|
||||||
|
contact_ims_image.beGone()
|
||||||
|
contact_ims_holder.beGone()
|
||||||
}
|
}
|
||||||
contact_ims_image.beVisible()
|
|
||||||
contact_ims_holder.beVisible()
|
|
||||||
} else {
|
} else {
|
||||||
contact_ims_image.beGone()
|
contact_ims_image.beGone()
|
||||||
contact_ims_holder.beGone()
|
contact_ims_holder.beGone()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user