Fixed collasped categories with no items disappearing

This commit is contained in:
Jay 2020-05-06 18:13:09 -04:00
parent 03c50cc998
commit 33d15b0814

View File

@ -179,9 +179,13 @@ class LibraryPresenter(
val filterTrackers = FilterBottomSheet.FILTER_TRACKER val filterTrackers = FilterBottomSheet.FILTER_TRACKER
val filtersOff = filterDownloaded == 0 && filterUnread == 0 && filterCompleted == 0 && filterTracked == 0 && filterMangaType == 0
return items.filter f@{ item -> return items.filter f@{ item ->
if (item.manga.status == -1) { if (item.manga.status == -1) {
return@f sectionedLibraryItems[item.manga.category]?.any { val subItems = sectionedLibraryItems[item.manga.category]
if (subItems.isNullOrEmpty()) return@f filtersOff
else {
return@f subItems.any {
matchesFilters( matchesFilters(
it, it,
filterDownloaded, filterDownloaded,
@ -191,10 +195,11 @@ class LibraryPresenter(
filterMangaType, filterMangaType,
filterTrackers filterTrackers
) )
} ?: false }
}
} else if (item.manga.isBlank()) { } else if (item.manga.isBlank()) {
return@f if (showAllCategories) { return@f if (showAllCategories) {
filterDownloaded == 0 && filterUnread == 0 && filterCompleted == 0 && filterTracked == 0 && filterMangaType == 0 filtersOff
} else { } else {
true true
} }