adding a helper function to avoid duplication

This commit is contained in:
tibbi 2023-01-06 17:49:54 +01:00
parent 7a558f68f5
commit c5a880b5f1
1 changed files with 9 additions and 8 deletions

View File

@ -143,10 +143,7 @@ class MainActivity : SimpleActivity() {
main_menu.setupMenu()
main_menu.onSearchClosedListener = {
search_holder.animate().alpha(0f).setDuration(SHORT_ANIMATION_DURATION).withEndAction {
search_holder.beGone()
searchTextChanged("", true)
}.start()
fadeOutSearch()
}
main_menu.onSearchTextChangedListener = { text ->
@ -155,10 +152,7 @@ class MainActivity : SimpleActivity() {
search_holder.fadeIn()
}
} else {
search_holder.animate().alpha(0f).setDuration(SHORT_ANIMATION_DURATION).withEndAction {
search_holder.beGone()
searchTextChanged("", true)
}.start()
fadeOutSearch()
}
searchTextChanged(text)
}
@ -384,6 +378,13 @@ class MainActivity : SimpleActivity() {
}
}
private fun fadeOutSearch() {
search_holder.animate().alpha(0f).setDuration(SHORT_ANIMATION_DURATION).withEndAction {
search_holder.beGone()
searchTextChanged("", true)
}.start()
}
@SuppressLint("NotifyDataSetChanged")
private fun notifyDatasetChanged() {
getOrCreateConversationsAdapter().notifyDataSetChanged()