From 164de67a56095335119b63b3b17abab5007703f8 Mon Sep 17 00:00:00 2001 From: Andreas Date: Sun, 24 Jul 2022 18:43:33 +0200 Subject: [PATCH] Fix infinite loading when user library is empty (#7602) - If no manga in library add default category this to remove loading state --- .../java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 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 775e34ee11..b43cd272eb 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 @@ -412,14 +412,14 @@ class LibraryPresenter( */ private fun getLibraryObservable(): Observable { return combine(getCategoriesFlow(), getLibraryMangasFlow()) { dbCategories, libraryManga -> - val categories = if (libraryManga.containsKey(0)) { + val categories = if (libraryManga.containsKey(0) || libraryManga.isEmpty()) { arrayListOf(Category.default(context)) + dbCategories } else { dbCategories } libraryManga.forEach { (categoryId, libraryManga) -> - val category = categories.first { category -> category.id == categoryId.toLong() } + val category = categories.first { category -> category.id == categoryId } libraryManga.forEach { libraryItem -> libraryItem.displayMode = category.displayMode }