Fix catalogue search focus automatically being removed (#2396)

Fix catalogue search focus automatically being removed
This commit is contained in:
MCAxiaz
2020-01-12 12:02:21 -08:00
committed by arkon
parent 57595988f5
commit 6b5742c1ff
2 changed files with 9 additions and 12 deletions
@@ -89,15 +89,16 @@ abstract class BaseController(bundle: Bundle? = null) : RestoreViewOnCreateContr
* This method should be removed when fixed upstream.
* Issue link: https://issuetracker.google.com/issues/37657375
*/
fun MenuItem.fixExpand() {
fun MenuItem.fixExpand(onExpand: ((MenuItem) -> Boolean)? = null, onCollapse: ((MenuItem) -> Boolean)? = null) {
setOnActionExpandListener(object : MenuItem.OnActionExpandListener {
override fun onMenuItemActionExpand(item: MenuItem): Boolean {
return true
return onExpand?.invoke(item) ?: true
}
override fun onMenuItemActionCollapse(item: MenuItem): Boolean {
activity?.invalidateOptionsMenu()
return true
return onCollapse?.invoke(item) ?: true
}
})
}