Diacritic AppDrawer issue fixed (ordering regulated).

This commit is contained in:
Gezim
2025-09-30 18:19:30 +03:00
parent c8891161ec
commit 74612c5009
3 changed files with 11 additions and 7 deletions

View File

@@ -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:

View File

@@ -182,11 +182,10 @@ class AppDrawerAdapter(
}
private fun sortAppList() {
val comparator = compareBy<AppListItem> { 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

View File

@@ -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