From 4f5270cb7debf3a523f9a4aa5bb7c8c62b05be7d Mon Sep 17 00:00:00 2001 From: arkon Date: Sun, 4 Dec 2022 13:39:53 -0500 Subject: [PATCH] Fix unusable categories when content is filtered out Fixes #8675 Effectively reverts #8633, which introduces weird edge cases --- .../presentation/library/components/LibraryContent.kt | 2 +- .../eu/kanade/tachiyomi/ui/library/LibraryScreenModel.kt | 7 +------ .../main/java/eu/kanade/tachiyomi/ui/library/LibraryTab.kt | 2 +- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/eu/kanade/presentation/library/components/LibraryContent.kt b/app/src/main/java/eu/kanade/presentation/library/components/LibraryContent.kt index 051a2bb018..c0babd6d44 100644 --- a/app/src/main/java/eu/kanade/presentation/library/components/LibraryContent.kt +++ b/app/src/main/java/eu/kanade/presentation/library/components/LibraryContent.kt @@ -61,7 +61,7 @@ fun LibraryContent( val scope = rememberCoroutineScope() var isRefreshing by remember(pagerState.currentPage) { mutableStateOf(false) } - if (!isLibraryEmpty && showPageTabs && categories.size > 1) { + if (showPageTabs && categories.size > 1) { LibraryTabs( categories = categories, currentPageIndex = pagerState.currentPage, diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryScreenModel.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryScreenModel.kt index 1430750250..bcec9c5e21 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryScreenModel.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryScreenModel.kt @@ -777,12 +777,7 @@ class LibraryScreenModel( val categoryName = category.let { if (it.isSystemCategory) defaultCategoryTitle else it.name } - - val title = when { - showCategoryTabs && categories.size != 1 -> defaultTitle - libraryCount > 0 && !onlyDefaultCategory -> categoryName - else -> defaultTitle - } + val title = if (showCategoryTabs) defaultTitle else categoryName val count = when { !showMangaCount -> null !showCategoryTabs -> getMangaCountForCategory(category) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryTab.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryTab.kt index 03c1caa8e0..2ec310bd05 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryTab.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryTab.kt @@ -149,7 +149,7 @@ object LibraryTab : Tab { ) { contentPadding -> when { state.isLoading -> LoadingScreen(modifier = Modifier.padding(contentPadding)) - state.searchQuery.isNullOrEmpty() && state.libraryCount == 0 -> { + state.searchQuery.isNullOrEmpty() && !state.hasActiveFilters && state.libraryCount == 0 -> { val handler = LocalUriHandler.current EmptyScreen( textResource = R.string.information_empty_library,