mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-23 15:41:52 +01:00
Updated ui of global search
you know md2 and all that also sources with no results say "no results found"
This commit is contained in:
parent
0244e1edb4
commit
1cca914c8f
@ -5,6 +5,7 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||
import eu.kanade.tachiyomi.data.database.models.Manga
|
||||
import eu.kanade.tachiyomi.data.glide.GlideApp
|
||||
import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder
|
||||
import eu.kanade.tachiyomi.util.view.visibleIf
|
||||
import eu.kanade.tachiyomi.widget.StateImageViewTarget
|
||||
import kotlinx.android.synthetic.main.source_global_search_controller_card_item.*
|
||||
|
||||
@ -29,10 +30,8 @@ class SourceSearchCardHolder(view: View, adapter: SourceSearchCardAdapter) :
|
||||
}
|
||||
|
||||
fun bind(manga: Manga) {
|
||||
tvTitle.text = manga.title
|
||||
// Set alpha of thumbnail.
|
||||
itemImage.alpha = if (manga.favorite) 0.3f else 1.0f
|
||||
|
||||
title.text = manga.title
|
||||
favorite_button.visibleIf(manga.favorite)
|
||||
setImage(manga)
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,8 @@ class SourceSearchHolder(view: View, val adapter: SourceSearchAdapter) :
|
||||
}
|
||||
results.isEmpty() -> {
|
||||
progress.gone()
|
||||
hideHolder()
|
||||
no_results.visible()
|
||||
source_card.gone()
|
||||
}
|
||||
else -> {
|
||||
progress.gone()
|
||||
@ -92,12 +93,7 @@ class SourceSearchHolder(view: View, val adapter: SourceSearchAdapter) :
|
||||
}
|
||||
|
||||
private fun showHolder() {
|
||||
title.visible()
|
||||
source_card.visible()
|
||||
}
|
||||
|
||||
private fun hideHolder() {
|
||||
title.gone()
|
||||
source_card.gone()
|
||||
no_results.gone()
|
||||
}
|
||||
}
|
||||
|
7
app/src/main/res/drawable/favorite_badge_rounded.xml
Normal file
7
app/src/main/res/drawable/favorite_badge_rounded.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners
|
||||
android:bottomRightRadius="10dp" />
|
||||
<solid android:color="@color/unread_badge" />
|
||||
</shape>
|
@ -11,19 +11,40 @@
|
||||
style="@style/TextAppearance.Regular.SubHeading"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/material_component_text_fields_padding_above_and_below_label"
|
||||
app:layout_constraintBottom_toTopOf="@+id/source_card"
|
||||
app:layout_constraintHeight_default="wrap"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="0dp"
|
||||
android:paddingBottom="0dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="Title" />
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/source_card"
|
||||
style="@style/Theme.Widget.CardView.Item"
|
||||
<TextView
|
||||
android:id="@+id/no_results"
|
||||
style="@style/TextAppearance.Regular.Body1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="144dp"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="0dp"
|
||||
android:paddingBottom="16dp"
|
||||
app:layout_constraintHeight_default="wrap"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
tools:visibility="visible"
|
||||
app:layout_constraintTop_toBottomOf="@id/title"
|
||||
android:text="@string/no_results_found"/>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/source_card"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="208dp"
|
||||
android:paddingTop="2dp"
|
||||
android:paddingBottom="8dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/title"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constrainedHeight="true"
|
||||
@ -41,11 +62,11 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingEnd="4dp"
|
||||
android:paddingStart="4dp"
|
||||
android:paddingEnd="7dp"
|
||||
android:paddingStart="7dp"
|
||||
android:clipToPadding="false"
|
||||
tools:listitem="@layout/source_global_search_controller_card_item" />
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
</FrameLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
@ -1,55 +1,87 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
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:paddingBottom="8dp"
|
||||
android:paddingEnd="4dp"
|
||||
android:paddingStart="4dp"
|
||||
android:paddingTop="8dp">
|
||||
android:background="@drawable/library_item_selector">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progress"
|
||||
style="?android:attr/progressBarStyleSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
app:layout_constrainedHeight="true"
|
||||
app:layout_constrainedWidth="true"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/itemImage"
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/card"
|
||||
android:layout_width="112dp"
|
||||
android:layout_height="112dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:scaleType="fitCenter"
|
||||
android:layout_height="168dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="ContentDescription"
|
||||
tools:src="@mipmap/ic_launcher" />
|
||||
app:layout_constraintVertical_bias="1.0">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTitle"
|
||||
style="@style/TextAppearance.Regular.Caption"
|
||||
android:layout_width="104dp"
|
||||
<ImageView
|
||||
android:id="@+id/itemImage"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="centerCrop"
|
||||
android:background="?android:attr/colorBackground"
|
||||
tools:background="?android:attr/colorBackground"
|
||||
tools:ignore="ContentDescription"
|
||||
tools:src="@mipmap/ic_launcher" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progress"
|
||||
style="?android:attr/progressBarStyleSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/favorite_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardCornerRadius="10dp"
|
||||
app:cardBackgroundColor="@color/unread_badge"
|
||||
app:cardElevation="2dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent">
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:gravity="center"
|
||||
android:maxLines="1"
|
||||
android:paddingStart="5dp"
|
||||
android:paddingEnd="5dp"
|
||||
android:textSize="13sp"
|
||||
android:textColor="@color/unread_badge_text"
|
||||
style="@style/TextAppearance.Regular.Caption.Light"
|
||||
android:layout_height="wrap_content"
|
||||
android:tint="@color/md_white_1000"
|
||||
android:text="@string/in_library"/>
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/title"
|
||||
style="@style/TextAppearance.Regular.Body1.Light"
|
||||
android:layout_width="110dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="0dp"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:maxLines="1"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="12sp"
|
||||
app:layout_constrainedHeight="true"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/itemImage"
|
||||
tools:text="Sample title" />
|
||||
app:layout_constraintTop_toBottomOf="@+id/card"
|
||||
tools:text="Sample name" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
Loading…
Reference in New Issue
Block a user