public interface MenuPresenter
Modifier and Type | Interface and Description |
---|---|
static interface |
MenuPresenter.Callback
Called by menu implementation to notify another component of open/close events.
|
Modifier and Type | Method and Description |
---|---|
boolean |
collapseItemActionView(MenuBuilder menu,
MenuItemImpl item)
Called when a menu item with a collapsable action view should collapse its action view.
|
boolean |
expandItemActionView(MenuBuilder menu,
MenuItemImpl item)
Called when a menu item with a collapsable action view should expand its action view.
|
boolean |
flagActionItems()
Called by Menu implementations to flag items that will be shown as actions.
|
int |
getId()
Returns an ID for determining how to save/restore instance state.
|
MenuView |
getMenuView(ViewGroup root)
Retrieve a MenuView to display the menu specified in
initForMenu(Context, MenuBuilder) . |
void |
initForMenu(Context context,
MenuBuilder menu)
Initializes this presenter for the given context and menu.
|
void |
onCloseMenu(MenuBuilder menu,
boolean allMenusAreClosing)
Called by Menu implementations to indicate that a menu or submenu is
closing.
|
void |
onRestoreInstanceState(Parcelable state)
Supplies the previously saved instance state to be restored.
|
Parcelable |
onSaveInstanceState()
Returns a Parcelable describing the current state of the presenter.
|
boolean |
onSubMenuSelected(SubMenuBuilder subMenu)
Called by Menu implementations to indicate that a submenu item
has been selected.
|
void |
setCallback(MenuPresenter.Callback cb)
Set a callback object that will be notified of menu events
related to this specific presentation.
|
void |
updateMenuView(boolean cleared)
Update the menu UI in response to a change.
|
void initForMenu(Context context, MenuBuilder menu)
This method is called by MenuBuilder when a presenter is added. See
MenuBuilder.addMenuPresenter(MenuPresenter)
.
context
- the context for this presenter; used for view creation
and resource management, must be non-null
menu
- the menu to host, or null
to clear the hosted menuMenuView getMenuView(ViewGroup root)
initForMenu(Context, MenuBuilder)
.root
- Intended parent of the MenuView.void updateMenuView(boolean cleared)
cleared
- true if the menu was entirely clearedvoid setCallback(MenuPresenter.Callback cb)
cb
- Callback that will be notified of future eventsboolean onSubMenuSelected(SubMenuBuilder subMenu)
subMenu
- SubMenu being openedvoid onCloseMenu(MenuBuilder menu, boolean allMenusAreClosing)
menu
- the menu or submenu that is closingallMenusAreClosing
- true
if all displayed menus and
submenus are closing, false
if only
the specified menu is closingboolean flagActionItems()
boolean expandItemActionView(MenuBuilder menu, MenuItemImpl item)
menu
- Menu containing the item to be expandeditem
- Item to be expandedboolean collapseItemActionView(MenuBuilder menu, MenuItemImpl item)
menu
- Menu containing the item to be collapseditem
- Item to be collapsedint getId()
Parcelable onSaveInstanceState()
onRestoreInstanceState(Parcelable)
method of the presenter sharing the same ID later.void onRestoreInstanceState(Parcelable state)
state
- The previously saved instance state