diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt index aa606f8707..7940f86ab9 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt @@ -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_IGNORE 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.system.executeOnIO import kotlinx.coroutines.CoroutineScope @@ -536,7 +537,7 @@ class LibraryPresenter( listOf("Unknown") } else { manga.genre?.split(",")?.mapNotNull { - val tag = it.trim() + val tag = it.trim().capitalizeWords() if (tag.isBlank()) null else tag } ?: listOf("Unknown") } diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/lang/StringExtensions.kt b/app/src/main/java/eu/kanade/tachiyomi/util/lang/StringExtensions.kt index 52a6713fff..ed901e2cd4 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/lang/StringExtensions.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/lang/StringExtensions.kt @@ -35,6 +35,11 @@ fun String.truncateCenter(count: Int, replacement: String = "..."): String { 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. */