Hide Empty Search Results in Catalogues (#2066)

* test2

* remove nothing_found view and associated resources
This commit is contained in:
MCAxiaz
2019-07-01 04:06:19 -07:00
committed by inorichi
parent 62f9071adc
commit e8638cb0b3
29 changed files with 14 additions and 76 deletions

View File

@ -31,9 +31,6 @@ class CatalogueSearchHolder(view: View, val adapter: CatalogueSearchAdapter) :
// Set layout horizontal.
recycler.layoutManager = LinearLayoutManager(view.context, LinearLayoutManager.HORIZONTAL, false)
recycler.adapter = mangaAdapter
nothing_found_icon.setVectorCompat(R.drawable.ic_search_black_112dp,
view.context.getResourceColor(android.R.attr.textColorHint))
}
/**
@ -54,15 +51,15 @@ class CatalogueSearchHolder(view: View, val adapter: CatalogueSearchAdapter) :
when {
results == null -> {
progress.visible()
nothing_found.gone()
showHolder()
}
results.isEmpty() -> {
progress.gone()
nothing_found.visible()
hideHolder()
}
else -> {
progress.gone()
nothing_found.gone()
showHolder()
}
}
if (results !== lastBoundResults) {
@ -96,4 +93,15 @@ class CatalogueSearchHolder(view: View, val adapter: CatalogueSearchAdapter) :
return null
}
private fun showHolder() {
title.visible()
source_card.visible()
}
private fun hideHolder() {
title.gone()
source_card.gone()
}
}