Skip to content

Commit

Permalink
Remove search item if search is open. Hide and show bottom navigation…
Browse files Browse the repository at this point in the history
… depending on search state
  • Loading branch information
jahirfiquitiva committed Apr 6, 2020
1 parent f865c4a commit fbb218f
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import androidx.appcompat.widget.Toolbar
import dev.jahir.frames.R
import dev.jahir.frames.extensions.color
import dev.jahir.frames.extensions.findView
import dev.jahir.frames.extensions.gone
import dev.jahir.frames.extensions.resolveColor
import dev.jahir.frames.extensions.visible
import dev.jahir.frames.ui.widgets.CleanSearchView
import dev.jahir.frames.utils.Prefs
import dev.jahir.frames.utils.postDelayed
Expand All @@ -32,9 +34,14 @@ abstract class BaseSearchableActivity<out P : Prefs> : BaseFavoritesConnectedAct
menu?.let {
searchItem = it.findItem(R.id.search)
searchView = searchItem?.actionView as? CleanSearchView
searchView?.onExpand = {
it.findItem(R.id.search).isVisible = false
bottomNavigation?.gone()
}
searchView?.onCollapse = {
doSearch(closed = true)
invalidateOptionsMenu()
bottomNavigation?.visible()
}
searchView?.onQueryChanged = { query -> doSearch(query) }
searchView?.onQuerySubmit = { query -> doSearch(query) }
Expand Down

0 comments on commit fbb218f

Please sign in to comment.