mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-20 04:29:18 +01:00
Use new natural sort library to sort local manga page files
Fixes #964 Co-Authored-By: arkon <4098258+arkon@users.noreply.github.com>
This commit is contained in:
parent
697cccb144
commit
330eb1f8ec
@ -209,6 +209,9 @@ dependencies {
|
|||||||
// Logging
|
// Logging
|
||||||
implementation("com.jakewharton.timber:timber:${Versions.TIMBER}")
|
implementation("com.jakewharton.timber:timber:${Versions.TIMBER}")
|
||||||
|
|
||||||
|
// 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("br.com.simplepass:loading-button-android:2.2.0")
|
implementation("br.com.simplepass:loading-button-android:2.2.0")
|
||||||
|
@ -15,6 +15,7 @@ import androidx.annotation.ColorInt
|
|||||||
import androidx.annotation.StringRes
|
import androidx.annotation.StringRes
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.util.system.getResourceColor
|
import eu.kanade.tachiyomi.util.system.getResourceColor
|
||||||
|
import net.greypanther.natsort.CaseInsensitiveSimpleNaturalComparator
|
||||||
import kotlin.math.floor
|
import kotlin.math.floor
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -89,7 +90,8 @@ fun String.capitalizeWords(): 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 String.CASE_INSENSITIVE_ORDER.then(naturalOrder()).compare(this, other)
|
val comparator = CaseInsensitiveSimpleNaturalComparator.getInstance<String>()
|
||||||
|
return comparator.compare(this, other)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun CharSequence.tintText(@ColorInt color: Int): Spanned {
|
fun CharSequence.tintText(@ColorInt color: Int): Spanned {
|
||||||
|
Loading…
Reference in New Issue
Block a user