mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-07 11:17:25 +01:00
Revert to old sorting library (fixes #3034)
This commit is contained in:
parent
04d7eccc63
commit
e29e94a5a1
@ -210,6 +210,9 @@ dependencies {
|
|||||||
final acra_version = '5.5.0'
|
final acra_version = '5.5.0'
|
||||||
implementation "ch.acra:acra-http:$acra_version"
|
implementation "ch.acra:acra-http:$acra_version"
|
||||||
|
|
||||||
|
// Sort
|
||||||
|
implementation 'com.github.gpanther:java-nat-sort:natural-comparator-1.1'
|
||||||
|
|
||||||
// UI
|
// UI
|
||||||
implementation 'com.dmitrymalkovich.android:material-design-dimens:1.4'
|
implementation 'com.dmitrymalkovich.android:material-design-dimens:1.4'
|
||||||
implementation 'com.github.dmytrodanylyk.android-process-button:library:1.0.4'
|
implementation 'com.github.dmytrodanylyk.android-process-button:library:1.0.4'
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package eu.kanade.tachiyomi.util.lang
|
package eu.kanade.tachiyomi.util.lang
|
||||||
|
|
||||||
import kotlin.math.floor
|
import kotlin.math.floor
|
||||||
|
import net.greypanther.natsort.CaseInsensitiveSimpleNaturalComparator
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Replaces the given string to have at most [count] characters using [replacement] at its end.
|
* Replaces the given string to have at most [count] characters using [replacement] at its end.
|
||||||
@ -32,9 +33,8 @@ fun String.truncateCenter(count: Int, replacement: String = "..."): String {
|
|||||||
* Case-insensitive natural comparator for strings.
|
* Case-insensitive natural comparator for strings.
|
||||||
*/
|
*/
|
||||||
fun String.compareToCaseInsensitiveNaturalOrder(other: String): Int {
|
fun String.compareToCaseInsensitiveNaturalOrder(other: String): Int {
|
||||||
return compareBy<String> { it.length }
|
val comparator = CaseInsensitiveSimpleNaturalComparator.getInstance<String>()
|
||||||
.then(String.CASE_INSENSITIVE_ORDER)
|
return comparator.compare(this, other)
|
||||||
.then(naturalOrder()).compare(this, other)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user