Fixes to collasped category showing items + fixed single categoery named as Library

This commit is contained in:
Jay 2020-04-20 01:08:19 -04:00
parent 0d6730d5d9
commit a2e7b48501
4 changed files with 5 additions and 5 deletions

View file

@ -9,6 +9,7 @@ import eu.kanade.tachiyomi.data.database.models.Manga
import eu.kanade.tachiyomi.data.database.models.MangaImpl import eu.kanade.tachiyomi.data.database.models.MangaImpl
import eu.kanade.tachiyomi.data.glide.GlideApp import eu.kanade.tachiyomi.data.glide.GlideApp
import eu.kanade.tachiyomi.util.view.gone import eu.kanade.tachiyomi.util.view.gone
import eu.kanade.tachiyomi.util.view.visibleIf
import kotlinx.android.synthetic.main.manga_grid_item.* import kotlinx.android.synthetic.main.manga_grid_item.*
import kotlinx.android.synthetic.main.unread_download_badge.* import kotlinx.android.synthetic.main.unread_download_badge.*
@ -53,6 +54,7 @@ class LibraryGridHolder(
*/ */
override fun onSetValues(item: LibraryItem) { override fun onSetValues(item: LibraryItem) {
// Update the title and subtitle of the manga. // Update the title and subtitle of the manga.
constraint_layout.visibleIf(!item.manga.isBlank())
title.text = item.manga.title title.text = item.manga.title
subtitle.text = item.manga.author?.trim() subtitle.text = item.manga.author?.trim()

View file

@ -107,7 +107,8 @@ class LibraryHeaderItem(
fun bind(category: Category) { fun bind(category: Category) {
sectionText.updateLayoutParams<ConstraintLayout.LayoutParams> { sectionText.updateLayoutParams<ConstraintLayout.LayoutParams> {
topMargin = (if (category.isFirst == true) 2 else 44).dpToPx topMargin =
(if ((adapter.headerItems.firstOrNull() as? LibraryHeaderItem)?.catId == category.id) 2 else 44).dpToPx
} }
if (category.isFirst == true && category.isLast == true) sectionText.text = "" if (category.isFirst == true && category.isLast == true) sectionText.text = ""

View file

@ -52,6 +52,7 @@ class LibraryListHolder(
if (item.manga.isBlank()) { if (item.manga.isBlank()) {
constraint_layout.minHeight = 0 constraint_layout.minHeight = 0
if (item.manga.status == -1) { if (item.manga.status == -1) {
title.text = null
title.gone() title.gone()
} else } else
title.text = itemView.context.getString(R.string.category_is_empty) title.text = itemView.context.getString(R.string.category_is_empty)

View file

@ -1,6 +1,5 @@
package eu.kanade.tachiyomi.ui.library package eu.kanade.tachiyomi.ui.library
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.cache.CoverCache import eu.kanade.tachiyomi.data.cache.CoverCache
import eu.kanade.tachiyomi.data.database.DatabaseHelper import eu.kanade.tachiyomi.data.database.DatabaseHelper
import eu.kanade.tachiyomi.data.database.models.Category import eu.kanade.tachiyomi.data.database.models.Category
@ -449,9 +448,6 @@ class LibraryPresenter(
} }
} }
if (categories.size == 1 && showCategories) categories.first().name =
context.getString(R.string.library)
if (categorySet.contains(0)) categories.add(0, createDefaultCategory()) if (categorySet.contains(0)) categories.add(0, createDefaultCategory())
categories.forEach { categories.forEach {