mirror of
https://github.com/mihonapp/mihon.git
synced 2025-06-29 04:27:51 +02:00
New alphabetical chapter sort (#10073)
* added alphabetical chapter sorting * Deleted sort_by_alphabet and re-utilized action_sort_alpha * Accidentally deleted wrong string. Now solved * Accidentally deleted wrong string. Now solved Deleted sort_by_source instead of sort_by_alphabet in strings.xml. Now reverted. * Alphabetical sorting now uses Collator * Clean up repeated Collator instances --------- Co-authored-by: arkon <eugcheung94@gmail.com>
This commit is contained in:
15
core/src/main/java/tachiyomi/core/util/lang/SortUtil.kt
Normal file
15
core/src/main/java/tachiyomi/core/util/lang/SortUtil.kt
Normal file
@ -0,0 +1,15 @@
|
||||
package tachiyomi.core.util.lang
|
||||
|
||||
import java.text.Collator
|
||||
import java.util.Locale
|
||||
|
||||
private val collator by lazy {
|
||||
val locale = Locale.getDefault()
|
||||
Collator.getInstance(locale).apply {
|
||||
strength = Collator.PRIMARY
|
||||
}
|
||||
}
|
||||
|
||||
fun String.compareToWithCollator(other: String): Int {
|
||||
return collator.compare(this, other)
|
||||
}
|
Reference in New Issue
Block a user