Change usage of name to visualName when Default category can be shown (#7725)

This commit is contained in:
Andreas 2022-08-11 15:07:20 +02:00 committed by GitHub
parent 11f640cfee
commit ff996d282a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 8 deletions

View File

@ -6,6 +6,7 @@ import com.bluelinelabs.conductor.Controller
import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.dialog.MaterialAlertDialogBuilder
import eu.kanade.domain.category.model.Category import eu.kanade.domain.category.model.Category
import eu.kanade.domain.manga.model.Manga import eu.kanade.domain.manga.model.Manga
import eu.kanade.presentation.category.visualName
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.ui.base.controller.DialogController import eu.kanade.tachiyomi.ui.base.controller.DialogController
import eu.kanade.tachiyomi.ui.base.controller.pushController import eu.kanade.tachiyomi.ui.base.controller.pushController
@ -41,7 +42,7 @@ class ChangeMangaCategoriesDialog<T>(bundle: Bundle? = null) :
.apply { .apply {
if (categories.isNotEmpty()) { if (categories.isNotEmpty()) {
setQuadStateMultiChoiceItems( setQuadStateMultiChoiceItems(
items = categories.map { it.name }, items = categories.map { it.visualName(context) },
isActionList = false, isActionList = false,
initialSelected = preselected.toIntArray(), initialSelected = preselected.toIntArray(),
) { selections -> ) { selections ->

View File

@ -122,7 +122,7 @@ class SettingsDownloadController : SettingsController() {
summary = if (selected.isEmpty()) { summary = if (selected.isEmpty()) {
resources?.getString(R.string.none) resources?.getString(R.string.none)
} else { } else {
selected.joinToString { it.name } selected.joinToString { it.visualName(context) }
} }
}.launchIn(viewScope) }.launchIn(viewScope)
} }
@ -151,7 +151,7 @@ class SettingsDownloadController : SettingsController() {
val includedItemsText = if (selectedCategories.isEmpty()) { val includedItemsText = if (selectedCategories.isEmpty()) {
context.getString(R.string.all) context.getString(R.string.all)
} else { } else {
selectedCategories.joinToString { it.name } selectedCategories.joinToString { it.visualName(context) }
} }
val excludedCategories = preferences.downloadNewChapterCategoriesExclude().get() val excludedCategories = preferences.downloadNewChapterCategoriesExclude().get()
@ -160,7 +160,7 @@ class SettingsDownloadController : SettingsController() {
val excludedItemsText = if (excludedCategories.isEmpty()) { val excludedItemsText = if (excludedCategories.isEmpty()) {
context.getString(R.string.none) context.getString(R.string.none)
} else { } else {
excludedCategories.joinToString { it.name } excludedCategories.joinToString { it.visualName(context) }
} }
summary = buildSpannedString { summary = buildSpannedString {

View File

@ -115,12 +115,12 @@ class SettingsLibraryController : SettingsController() {
defaultValue = "-1" defaultValue = "-1"
val selectedCategory = allCategories.find { it.id == preferences.defaultCategory().toLong() } val selectedCategory = allCategories.find { it.id == preferences.defaultCategory().toLong() }
summary = selectedCategory?.name summary = selectedCategory?.visualName(context)
?: context.getString(R.string.default_category_summary) ?: context.getString(R.string.default_category_summary)
onChange { newValue -> onChange { newValue ->
summary = allCategories.find { summary = allCategories.find {
it.id == (newValue as String).toLong() it.id == (newValue as String).toLong()
}?.name ?: context.getString(R.string.default_category_summary) }?.visualName(context) ?: context.getString(R.string.default_category_summary)
true true
} }
} }
@ -250,7 +250,7 @@ class SettingsLibraryController : SettingsController() {
val includedItemsText = when { val includedItemsText = when {
// Some selected, but not all // Some selected, but not all
includedCategories.isNotEmpty() && includedCategories.size != allCategories.size -> includedCategories.joinToString { it.name } includedCategories.isNotEmpty() && includedCategories.size != allCategories.size -> includedCategories.joinToString { it.visualName(context) }
// All explicitly selected // All explicitly selected
includedCategories.size == allCategories.size -> context.getString(R.string.all) includedCategories.size == allCategories.size -> context.getString(R.string.all)
allExcluded -> context.getString(R.string.none) allExcluded -> context.getString(R.string.none)
@ -259,7 +259,7 @@ class SettingsLibraryController : SettingsController() {
val excludedItemsText = when { val excludedItemsText = when {
excludedCategories.isEmpty() -> context.getString(R.string.none) excludedCategories.isEmpty() -> context.getString(R.string.none)
allExcluded -> context.getString(R.string.all) allExcluded -> context.getString(R.string.all)
else -> excludedCategories.joinToString { it.name } else -> excludedCategories.joinToString { it.visualName(context) }
} }
summary = buildSpannedString { summary = buildSpannedString {