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.setupMenu()
|
||||||
|
|
||||||
main_menu.onSearchClosedListener = {
|
main_menu.onSearchClosedListener = {
|
||||||
search_holder.animate().alpha(0f).setDuration(SHORT_ANIMATION_DURATION).withEndAction {
|
fadeOutSearch()
|
||||||
search_holder.beGone()
|
|
||||||
searchTextChanged("", true)
|
|
||||||
}.start()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
main_menu.onSearchTextChangedListener = { text ->
|
main_menu.onSearchTextChangedListener = { text ->
|
||||||
|
@ -155,10 +152,7 @@ class MainActivity : SimpleActivity() {
|
||||||
search_holder.fadeIn()
|
search_holder.fadeIn()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
search_holder.animate().alpha(0f).setDuration(SHORT_ANIMATION_DURATION).withEndAction {
|
fadeOutSearch()
|
||||||
search_holder.beGone()
|
|
||||||
searchTextChanged("", true)
|
|
||||||
}.start()
|
|
||||||
}
|
}
|
||||||
searchTextChanged(text)
|
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")
|
@SuppressLint("NotifyDataSetChanged")
|
||||||
private fun notifyDatasetChanged() {
|
private fun notifyDatasetChanged() {
|
||||||
getOrCreateConversationsAdapter().notifyDataSetChanged()
|
getOrCreateConversationsAdapter().notifyDataSetChanged()
|
||||||
|
|
Loading…
Reference in New Issue