mirror of
https://github.com/aniyomiorg/aniyomi.git
synced 2024-11-24 05:38:01 +03:00
Explicitly show "No results found" in global search instead of hiding row
This commit is contained in:
parent
d2e2ebbe45
commit
d3ebedeef2
2 changed files with 18 additions and 7 deletions
|
@ -6,6 +6,7 @@ import eu.kanade.tachiyomi.data.database.models.Manga
|
|||
import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder
|
||||
import eu.kanade.tachiyomi.util.view.gone
|
||||
import eu.kanade.tachiyomi.util.view.visible
|
||||
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
|
||||
|
@ -58,15 +59,15 @@ class GlobalSearchHolder(view: View, val adapter: GlobalSearchAdapter) :
|
|||
when {
|
||||
results == null -> {
|
||||
progress.visible()
|
||||
showHolder()
|
||||
showResultsHolder()
|
||||
}
|
||||
results.isEmpty() -> {
|
||||
progress.gone()
|
||||
hideHolder()
|
||||
showNoResults()
|
||||
}
|
||||
else -> {
|
||||
progress.gone()
|
||||
showHolder()
|
||||
showResultsHolder()
|
||||
}
|
||||
}
|
||||
if (results !== lastBoundResults) {
|
||||
|
@ -101,13 +102,13 @@ class GlobalSearchHolder(view: View, val adapter: GlobalSearchAdapter) :
|
|||
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()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,6 +38,16 @@
|
|||
|
||||
</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"
|
||||
style="@style/Theme.Widget.CardView.Item"
|
||||
|
|
Loading…
Reference in a new issue