From 627ea5fe33477e0d53a74ff291172c16ac16a292 Mon Sep 17 00:00:00 2001 From: Jays2Kings Date: Thu, 6 May 2021 15:31:29 -0400 Subject: [PATCH] Fixed #788 --- .../tachiyomi/ui/library/LibraryPresenter.kt | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) 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 6968d4e010..aac6512fae 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 @@ -173,12 +173,10 @@ class LibraryPresenter( fun restoreLibrary() { val items = libraryItems val show = showAllCategories || !libraryIsGrouped || categories.size == 1 - if (!show) { - sectionedLibraryItems = items.groupBy { it.header.category.id!! }.toMutableMap() - if (currentCategory == -1) currentCategory = categories.find { - it.order == preferences.lastUsedCategory().getOrDefault() - }?.id ?: 0 - } + sectionedLibraryItems = items.groupBy { it.header.category.id!! }.toMutableMap() + if (!show && currentCategory == -1) currentCategory = categories.find { + it.order == preferences.lastUsedCategory().getOrDefault() + }?.id ?: 0 view.onNextLibraryUpdate( if (!show) sectionedLibraryItems[currentCategory] ?: sectionedLibraryItems[categories.first().id] ?: blankItem() @@ -196,12 +194,10 @@ class LibraryPresenter( libraryItems = items val showAll = showAllCategories || !libraryIsGrouped || categories.size <= 1 - if (!showAll) { - sectionedLibraryItems = items.groupBy { it.header.category.id ?: 0 }.toMutableMap() - if (currentCategory == -1) currentCategory = categories.find { - it.order == preferences.lastUsedCategory().getOrDefault() - }?.id ?: 0 - } + sectionedLibraryItems = items.groupBy { it.header.category.id ?: 0 }.toMutableMap() + if (!showAll && currentCategory == -1) currentCategory = categories.find { + it.order == preferences.lastUsedCategory().getOrDefault() + }?.id ?: 0 withUIContext { view.onNextLibraryUpdate( if (!showAll) sectionedLibraryItems[currentCategory]