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(android.view.ViewGroup root)
Retrieve a MenuView to display the menu specified in
#initForMenu(Context, Menu) . |
void |
initForMenu(android.content.Context context,
MenuBuilder menu)
Initialize 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(android.os.Parcelable state)
Supplies the previously saved instance state to be restored.
|
android.os.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(android.content.Context context, MenuBuilder menu)
MenuBuilder.addMenuPresenter(MenuPresenter)
context
- Context for this presenter; used for view creation and resource managementmenu
- Menu to hostMenuView getMenuView(android.view.ViewGroup root)
#initForMenu(Context, Menu)
.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
- Menu or submenu that is closing.allMenusAreClosing
- True if all associated menus are closing.boolean 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()
android.os.Parcelable onSaveInstanceState()
onRestoreInstanceState(Parcelable)
method of the presenter sharing the same ID later.void onRestoreInstanceState(android.os.Parcelable state)
state
- The previously saved instance stateCopyright © 2011–2014. All rights reserved.