adding a helper function to avoid duplication
This commit is contained in:
parent
7a558f68f5
commit
c5a880b5f1
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue