mirror of
https://git.mihon.tech/mihonapp/mihon
synced 2024-11-26 23:28:58 +03:00
Add workaround for disappearing menu items
This commit is contained in:
parent
cc9b77b876
commit
d3cbfbdb59
2 changed files with 23 additions and 0 deletions
|
@ -1,8 +1,10 @@
|
|||
package eu.kanade.tachiyomi.ui.base.controller
|
||||
|
||||
import android.os.Bundle
|
||||
import android.support.v4.view.MenuItemCompat
|
||||
import android.support.v7.app.AppCompatActivity
|
||||
import android.view.LayoutInflater
|
||||
import android.view.MenuItem
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import com.bluelinelabs.conductor.ControllerChangeHandler
|
||||
|
@ -44,4 +46,23 @@ abstract class BaseController(bundle: Bundle? = null) : RestoreViewOnCreateContr
|
|||
(activity as? AppCompatActivity)?.supportActionBar?.title = getTitle()
|
||||
}
|
||||
|
||||
/**
|
||||
* Workaround for disappearing menu items when collapsing an expandable item like a SearchView.
|
||||
* This method should be removed when fixed upstream.
|
||||
* Issue link: https://issuetracker.google.com/issues/37657375
|
||||
*/
|
||||
fun MenuItem.fixExpand() {
|
||||
val expandListener = object : MenuItemCompat.OnActionExpandListener {
|
||||
override fun onMenuItemActionExpand(item: MenuItem): Boolean {
|
||||
return true
|
||||
}
|
||||
|
||||
override fun onMenuItemActionCollapse(item: MenuItem): Boolean {
|
||||
activity?.invalidateOptionsMenu()
|
||||
return true
|
||||
}
|
||||
}
|
||||
MenuItemCompat.setOnActionExpandListener(this, expandListener)
|
||||
}
|
||||
|
||||
}
|
|
@ -346,6 +346,8 @@ class LibraryController(
|
|||
query = it.toString()
|
||||
searchRelay.call(query)
|
||||
}
|
||||
|
||||
searchItem.fixExpand()
|
||||
}
|
||||
|
||||
override fun onPrepareOptionsMenu(menu: Menu) {
|
||||
|
|
Loading…
Reference in a new issue