Fixed managing and collapsing default category

pull/3117/head
Jay 4 years ago
parent cd7e4efa5e
commit 3da64d8835

@ -54,6 +54,7 @@ class ManageCategoryDialog(bundle: Bundle? = null) :
private fun onPositiveButtonClick() {
val view = dialogView ?: return
if (category.id ?: 0 <= 0) return
val text = view.title.text.toString()
val categoryExists = categoryExists(text)
if (text.isNotBlank() && !categoryExists && !text.equals(category.name, true)) {
@ -85,6 +86,12 @@ class ManageCategoryDialog(bundle: Bundle? = null) :
}
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 {
router.popCurrentController()
router.pushController(CategoryController().withFadeTransaction())

@ -424,6 +424,7 @@ class LibraryPresenter(
it.toIntOrNull()
}.toMutableSet()
if (categorySet.contains(0)) categories.add(0, createDefaultCategory())
if (showCategories) {
categories.forEach { category ->
val catId = category.id ?: return@forEach
@ -435,7 +436,7 @@ class LibraryPresenter(
} else if (catId in categoriesHidden) {
val mangaToRemove = items.filter { it.manga.category == catId }
val mergedTitle = mangaToRemove.joinToString("-") {
it.manga.title
it.manga.title + "-" + it.manga.author
}
items.removeAll(mangaToRemove)
val headerItem = headerItems[catId]
@ -446,8 +447,6 @@ class LibraryPresenter(
}
}
if (categorySet.contains(0)) categories.add(0, createDefaultCategory())
categories.forEach {
it.isHidden = it.id in categoriesHidden
}

Loading…
Cancel
Save