mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-02-15 11:00:38 +01:00
show the empty placeholder if search gives no results
This commit is contained in:
parent
3c643e7ded
commit
a916827b47
@ -169,6 +169,11 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet)
|
|||||||
filtered.sort()
|
filtered.sort()
|
||||||
filtered.sortBy { !it.getFullName(startNameWithSurname).startsWith(text, true) }
|
filtered.sortBy { !it.getFullName(startNameWithSurname).startsWith(text, true) }
|
||||||
|
|
||||||
|
if (filtered.isEmpty() && this@MyViewPagerFragment is FavoritesFragment) {
|
||||||
|
fragment_placeholder.text = activity.getString(R.string.no_items_found)
|
||||||
|
}
|
||||||
|
|
||||||
|
fragment_placeholder.beVisibleIf(filtered.isEmpty())
|
||||||
updateItems(filtered)
|
updateItems(filtered)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -179,6 +184,9 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet)
|
|||||||
|
|
||||||
fun onSearchClosed() {
|
fun onSearchClosed() {
|
||||||
(fragment_list.adapter as ContactsAdapter).updateItems(contactsIgnoringSearch)
|
(fragment_list.adapter as ContactsAdapter).updateItems(contactsIgnoringSearch)
|
||||||
|
if (this is FavoritesFragment) {
|
||||||
|
fragment_placeholder.text = activity?.getString(R.string.no_favorites)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateViewStuff() {
|
private fun updateViewStuff() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user