Update Global search layout to match Library and Browse (#3892)

* Update Global Search card item to be comfortable with rounded corners

* Remove card background
This commit is contained in:
Andreas E 2020-10-24 19:07:06 +02:00 committed by GitHub
parent f1350bc33e
commit a2b1acd70f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 60 additions and 60 deletions

View File

@ -7,6 +7,7 @@ import eu.kanade.tachiyomi.data.glide.GlideApp
import eu.kanade.tachiyomi.data.glide.toMangaThumbnail import eu.kanade.tachiyomi.data.glide.toMangaThumbnail
import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder
import eu.kanade.tachiyomi.widget.StateImageViewTarget 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.itemImage
import kotlinx.android.synthetic.main.global_search_controller_card_item.progress 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.tvTitle
@ -32,6 +33,8 @@ class GlobalSearchCardHolder(view: View, adapter: GlobalSearchCardAdapter) :
} }
fun bind(manga: Manga) { fun bind(manga: Manga) {
card.clipToOutline = true
tvTitle.text = manga.title tvTitle.text = manga.title
// Set alpha of thumbnail. // Set alpha of thumbnail.
itemImage.alpha = if (manga.favorite) 0.3f else 1.0f itemImage.alpha = if (manga.favorite) 0.3f else 1.0f

View File

@ -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.no_results_found
import kotlinx.android.synthetic.main.global_search_controller_card.progress 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.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
import kotlinx.android.synthetic.main.global_search_controller_card.title_wrapper 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() { private fun showResultsHolder() {
no_results_found.isVisible = false no_results_found.isVisible = false
source_card.isVisible = true
} }
private fun showNoResults() { private fun showNoResults() {
no_results_found.isVisible = true no_results_found.isVisible = true
source_card.isVisible = false
} }
} }

View File

@ -48,13 +48,6 @@
android:text="@string/no_results_found" android:text="@string/no_results_found"
android:visibility="gone" /> android:visibility="gone" />
<androidx.cardview.widget.CardView
android:id="@+id/source_card"
style="@style/Theme.Widget.CardView.Item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="144dp">
<ProgressBar <ProgressBar
android:id="@+id/progress" android:id="@+id/progress"
style="?android:attr/progressBarStyleSmall" style="?android:attr/progressBarStyleSmall"
@ -68,10 +61,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:clipToPadding="false" android:clipToPadding="false"
android:orientation="horizontal" android:orientation="horizontal"
android:paddingStart="4dp" android:paddingStart="12dp"
android:paddingEnd="4dp" android:paddingEnd="12dp"
tools:listitem="@layout/global_search_controller_card_item" /> tools:listitem="@layout/global_search_controller_card_item" />
</androidx.cardview.widget.CardView>
</LinearLayout> </LinearLayout>

View File

@ -4,48 +4,57 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/list_item_selector" android:background="@drawable/list_item_selector_background"
android:orientation="vertical" android:layout_marginStart="4dp"
android:paddingStart="4dp" android:layout_marginTop="8dp"
android:paddingTop="8dp" android:layout_marginEnd="4dp"
android:paddingEnd="4dp" android:layout_marginBottom="8dp">
android:paddingBottom="8dp">
<FrameLayout
android:id="@+id/card"
android:layout_width="112dp"
android:layout_height="0dp"
android:background="@drawable/rounded_rectangle"
app:layout_constraintDimensionRatio="h,5:7"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ProgressBar <ProgressBar
android:id="@+id/progress" android:id="@+id/progress"
style="?android:attr/progressBarStyleSmall" style="?android:attr/progressBarStyleSmall"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:visibility="gone" android:layout_gravity="center"
app:layout_constraintBottom_toBottomOf="parent" android:visibility="gone" />
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView <ImageView
android:id="@+id/itemImage" android:id="@+id/itemImage"
android:layout_width="112dp" android:layout_width="match_parent"
android:layout_height="112dp" android:layout_height="match_parent"
android:paddingBottom="8dp" android:background="?attr/colorSurface"
android:scaleType="fitCenter" android:scaleType="centerCrop"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="ContentDescription" tools:ignore="ContentDescription"
tools:src="@mipmap/ic_launcher" /> tools:src="@mipmap/ic_launcher" />
</FrameLayout>
<TextView <TextView
android:id="@+id/tvTitle" android:id="@+id/tvTitle"
style="@style/TextAppearance.Regular.Caption" style="@style/TextAppearance.Regular.Body1"
android:layout_width="104dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="0dp"
android:ellipsize="end" android:ellipsize="end"
android:gravity="center" android:fontFamily="@font/ptsans_narrow_bold"
android:maxLines="1" android:lineSpacingExtra="-4dp"
app:layout_constraintEnd_toEndOf="parent" android:maxLines="2"
app:layout_constraintStart_toStartOf="parent" android:padding="4dp"
app:layout_constraintTop_toBottomOf="@+id/itemImage" android:shadowColor="@color/textColorPrimaryLight"
tools:text="Sample title" /> app:layout_constraintEnd_toEndOf="@+id/card"
app:layout_constraintStart_toStartOf="@+id/card"
app:layout_constraintTop_toBottomOf="@+id/card"
tools:text="Sample name" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>