From d3ebedeef2a0fcacb4bea7244272fc940b2ba0d5 Mon Sep 17 00:00:00 2001 From: arkon Date: Sat, 18 Jul 2020 17:46:29 -0400 Subject: [PATCH] Explicitly show "No results found" in global search instead of hiding row --- .../source/globalsearch/GlobalSearchHolder.kt | 15 ++++++++------- .../res/layout/global_search_controller_card.xml | 10 ++++++++++ 2 files changed, 18 insertions(+), 7 deletions(-) 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 9981910f03..c2a534451c 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 @@ -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() } } 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 e732422773..83e1c19701 100644 --- a/app/src/main/res/layout/global_search_controller_card.xml +++ b/app/src/main/res/layout/global_search_controller_card.xml @@ -38,6 +38,16 @@ + +