mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-17 20:49:18 +01:00
Avoid unnecessary string creation when sorting
This commit is contained in:
parent
448645d83a
commit
1c5c370c12
@ -34,7 +34,6 @@ import uy.kohesive.injekt.injectLazy
|
|||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.FileInputStream
|
import java.io.FileInputStream
|
||||||
import java.io.InputStream
|
import java.io.InputStream
|
||||||
import java.util.Locale
|
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
import java.util.zip.ZipFile
|
import java.util.zip.ZipFile
|
||||||
|
|
||||||
@ -111,9 +110,9 @@ class LocalSource(private val context: Context) : CatalogueSource, UnmeteredSour
|
|||||||
when (state?.index) {
|
when (state?.index) {
|
||||||
0 -> {
|
0 -> {
|
||||||
mangaDirs = if (state.ascending) {
|
mangaDirs = if (state.ascending) {
|
||||||
mangaDirs.sortedBy { it.name.lowercase(Locale.ENGLISH) }
|
mangaDirs.sortedWith(compareBy(String.CASE_INSENSITIVE_ORDER, { it.name }))
|
||||||
} else {
|
} else {
|
||||||
mangaDirs.sortedByDescending { it.name.lowercase(Locale.ENGLISH) }
|
mangaDirs.sortedWith(compareByDescending(String.CASE_INSENSITIVE_ORDER, { it.name }))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
1 -> {
|
1 -> {
|
||||||
@ -176,7 +175,7 @@ class LocalSource(private val context: Context) : CatalogueSource, UnmeteredSour
|
|||||||
.asSequence()
|
.asSequence()
|
||||||
.mapNotNull { File(it, manga.key).listFiles()?.toList() }
|
.mapNotNull { File(it, manga.key).listFiles()?.toList() }
|
||||||
.flatten()
|
.flatten()
|
||||||
.firstOrNull { it.extension.lowercase() == "json" }
|
.firstOrNull { it.extension.equals("json", ignoreCase = true) }
|
||||||
|
|
||||||
return if (localDetails != null) {
|
return if (localDetails != null) {
|
||||||
val obj = json.decodeFromStream<JsonObject>(localDetails.inputStream())
|
val obj = json.decodeFromStream<JsonObject>(localDetails.inputStream())
|
||||||
|
@ -42,7 +42,7 @@ class SourceFilterController : SettingsController() {
|
|||||||
)
|
)
|
||||||
|
|
||||||
orderedLangs.forEach { lang ->
|
orderedLangs.forEach { lang ->
|
||||||
val sources = sourcesByLang[lang].orEmpty().sortedBy { it.name.lowercase() }
|
val sources = sourcesByLang[lang].orEmpty().sortedWith(compareBy(String.CASE_INSENSITIVE_ORDER, { it.name }))
|
||||||
|
|
||||||
// Create a preference group and set initial state and change listener
|
// Create a preference group and set initial state and change listener
|
||||||
switchPreferenceCategory {
|
switchPreferenceCategory {
|
||||||
|
@ -45,7 +45,7 @@ class LicensesController :
|
|||||||
viewScope.launchUI {
|
viewScope.launchUI {
|
||||||
val licenseItems = withIOContext {
|
val licenseItems = withIOContext {
|
||||||
Libs(view.context).libraries
|
Libs(view.context).libraries
|
||||||
.sortedBy { it.libraryName.lowercase() }
|
.sortedWith(compareBy(String.CASE_INSENSITIVE_ORDER, { it.libraryName }))
|
||||||
.map { LicensesItem(it) }
|
.map { LicensesItem(it) }
|
||||||
}
|
}
|
||||||
binding.progress.hide()
|
binding.progress.hide()
|
||||||
|
Loading…
Reference in New Issue
Block a user