Address some Kotlin language warnings
(cherry picked from commit 3854995ef23df814da32ef7bc6522007e7882f35) # Conflicts: # app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/ExtensionHolder.kt # app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/SourceFilterController.kt # app/src/main/java/eu/kanade/tachiyomi/util/chapter/ChapterRecognition.kt
This commit is contained in:
parent
d5b72c3d3a
commit
65249a4ee7
@ -99,9 +99,9 @@ class LocalSource(private val context: Context) : CatalogueSource {
|
|||||||
when (state?.index) {
|
when (state?.index) {
|
||||||
0 -> {
|
0 -> {
|
||||||
mangaDirs = if (state.ascending) {
|
mangaDirs = if (state.ascending) {
|
||||||
mangaDirs.sortedBy { it.name.toLowerCase(Locale.ENGLISH) }
|
mangaDirs.sortedBy { it.name.lowercase(Locale.ENGLISH) }
|
||||||
} else {
|
} else {
|
||||||
mangaDirs.sortedByDescending { it.name.toLowerCase(Locale.ENGLISH) }
|
mangaDirs.sortedByDescending { it.name.lowercase(Locale.ENGLISH) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
1 -> {
|
1 -> {
|
||||||
@ -294,7 +294,7 @@ class LocalSource(private val context: Context) : CatalogueSource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun isSupportedFile(extension: String): Boolean {
|
private fun isSupportedFile(extension: String): Boolean {
|
||||||
return extension.toLowerCase(Locale.ROOT) in SUPPORTED_ARCHIVE_TYPES
|
return extension.lowercase() in SUPPORTED_ARCHIVE_TYPES
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getFormat(chapter: SChapter): Format {
|
fun getFormat(chapter: SChapter): Format {
|
||||||
|
@ -83,7 +83,7 @@ abstract class HttpSource : CatalogueSource {
|
|||||||
* Note the generated id sets the sign bit to 0.
|
* Note the generated id sets the sign bit to 0.
|
||||||
*/
|
*/
|
||||||
override val id by lazy {
|
override val id by lazy {
|
||||||
val key = "${name.toLowerCase()}/$lang/$versionId"
|
val key = "${name.lowercase()}/$lang/$versionId"
|
||||||
val bytes = MessageDigest.getInstance("MD5").digest(key.toByteArray())
|
val bytes = MessageDigest.getInstance("MD5").digest(key.toByteArray())
|
||||||
(0..7).map { bytes[it].toLong() and 0xff shl 8 * (7 - it) }.reduce(Long::or) and Long.MAX_VALUE
|
(0..7).map { bytes[it].toLong() and 0xff shl 8 * (7 - it) }.reduce(Long::or) and Long.MAX_VALUE
|
||||||
}
|
}
|
||||||
@ -111,7 +111,7 @@ abstract class HttpSource : CatalogueSource {
|
|||||||
/**
|
/**
|
||||||
* Visible name of the source.
|
* Visible name of the source.
|
||||||
*/
|
*/
|
||||||
override fun toString() = "$name (${lang.toUpperCase()})"
|
override fun toString() = "$name (${lang.uppercase()})"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an observable containing a page with a list of manga. Normally it's not needed to
|
* Returns an observable containing a page with a list of manga. Normally it's not needed to
|
||||||
|
@ -46,7 +46,7 @@ class ExtensionHolder(view: View, val adapter: ExtensionAdapter) :
|
|||||||
extension.isNsfw && shouldLabelNsfw -> itemView.context.getString(R.string.ext_nsfw_short).plusRepo(extension)
|
extension.isNsfw && shouldLabelNsfw -> itemView.context.getString(R.string.ext_nsfw_short).plusRepo(extension)
|
||||||
else -> "".plusRepo(extension)
|
else -> "".plusRepo(extension)
|
||||||
// SY <--
|
// SY <--
|
||||||
}.toUpperCase()
|
}.uppercase()
|
||||||
|
|
||||||
binding.image.clear()
|
binding.image.clear()
|
||||||
if (extension is Extension.Available) {
|
if (extension is Extension.Available) {
|
||||||
|
@ -114,7 +114,7 @@ class ExtensionDetailsController(bundle: Bundle? = null) :
|
|||||||
.forEach {
|
.forEach {
|
||||||
val preferenceBlock = {
|
val preferenceBlock = {
|
||||||
it.value
|
it.value
|
||||||
.sortedWith(compareBy({ !it.isEnabled() }, { it.name.toLowerCase() }))
|
.sortedWith(compareBy({ !it.isEnabled() }, { it.name.lowercase() }))
|
||||||
.forEach { source ->
|
.forEach { source ->
|
||||||
val sourcePrefs = mutableListOf<Preference>()
|
val sourcePrefs = mutableListOf<Preference>()
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ class MigrationSourcesPresenter(
|
|||||||
val source = sourceManager.getOrStub(it.key)
|
val source = sourceManager.getOrStub(it.key)
|
||||||
SourceItem(source, it.value.size, header)
|
SourceItem(source, it.value.size, header)
|
||||||
}
|
}
|
||||||
.sortedBy { it.source.name.toLowerCase() }
|
.sortedBy { it.source.name.lowercase() }
|
||||||
.toList()
|
.toList()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -181,7 +181,7 @@ class SourcePresenter(
|
|||||||
return sourceManager.getVisibleCatalogueSources()
|
return sourceManager.getVisibleCatalogueSources()
|
||||||
.filter { it.lang in languages }
|
.filter { it.lang in languages }
|
||||||
.filterNot { it.id.toString() in disabledSourceIds }
|
.filterNot { it.id.toString() in disabledSourceIds }
|
||||||
.sortedBy { "(${it.lang}) ${it.name.toLowerCase()}" } +
|
.sortedBy { "(${it.lang}) ${it.name.lowercase()}" } +
|
||||||
sourceManager.get(LocalSource.ID) as LocalSource
|
sourceManager.get(LocalSource.ID) as LocalSource
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ open class GlobalSearchPresenter(
|
|||||||
return sourceManager.getVisibleCatalogueSources()
|
return sourceManager.getVisibleCatalogueSources()
|
||||||
.filter { it.lang in languages }
|
.filter { it.lang in languages }
|
||||||
.filterNot { it.id.toString() in disabledSourceIds }
|
.filterNot { it.id.toString() in disabledSourceIds }
|
||||||
.sortedWith(compareBy({ it.id.toString() !in pinnedSourceIds }, { "${it.name.toLowerCase()} (${it.lang})" }))
|
.sortedWith(compareBy({ it.id.toString() !in pinnedSourceIds }, { "${it.name.lowercase()} (${it.lang})" }))
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getSourcesToQuery(): List<CatalogueSource> {
|
private fun getSourcesToQuery(): List<CatalogueSource> {
|
||||||
@ -187,7 +187,7 @@ open class GlobalSearchPresenter(
|
|||||||
{ it.results.isNullOrEmpty() },
|
{ it.results.isNullOrEmpty() },
|
||||||
// Same as initial sort, i.e. pinned first then alphabetically
|
// Same as initial sort, i.e. pinned first then alphabetically
|
||||||
{ it.source.id.toString() !in pinnedSourceIds },
|
{ it.source.id.toString() !in pinnedSourceIds },
|
||||||
{ "${it.source.name.toLowerCase()} (${it.source.lang})" }
|
{ "${it.source.name.lowercase()} (${it.source.lang})" }
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ object ChapterRecognition {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get chapter title with lower case
|
// Get chapter title with lower case
|
||||||
var name = chapter.name.toLowerCase()
|
var name = chapter.name.lowercase()
|
||||||
|
|
||||||
// Remove comma's from chapter.
|
// Remove comma's from chapter.
|
||||||
name = name.replace(',', '.')
|
name = name.replace(',', '.')
|
||||||
@ -77,7 +77,7 @@ object ChapterRecognition {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Remove manga title from chapter title.
|
// Remove manga title from chapter title.
|
||||||
val nameWithoutManga = name.replace(/* SY --> */ manga.originalTitle.toLowerCase()/* SY <-- */, "").trim()
|
val nameWithoutManga = name.replace(/* SY --> */ manga.originalTitle.lowercase()/* SY <-- */, "").trim()
|
||||||
|
|
||||||
// Check if first value is number after title remove.
|
// Check if first value is number after title remove.
|
||||||
if (updateChapter(withoutManga.find(nameWithoutManga), chapter)) {
|
if (updateChapter(withoutManga.find(nameWithoutManga), chapter)) {
|
||||||
@ -147,6 +147,6 @@ object ChapterRecognition {
|
|||||||
* x.a -> x.1, x.b -> x.2, etc
|
* x.a -> x.1, x.b -> x.2, etc
|
||||||
*/
|
*/
|
||||||
private fun parseAlphaPostFix(alpha: Char): Float {
|
private fun parseAlphaPostFix(alpha: Char): Float {
|
||||||
return ("0." + (alpha.toInt() - 96).toString()).toFloat()
|
return ("0." + (alpha.code - 96).toString()).toFloat()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user