mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-25 02:31:52 +01:00
Fixed managing and collapsing default category
This commit is contained in:
parent
cd7e4efa5e
commit
3da64d8835
@ -54,6 +54,7 @@ class ManageCategoryDialog(bundle: Bundle? = null) :
|
|||||||
|
|
||||||
private fun onPositiveButtonClick() {
|
private fun onPositiveButtonClick() {
|
||||||
val view = dialogView ?: return
|
val view = dialogView ?: return
|
||||||
|
if (category.id ?: 0 <= 0) return
|
||||||
val text = view.title.text.toString()
|
val text = view.title.text.toString()
|
||||||
val categoryExists = categoryExists(text)
|
val categoryExists = categoryExists(text)
|
||||||
if (text.isNotBlank() && !categoryExists && !text.equals(category.name, true)) {
|
if (text.isNotBlank() && !categoryExists && !text.equals(category.name, true)) {
|
||||||
@ -85,6 +86,12 @@ class ManageCategoryDialog(bundle: Bundle? = null) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun onViewCreated(view: View) {
|
fun onViewCreated(view: View) {
|
||||||
|
if (category.id ?: 0 <= 0) {
|
||||||
|
view.title.gone()
|
||||||
|
view.download_new.gone()
|
||||||
|
view.include_global.gone()
|
||||||
|
return
|
||||||
|
}
|
||||||
view.edit_categories.setOnClickListener {
|
view.edit_categories.setOnClickListener {
|
||||||
router.popCurrentController()
|
router.popCurrentController()
|
||||||
router.pushController(CategoryController().withFadeTransaction())
|
router.pushController(CategoryController().withFadeTransaction())
|
||||||
|
@ -424,6 +424,7 @@ class LibraryPresenter(
|
|||||||
it.toIntOrNull()
|
it.toIntOrNull()
|
||||||
}.toMutableSet()
|
}.toMutableSet()
|
||||||
|
|
||||||
|
if (categorySet.contains(0)) categories.add(0, createDefaultCategory())
|
||||||
if (showCategories) {
|
if (showCategories) {
|
||||||
categories.forEach { category ->
|
categories.forEach { category ->
|
||||||
val catId = category.id ?: return@forEach
|
val catId = category.id ?: return@forEach
|
||||||
@ -435,7 +436,7 @@ class LibraryPresenter(
|
|||||||
} else if (catId in categoriesHidden) {
|
} else if (catId in categoriesHidden) {
|
||||||
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.title + "-" + it.manga.author
|
||||||
}
|
}
|
||||||
items.removeAll(mangaToRemove)
|
items.removeAll(mangaToRemove)
|
||||||
val headerItem = headerItems[catId]
|
val headerItem = headerItems[catId]
|
||||||
@ -446,8 +447,6 @@ class LibraryPresenter(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (categorySet.contains(0)) categories.add(0, createDefaultCategory())
|
|
||||||
|
|
||||||
categories.forEach {
|
categories.forEach {
|
||||||
it.isHidden = it.id in categoriesHidden
|
it.isHidden = it.id in categoriesHidden
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user