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:
Jays2Kings 2021-08-12 12:21:39 -04:00
parent 697cccb144
commit 330eb1f8ec
2 changed files with 6 additions and 1 deletions

View File

@ -209,6 +209,9 @@ dependencies {
// Logging
implementation("com.jakewharton.timber:timber:${Versions.TIMBER}")
// Sort
implementation("com.github.gpanther:java-nat-sort:natural-comparator-1.1")
// UI
implementation("com.dmitrymalkovich.android:material-design-dimens:1.4")
implementation("br.com.simplepass:loading-button-android:2.2.0")

View File

@ -15,6 +15,7 @@ import androidx.annotation.ColorInt
import androidx.annotation.StringRes
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.util.system.getResourceColor
import net.greypanther.natsort.CaseInsensitiveSimpleNaturalComparator
import kotlin.math.floor
/**
@ -89,7 +90,8 @@ fun String.capitalizeWords(): String {
* Case-insensitive natural comparator for strings.
*/
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 {