From 1ab12e380a682fa2e4931f1bfcfe5e202d6e202f Mon Sep 17 00:00:00 2001 From: FourTOne5 <59261191+FourTOne5@users.noreply.github.com> Date: Fri, 24 Dec 2021 20:28:23 +0600 Subject: [PATCH] Fix #6341 (#6383) --- .../ui/setting/SettingsLibraryController.kt | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsLibraryController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsLibraryController.kt index 3b02647d85..63560c90f3 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsLibraryController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsLibraryController.kt @@ -234,22 +234,29 @@ class SettingsLibraryController : SettingsController() { } fun updateSummary() { - val selectedCategories = preferences.libraryUpdateCategories().get() + val dbCategories = db.getCategories().executeAsBlocking() + val allCategories = listOf(Category.createDefault(activity!!)) + dbCategories + + val includedCategories = preferences.libraryUpdateCategories().get() .mapNotNull { id -> categories.find { it.id == id.toInt() } } .sortedBy { it.order } - val includedItemsText = if (selectedCategories.isEmpty()) { - context.getString(R.string.all) - } else { - selectedCategories.joinToString { it.name } - } val excludedCategories = preferences.libraryUpdateCategoriesExclude().get() .mapNotNull { id -> categories.find { it.id == id.toInt() } } .sortedBy { it.order } + + val includedItemsText = if (includedCategories.isEmpty()) { + if (excludedCategories.size == allCategories.size) context.getString(R.string.none) + else context.getString(R.string.all) + } else { + includedCategories.joinToString { it.name } + } + val excludedItemsText = if (excludedCategories.isEmpty()) { context.getString(R.string.none) } else { - excludedCategories.joinToString { it.name } + if (excludedCategories.size == allCategories.size) context.getString(R.string.all) + else excludedCategories.joinToString { it.name } } summary = buildSpannedString {