Janky workaround for collapsed global search covers

This commit is contained in:
arkon 2020-10-24 13:31:29 -04:00
parent 2860bbfb12
commit 837ce62844
4 changed files with 13 additions and 15 deletions

View file

@ -8,9 +8,9 @@ import eu.kanade.tachiyomi.data.glide.toMangaThumbnail
import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder
import eu.kanade.tachiyomi.widget.StateImageViewTarget
import kotlinx.android.synthetic.main.global_search_controller_card_item.card
import kotlinx.android.synthetic.main.global_search_controller_card_item.itemImage
import kotlinx.android.synthetic.main.global_search_controller_card_item.cover
import kotlinx.android.synthetic.main.global_search_controller_card_item.progress
import kotlinx.android.synthetic.main.global_search_controller_card_item.tvTitle
import kotlinx.android.synthetic.main.global_search_controller_card_item.title
class GlobalSearchCardHolder(view: View, adapter: GlobalSearchCardAdapter) :
BaseFlexibleViewHolder(view, adapter) {
@ -35,15 +35,15 @@ class GlobalSearchCardHolder(view: View, adapter: GlobalSearchCardAdapter) :
fun bind(manga: Manga) {
card.clipToOutline = true
tvTitle.text = manga.title
title.text = manga.title
// Set alpha of thumbnail.
itemImage.alpha = if (manga.favorite) 0.3f else 1.0f
cover.alpha = if (manga.favorite) 0.3f else 1.0f
setImage(manga)
}
fun setImage(manga: Manga) {
GlideApp.with(itemView.context).clear(itemImage)
GlideApp.with(itemView.context).clear(cover)
if (!manga.thumbnail_url.isNullOrEmpty()) {
GlideApp.with(itemView.context)
.load(manga.toMangaThumbnail())
@ -51,7 +51,7 @@ class GlobalSearchCardHolder(view: View, adapter: GlobalSearchCardAdapter) :
.centerCrop()
.skipMemoryCache(true)
.placeholder(android.R.color.transparent)
.into(StateImageViewTarget(itemImage, progress))
.into(StateImageViewTarget(cover, progress))
}
}
}

View file

@ -22,8 +22,8 @@
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/colorSurface"
android:alpha="0.75" />
android:alpha="0.75"
android:background="?attr/colorSurface" />
<ProgressBar
style="?android:attr/progressBarStyleLarge"

View file

@ -59,8 +59,6 @@
android:id="@+id/recycler"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
android:orientation="horizontal"
android:paddingStart="12dp"
android:paddingEnd="12dp"
tools:listitem="@layout/global_search_controller_card_item" />

View file

@ -4,16 +4,16 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/list_item_selector_background"
android:layout_marginStart="4dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="4dp"
android:layout_marginBottom="8dp">
android:layout_marginBottom="8dp"
android:background="@drawable/list_item_selector_background">
<FrameLayout
android:id="@+id/card"
android:layout_width="112dp"
android:layout_height="0dp"
android:layout_height="144dp"
android:background="@drawable/rounded_rectangle"
app:layout_constraintDimensionRatio="h,5:7"
app:layout_constraintEnd_toEndOf="parent"
@ -29,7 +29,7 @@
android:visibility="gone" />
<ImageView
android:id="@+id/itemImage"
android:id="@+id/cover"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/colorSurface"
@ -40,7 +40,7 @@
</FrameLayout>
<TextView
android:id="@+id/tvTitle"
android:id="@+id/title"
style="@style/TextAppearance.Regular.Body1"
android:layout_width="0dp"
android:layout_height="wrap_content"