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 c3f224c816..e78865cb54 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 @@ -516,7 +516,7 @@ class LibraryPresenter( this.allCategories = categories - hashCategories = HashMap(this.categories.mapNotNull { + hashCategories = HashMap(this.categories.map { it.id!! to it }.toMap()) @@ -538,7 +538,7 @@ class LibraryPresenter( } } - val items = libraryManga.mapNotNull { manga -> + val items = libraryManga.map { manga -> when (groupType) { BY_TAG -> { val tags = if (manga.genre.isNullOrBlank()) { @@ -840,7 +840,7 @@ class LibraryPresenter( } fun toggleCategoryVisibility(categoryId: Int) { - if (categoryId <= -1 || categories.find { it.id == categoryId }?.isDynamic == true) return + if (categories.find { it.id == categoryId }?.isDynamic == true) return val categoriesHidden = preferences.collapsedCategories().getOrDefault().mapNotNull { it.toIntOrNull() }.toMutableSet() @@ -854,7 +854,7 @@ class LibraryPresenter( fun toggleAllCategoryVisibility() { if (preferences.collapsedCategories().getOrDefault().isEmpty()) { - preferences.collapsedCategories().set(categories.map { it.id.toString() }.toMutableSet()) + preferences.collapsedCategories().set(allCategories.map { it.id.toString() }.toMutableSet()) } else { preferences.collapsedCategories().set(mutableSetOf()) }