when grouping by tags, tags with different casing will be grouped together

This commit is contained in:
Jay 2020-05-18 17:46:58 -04:00
parent 71872df9d0
commit a03ee4943f
2 changed files with 7 additions and 1 deletions

View File

@ -25,6 +25,7 @@ import eu.kanade.tachiyomi.ui.library.filter.FilterBottomSheet
import eu.kanade.tachiyomi.ui.library.filter.FilterBottomSheet.Companion.STATE_EXCLUDE import eu.kanade.tachiyomi.ui.library.filter.FilterBottomSheet.Companion.STATE_EXCLUDE
import eu.kanade.tachiyomi.ui.library.filter.FilterBottomSheet.Companion.STATE_IGNORE import eu.kanade.tachiyomi.ui.library.filter.FilterBottomSheet.Companion.STATE_IGNORE
import eu.kanade.tachiyomi.ui.library.filter.FilterBottomSheet.Companion.STATE_INCLUDE import eu.kanade.tachiyomi.ui.library.filter.FilterBottomSheet.Companion.STATE_INCLUDE
import eu.kanade.tachiyomi.util.lang.capitalizeWords
import eu.kanade.tachiyomi.util.lang.removeArticles import eu.kanade.tachiyomi.util.lang.removeArticles
import eu.kanade.tachiyomi.util.system.executeOnIO import eu.kanade.tachiyomi.util.system.executeOnIO
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
@ -536,7 +537,7 @@ class LibraryPresenter(
listOf("Unknown") listOf("Unknown")
} else { } else {
manga.genre?.split(",")?.mapNotNull { manga.genre?.split(",")?.mapNotNull {
val tag = it.trim() val tag = it.trim().capitalizeWords()
if (tag.isBlank()) null else tag if (tag.isBlank()) null else tag
} ?: listOf("Unknown") } ?: listOf("Unknown")
} }

View File

@ -35,6 +35,11 @@ fun String.truncateCenter(count: Int, replacement: String = "..."): String {
return "${take(pieceLength)}$replacement${takeLast(pieceLength)}" return "${take(pieceLength)}$replacement${takeLast(pieceLength)}"
} }
fun String.capitalizeWords(): String {
val firstReplace = split(" ").joinToString(" ") { it.capitalize() }
return firstReplace.split("-").joinToString("-") { it.capitalize() }
}
/** /**
* Case-insensitive natural comparator for strings. * Case-insensitive natural comparator for strings.
*/ */