From 74612c5009852a181908d24bb20d1a62ef3337cd Mon Sep 17 00:00:00 2001 From: Gezim Date: Tue, 30 Sep 2025 18:19:30 +0300 Subject: [PATCH] Diacritic AppDrawer issue fixed (ordering regulated). --- .../java/com/github/gezimos/inkos/data/AppListItem.kt | 5 ++++- .../java/com/github/gezimos/inkos/ui/AppDrawerAdapter.kt | 9 ++++----- .../com/github/gezimos/inkos/ui/AppDrawerFragment.kt | 4 +++- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/github/gezimos/inkos/data/AppListItem.kt b/app/src/main/java/com/github/gezimos/inkos/data/AppListItem.kt index 2229384..17ae962 100644 --- a/app/src/main/java/com/github/gezimos/inkos/data/AppListItem.kt +++ b/app/src/main/java/com/github/gezimos/inkos/data/AppListItem.kt @@ -3,7 +3,10 @@ package com.github.gezimos.inkos.data import android.os.UserHandle import java.text.Collator -val collator: Collator = Collator.getInstance() +val collator: Collator = Collator.getInstance().apply { + strength = Collator.PRIMARY + decomposition = Collator.CANONICAL_DECOMPOSITION +} /** * We create instances in 3 different places: diff --git a/app/src/main/java/com/github/gezimos/inkos/ui/AppDrawerAdapter.kt b/app/src/main/java/com/github/gezimos/inkos/ui/AppDrawerAdapter.kt index fb2968d..f1d2aef 100644 --- a/app/src/main/java/com/github/gezimos/inkos/ui/AppDrawerAdapter.kt +++ b/app/src/main/java/com/github/gezimos/inkos/ui/AppDrawerAdapter.kt @@ -182,11 +182,10 @@ class AppDrawerAdapter( } private fun sortAppList() { - val comparator = compareBy { appItem -> - appItem.customLabel.ifEmpty { appItem.label }.lowercase() - } - appsList.sortWith(comparator) - appFilteredList.sortWith(comparator) + // Use AppListItem's natural ordering which relies on the repo-wide + // collator configured to ignore accents and case differences. + appsList.sort() + appFilteredList.sort() } // Payload marker used to indicate only textual content changed diff --git a/app/src/main/java/com/github/gezimos/inkos/ui/AppDrawerFragment.kt b/app/src/main/java/com/github/gezimos/inkos/ui/AppDrawerFragment.kt index f60373b..237d727 100644 --- a/app/src/main/java/com/github/gezimos/inkos/ui/AppDrawerFragment.kt +++ b/app/src/main/java/com/github/gezimos/inkos/ui/AppDrawerFragment.kt @@ -661,7 +661,9 @@ class AppDrawerFragment : Fragment() { // or by the normal label. Adapter-side sorting exists, but paging is computed // from the fragment's `fullAppsList`, so we must sort here to ensure pages // (including HiddenApps mode) are alphabetically ordered. - fullAppsList = apps.sortedWith(compareBy { it.customLabel.ifEmpty { it.label }.lowercase() }) + // Sort using AppListItem's Comparable which uses the shared collator + // configured to ignore diacritics and case differences. + fullAppsList = apps.sorted() // Reset selection to the first item when app list changes selectedItemIndex = 0