mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-25 05:21:49 +01:00
Fixes for showing single category
This commit is contained in:
parent
bc8ed36d1c
commit
d73579d25a
@ -431,6 +431,7 @@ class LibraryPresenter(
|
|||||||
val categories = db.getCategories().executeAsBlocking().toMutableList()
|
val categories = db.getCategories().executeAsBlocking().toMutableList()
|
||||||
val showCategories = !preferences.hideCategories().getOrDefault()
|
val showCategories = !preferences.hideCategories().getOrDefault()
|
||||||
var libraryManga = db.getLibraryMangas().executeAsBlocking()
|
var libraryManga = db.getLibraryMangas().executeAsBlocking()
|
||||||
|
val showAll = showAllCategories
|
||||||
if (groupType <= BY_DEFAULT || !showCategories) {
|
if (groupType <= BY_DEFAULT || !showCategories) {
|
||||||
libraryManga = libraryManga.distinctBy { it.id }
|
libraryManga = libraryManga.distinctBy { it.id }
|
||||||
}
|
}
|
||||||
@ -465,12 +466,12 @@ class LibraryPresenter(
|
|||||||
categories.forEach { category ->
|
categories.forEach { category ->
|
||||||
val catId = category.id ?: return@forEach
|
val catId = category.id ?: return@forEach
|
||||||
if (catId > 0 && !categorySet.contains(catId) && (catId !in categoriesHidden ||
|
if (catId > 0 && !categorySet.contains(catId) && (catId !in categoriesHidden ||
|
||||||
!showCategories)) {
|
!showAll)) {
|
||||||
val headerItem = headerItems[catId]
|
val headerItem = headerItems[catId]
|
||||||
if (headerItem != null) items.add(
|
if (headerItem != null) items.add(
|
||||||
LibraryItem(LibraryManga.createBlank(catId), headerItem)
|
LibraryItem(LibraryManga.createBlank(catId), headerItem)
|
||||||
)
|
)
|
||||||
} else if (catId in categoriesHidden && showCategories && categories.size > 1) {
|
} else if (catId in categoriesHidden && showAll && categories.size > 1) {
|
||||||
val mangaToRemove = items.filter { it.manga.category == catId }
|
val mangaToRemove = items.filter { it.manga.category == catId }
|
||||||
val mergedTitle = mangaToRemove.joinToString("-") {
|
val mergedTitle = mangaToRemove.joinToString("-") {
|
||||||
it.manga.title + "-" + it.manga.author
|
it.manga.title + "-" + it.manga.author
|
||||||
@ -486,7 +487,7 @@ class LibraryPresenter(
|
|||||||
}
|
}
|
||||||
|
|
||||||
categories.forEach {
|
categories.forEach {
|
||||||
it.isHidden = it.id in categoriesHidden && showCategories
|
it.isHidden = it.id in categoriesHidden && showAll && categories.size > 1
|
||||||
}
|
}
|
||||||
this.categories = if (!showCategories) {
|
this.categories = if (!showCategories) {
|
||||||
arrayListOf(categoryAll)
|
arrayListOf(categoryAll)
|
||||||
|
Loading…
Reference in New Issue
Block a user