From a2b1acd70f5d41ad34fa8320ececb7cb9869bf6b Mon Sep 17 00:00:00 2001 From: Andreas E Date: Sat, 24 Oct 2020 19:07:06 +0200 Subject: [PATCH] Update Global search layout to match Library and Browse (#3892) * Update Global Search card item to be comfortable with rounded corners * Remove card background --- .../globalsearch/GlobalSearchCardHolder.kt | 3 + .../source/globalsearch/GlobalSearchHolder.kt | 3 - .../layout/global_search_controller_card.xml | 37 ++++----- .../global_search_controller_card_item.xml | 77 +++++++++++-------- 4 files changed, 60 insertions(+), 60 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/globalsearch/GlobalSearchCardHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/globalsearch/GlobalSearchCardHolder.kt index 6b740cee4..76fe9ae21 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/globalsearch/GlobalSearchCardHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/globalsearch/GlobalSearchCardHolder.kt @@ -7,6 +7,7 @@ import eu.kanade.tachiyomi.data.glide.GlideApp 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.progress import kotlinx.android.synthetic.main.global_search_controller_card_item.tvTitle @@ -32,6 +33,8 @@ class GlobalSearchCardHolder(view: View, adapter: GlobalSearchCardAdapter) : } fun bind(manga: Manga) { + card.clipToOutline = true + tvTitle.text = manga.title // Set alpha of thumbnail. itemImage.alpha = if (manga.favorite) 0.3f else 1.0f diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/globalsearch/GlobalSearchHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/globalsearch/GlobalSearchHolder.kt index c66fec4c0..38b9d8de6 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/globalsearch/GlobalSearchHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/globalsearch/GlobalSearchHolder.kt @@ -8,7 +8,6 @@ import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder import kotlinx.android.synthetic.main.global_search_controller_card.no_results_found import kotlinx.android.synthetic.main.global_search_controller_card.progress import kotlinx.android.synthetic.main.global_search_controller_card.recycler -import kotlinx.android.synthetic.main.global_search_controller_card.source_card import kotlinx.android.synthetic.main.global_search_controller_card.title import kotlinx.android.synthetic.main.global_search_controller_card.title_wrapper @@ -103,11 +102,9 @@ class GlobalSearchHolder(view: View, val adapter: GlobalSearchAdapter) : private fun showResultsHolder() { no_results_found.isVisible = false - source_card.isVisible = true } private fun showNoResults() { no_results_found.isVisible = true - source_card.isVisible = false } } diff --git a/app/src/main/res/layout/global_search_controller_card.xml b/app/src/main/res/layout/global_search_controller_card.xml index 83e1c1970..25c2c08d3 100644 --- a/app/src/main/res/layout/global_search_controller_card.xml +++ b/app/src/main/res/layout/global_search_controller_card.xml @@ -48,30 +48,21 @@ android:text="@string/no_results_found" android:visibility="gone" /> - + + - - - - - - + android:clipToPadding="false" + android:orientation="horizontal" + android:paddingStart="12dp" + android:paddingEnd="12dp" + tools:listitem="@layout/global_search_controller_card_item" /> diff --git a/app/src/main/res/layout/global_search_controller_card_item.xml b/app/src/main/res/layout/global_search_controller_card_item.xml index d00863182..5c2dca95f 100644 --- a/app/src/main/res/layout/global_search_controller_card_item.xml +++ b/app/src/main/res/layout/global_search_controller_card_item.xml @@ -4,48 +4,57 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:background="@drawable/list_item_selector" - android:orientation="vertical" - android:paddingStart="4dp" - android:paddingTop="8dp" - android:paddingEnd="4dp" - android:paddingBottom="8dp"> + android:background="@drawable/list_item_selector_background" + android:layout_marginStart="4dp" + android:layout_marginTop="8dp" + android:layout_marginEnd="4dp" + android:layout_marginBottom="8dp"> - - - + app:layout_constraintTop_toTopOf="parent"> + + + + + + + android:fontFamily="@font/ptsans_narrow_bold" + android:lineSpacingExtra="-4dp" + android:maxLines="2" + android:padding="4dp" + android:shadowColor="@color/textColorPrimaryLight" + app:layout_constraintEnd_toEndOf="@+id/card" + app:layout_constraintStart_toStartOf="@+id/card" + app:layout_constraintTop_toBottomOf="@+id/card" + tools:text="Sample name" /> + +