From a2e7b48501c275ac8e861932958afc423a88cb36 Mon Sep 17 00:00:00 2001 From: Jay Date: Mon, 20 Apr 2020 01:08:19 -0400 Subject: [PATCH] Fixes to collasped category showing items + fixed single categoery named as Library --- .../java/eu/kanade/tachiyomi/ui/library/LibraryGridHolder.kt | 2 ++ .../java/eu/kanade/tachiyomi/ui/library/LibraryHeaderItem.kt | 3 ++- .../java/eu/kanade/tachiyomi/ui/library/LibraryListHolder.kt | 1 + .../java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt | 4 ---- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryGridHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryGridHolder.kt index 0a4969a23e..75bce8a219 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryGridHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryGridHolder.kt @@ -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.glide.GlideApp 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.unread_download_badge.* @@ -53,6 +54,7 @@ class LibraryGridHolder( */ override fun onSetValues(item: LibraryItem) { // Update the title and subtitle of the manga. + constraint_layout.visibleIf(!item.manga.isBlank()) title.text = item.manga.title subtitle.text = item.manga.author?.trim() diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryHeaderItem.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryHeaderItem.kt index efaf783cce..e7f153accb 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryHeaderItem.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryHeaderItem.kt @@ -107,7 +107,8 @@ class LibraryHeaderItem( fun bind(category: Category) { sectionText.updateLayoutParams { - 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 = "" diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryListHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryListHolder.kt index fda3c3ddee..17679f0f63 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryListHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryListHolder.kt @@ -52,6 +52,7 @@ class LibraryListHolder( if (item.manga.isBlank()) { constraint_layout.minHeight = 0 if (item.manga.status == -1) { + title.text = null title.gone() } else title.text = itemView.context.getString(R.string.category_is_empty) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt index 4f6b0ebb8b..d43ed65ceb 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt @@ -1,6 +1,5 @@ package eu.kanade.tachiyomi.ui.library -import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.cache.CoverCache import eu.kanade.tachiyomi.data.database.DatabaseHelper 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()) categories.forEach {