Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Honk2 committed Jul 21, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent aa627e6 commit 02097bc
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -369,7 +369,19 @@ class ContactsAdapter(
if (name.contains(textToHighlight, true)) {
name.highlightTextPart(textToHighlight, properPrimaryColor)
} else {
name.highlightTextFromNumbers(textToHighlight.replace('1', ' '), properPrimaryColor)
var spacedTextToHighlight = textToHighlight
val strippedName = PhoneNumberUtils.convertKeypadLettersToDigits(name.filterNot { it.isWhitespace() })
val startIndex = strippedName.indexOf(textToHighlight)

if ( strippedName.contains(textToHighlight)) {
for (i in 0..spacedTextToHighlight.length) {
if (name[startIndex+i].isWhitespace()) {
spacedTextToHighlight = spacedTextToHighlight.replaceRange(i, i, " ")
}
}
}

name.highlightTextFromNumbers(spacedTextToHighlight, properPrimaryColor)
}
}
}

0 comments on commit 02097bc

Please sign in to comment.