mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-23 04:21:52 +01:00
Explicitly show "No results found" in global search instead of hiding row
This commit is contained in:
parent
d2e2ebbe45
commit
d3ebedeef2
@ -6,6 +6,7 @@ import eu.kanade.tachiyomi.data.database.models.Manga
|
|||||||
import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder
|
import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder
|
||||||
import eu.kanade.tachiyomi.util.view.gone
|
import eu.kanade.tachiyomi.util.view.gone
|
||||||
import eu.kanade.tachiyomi.util.view.visible
|
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.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.source_card
|
||||||
@ -58,15 +59,15 @@ class GlobalSearchHolder(view: View, val adapter: GlobalSearchAdapter) :
|
|||||||
when {
|
when {
|
||||||
results == null -> {
|
results == null -> {
|
||||||
progress.visible()
|
progress.visible()
|
||||||
showHolder()
|
showResultsHolder()
|
||||||
}
|
}
|
||||||
results.isEmpty() -> {
|
results.isEmpty() -> {
|
||||||
progress.gone()
|
progress.gone()
|
||||||
hideHolder()
|
showNoResults()
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
progress.gone()
|
progress.gone()
|
||||||
showHolder()
|
showResultsHolder()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (results !== lastBoundResults) {
|
if (results !== lastBoundResults) {
|
||||||
@ -101,13 +102,13 @@ class GlobalSearchHolder(view: View, val adapter: GlobalSearchAdapter) :
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showHolder() {
|
private fun showResultsHolder() {
|
||||||
title_wrapper.visible()
|
no_results_found.gone()
|
||||||
source_card.visible()
|
source_card.visible()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun hideHolder() {
|
private fun showNoResults() {
|
||||||
title_wrapper.gone()
|
no_results_found.visible()
|
||||||
source_card.gone()
|
source_card.gone()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,16 @@
|
|||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</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
|
<androidx.cardview.widget.CardView
|
||||||
android:id="@+id/source_card"
|
android:id="@+id/source_card"
|
||||||
style="@style/Theme.Widget.CardView.Item"
|
style="@style/Theme.Widget.CardView.Item"
|
||||||
|
Loading…
Reference in New Issue
Block a user