improve the contact number fetching at the dialpad
This commit is contained in:
parent
04a7cfc9a5
commit
04ce30cdbd
|
@ -262,12 +262,13 @@ class ContactsAdapter(activity: SimpleActivity, var contactItems: ArrayList<Cont
|
|||
contact_name.setPadding(if (showContactThumbnails) smallPadding else bigPadding, smallPadding, smallPadding, 0)
|
||||
|
||||
if (contact_number != null) {
|
||||
val numberText = if (textToHighlight.isEmpty()) {
|
||||
contact.phoneNumbers.firstOrNull()?.value ?: ""
|
||||
val phoneNumberToUse = if (textToHighlight.isEmpty()) {
|
||||
contact.phoneNumbers.firstOrNull()
|
||||
} else {
|
||||
contact.phoneNumbers.firstOrNull { it.value.contains(textToHighlight) }?.value ?: ""
|
||||
contact.phoneNumbers.firstOrNull { it.value.contains(textToHighlight) } ?: contact.phoneNumbers.firstOrNull()
|
||||
}
|
||||
|
||||
val numberText = phoneNumberToUse?.value ?: ""
|
||||
contact_number.text = if (textToHighlight.isEmpty()) numberText else numberText.highlightTextPart(textToHighlight, adjustedPrimaryColor)
|
||||
contact_number.setTextColor(textColor)
|
||||
contact_number.setPadding(if (showContactThumbnails) smallPadding else bigPadding, 0, smallPadding, 0)
|
||||
|
|
Loading…
Reference in New Issue