From ea81745c8a5aed941a131089659198a10e53d401 Mon Sep 17 00:00:00 2001 From: Jay Date: Sat, 2 May 2020 13:50:39 -0400 Subject: [PATCH] Additonal list view fixes Setting title to 2 lines Added back image to browse Set a fixed height to list item author only shows if there's space just like comfort grid --- .../tachiyomi/ui/library/LibraryListHolder.kt | 10 +++++++++- .../ui/source/browse/BrowseSourceListHolder.kt | 16 ++++++++++++++++ app/src/main/res/layout/manga_list_item.xml | 4 ++-- 3 files changed, 27 insertions(+), 3 deletions(-) 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 bd6fe6cf96..38b2d1ee65 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 @@ -51,6 +51,9 @@ class LibraryListHolder( constraint_layout.minHeight = 56.dpToPx if (item.manga.isBlank()) { constraint_layout.minHeight = 0 + constraint_layout.updateLayoutParams { + height = ViewGroup.MarginLayoutParams.WRAP_CONTENT + } if (item.manga.status == -1) { title.text = null title.gone() @@ -63,6 +66,9 @@ class LibraryListHolder( subtitle.gone() return } + constraint_layout.updateLayoutParams { + height = 52.dpToPx + } padding.visible() card.visible() title.textAlignment = View.TEXT_ALIGNMENT_TEXT_START @@ -72,7 +78,9 @@ class LibraryListHolder( setUnreadBadge(badge_view, item) subtitle.text = item.manga.author?.trim() - subtitle.visibleIf(!item.manga.author.isNullOrBlank()) + title.post { + subtitle.visibleIf(title.lineCount == 1 && !item.manga.author.isNullOrBlank()) + } // Update the cover. if (item.manga.thumbnail_url == null) Glide.with(view.context).clear(cover_thumbnail) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/source/browse/BrowseSourceListHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/source/browse/BrowseSourceListHolder.kt index 850f6de757..476fff6352 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/source/browse/BrowseSourceListHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/source/browse/BrowseSourceListHolder.kt @@ -2,11 +2,15 @@ package eu.kanade.tachiyomi.ui.source.browse import android.view.View import androidx.recyclerview.widget.RecyclerView +import com.bumptech.glide.load.engine.DiskCacheStrategy +import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions import eu.davidea.flexibleadapter.FlexibleAdapter import eu.davidea.flexibleadapter.items.IFlexible import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.database.models.Manga +import eu.kanade.tachiyomi.data.glide.GlideApp import eu.kanade.tachiyomi.util.system.getResourceColor +import eu.kanade.tachiyomi.widget.StateImageViewTarget import kotlinx.android.synthetic.main.manga_list_item.* /** @@ -38,5 +42,17 @@ class BrowseSourceListHolder(private val view: View, adapter: FlexibleAdapter @@ -61,7 +61,7 @@ android:layout_marginTop="6dp" android:layout_marginEnd="6dp" android:ellipsize="end" - android:maxLines="3" + android:maxLines="2" android:textColor="?android:attr/textColorPrimary" android:textSize="16sp" app:layout_constrainedWidth="true"