Fixed sectioned library showing the wrong category when returning back to library tab

when using custom grouping
This commit is contained in:
Jay 2020-05-18 23:26:28 -04:00
parent 4df4a5b59d
commit 5bdd7dcea9

View file

@ -137,10 +137,9 @@ class LibraryPresenter(
fun restoreLibrary() { fun restoreLibrary() {
val items = libraryItems val items = libraryItems
val show = showAllCategories || !libraryIsGrouped || val show = showAllCategories || !libraryIsGrouped || categories.size == 1
categories.size == 1
if (!show) { if (!show) {
sectionedLibraryItems = items.groupBy { it.manga.category }.toMutableMap() sectionedLibraryItems = items.groupBy { it.header.category.id!! }.toMutableMap()
if (currentCategory == -1) currentCategory = categories.find { if (currentCategory == -1) currentCategory = categories.find {
it.order == preferences.lastUsedCategory().getOrDefault() it.order == preferences.lastUsedCategory().getOrDefault()
}?.id ?: 0 }?.id ?: 0