Update latest tab with the new global search features

This commit is contained in:
Jobobby04 2020-07-19 19:52:50 -04:00
parent 8e94afb9c1
commit 4771fa529d
2 changed files with 34 additions and 26 deletions

View File

@ -8,6 +8,7 @@ import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder
import eu.kanade.tachiyomi.ui.browse.source.globalsearch.LatestAdapter
import eu.kanade.tachiyomi.util.view.gone
import eu.kanade.tachiyomi.util.view.visible
import kotlinx.android.synthetic.main.latest_controller_card.no_results_found
import kotlinx.android.synthetic.main.latest_controller_card.progress
import kotlinx.android.synthetic.main.latest_controller_card.recycler
import kotlinx.android.synthetic.main.latest_controller_card.source_card
@ -62,15 +63,15 @@ class LatestHolder(view: View, val adapter: LatestAdapter) :
when {
results == null -> {
progress.visible()
showHolder()
showResultsHolder()
}
results.isEmpty() -> {
progress.gone()
hideHolder()
showNoResults()
}
else -> {
progress.gone()
showHolder()
showResultsHolder()
}
}
if (results !== lastBoundResults) {
@ -105,13 +106,13 @@ class LatestHolder(view: View, val adapter: LatestAdapter) :
return null
}
private fun showHolder() {
title_wrapper.visible()
private fun showResultsHolder() {
no_results_found.gone()
source_card.visible()
}
private fun hideHolder() {
title_wrapper.gone()
private fun showNoResults() {
no_results_found.visible()
source_card.gone()
}
}

View File

@ -6,41 +6,48 @@
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/title_wrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:padding="@dimen/material_component_text_fields_padding_above_and_below_label"
app:srcCompat="@drawable/ic_add_24dp"
app:tint="?android:attr/textColorPrimary"
tools:ignore="ContentDescription" />
android:background="?attr/selectableItemBackground">
<TextView
android:id="@+id/title"
style="@style/TextAppearance.Regular.SubHeading"
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_toEndOf="@+id/image"
android:padding="@dimen/material_component_text_fields_padding_above_and_below_label"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/title_more_icon"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="Title" />
<ImageView
android:id="@+id/title_more_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:contentDescription="@string/label_more"
android:padding="@dimen/material_component_text_fields_padding_above_and_below_label"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_arrow_forward_24dp"
app:tint="?android:attr/textColorPrimary"
tools:ignore="ContentDescription" />
app:tint="?android:attr/textColorPrimary" />
</RelativeLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:id="@+id/no_results_found"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="@dimen/material_component_text_fields_padding_above_and_below_label"
android:paddingEnd="@dimen/material_component_text_fields_padding_above_and_below_label"
android:paddingBottom="@dimen/material_component_text_fields_padding_above_and_below_label"
android:text="@string/no_results_found"
android:visibility="gone" />
<androidx.cardview.widget.CardView
android:id="@+id/source_card"