mirror of
https://github.com/FossifyOrg/Contacts.git
synced 2025-12-23 23:59:46 -05:00
fix: properly highlight search results with accents and diacritics (#435)
Refs: https://github.com/FossifyOrg/Contacts/issues/12
This commit is contained in:
@@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
## [Unreleased]
|
||||
### Fixed
|
||||
- Fixed invisible navigation bars in contact viewer ([#415])
|
||||
- Fixed search highlighting for characters with accents and diacritics ([#12])
|
||||
|
||||
## [1.4.0] - 2025-10-29
|
||||
### Changed
|
||||
@@ -98,6 +99,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
### Added
|
||||
- Initial release
|
||||
|
||||
[#12]: https://github.com/FossifyOrg/Contacts/issues/12
|
||||
[#30]: https://github.com/FossifyOrg/Contacts/issues/30
|
||||
[#78]: https://github.com/FossifyOrg/Contacts/issues/78
|
||||
[#201]: https://github.com/FossifyOrg/Contacts/issues/201
|
||||
|
||||
@@ -391,7 +391,9 @@ class ContactsAdapter(
|
||||
findViewById<ConstraintLayout>(org.fossify.commons.R.id.item_contact_frame)?.isSelected = selectedKeys.contains(contact.id)
|
||||
val fullName = contact.getNameToDisplay()
|
||||
findViewById<TextView>(org.fossify.commons.R.id.item_contact_name).text = if (textToHighlight.isEmpty()) fullName else {
|
||||
if (fullName.contains(textToHighlight, true)) {
|
||||
val normalizedFullName = fullName.normalizeString()
|
||||
val normalizedSearchText = textToHighlight.normalizeString()
|
||||
if (normalizedFullName.contains(normalizedSearchText, true)) {
|
||||
fullName.highlightTextPart(textToHighlight, properPrimaryColor)
|
||||
} else {
|
||||
fullName.highlightTextFromNumbers(textToHighlight, properPrimaryColor)
|
||||
|
||||
Reference in New Issue
Block a user