mirror of
https://github.com/gezimos/inkOS.git
synced 2026-06-11 14:54:14 -04:00
Diacritic AppDrawer issue fixed (ordering regulated).
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user