Package icyllis.modernui.view.menu
Interface MenuPresenter
- All Known Implementing Classes:
CascadingMenuPopup
,MenuPopup
,StandardMenuPopup
public interface MenuPresenter
A MenuPresenter is responsible for building views for a Menu object.
It takes over some responsibility from the old style monolithic MenuBuilder class.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
Called by menu implementation to notify another component of open/close events. -
Method Summary
Modifier and TypeMethodDescriptionboolean
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
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.getMenuView
(ViewGroup root) Retrieve a MenuView to display the menu specified ininitForMenu(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.boolean
onSubMenuSelected
(SubMenuBuilder subMenu) Called by Menu implementations to indicate that a submenu item has been selected.void
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.
-
Method Details
-
getMenuView
Retrieve a MenuView to display the menu specified ininitForMenu(Context, MenuBuilder)
.- Parameters:
root
- Intended parent of the MenuView.- Returns:
- A freshly created MenuView.
-
updateMenuView
void updateMenuView(boolean cleared) Update the menu UI in response to a change. Called by MenuBuilder during the normal course of operation.- Parameters:
cleared
- true if the menu was entirely cleared
-
flagActionItems
boolean flagActionItems()Called by Menu implementations to flag items that will be shown as actions.- Returns:
- true if this presenter changed the action status of any items.
-
getId
int getId()Returns an ID for determining how to save/restore instance state.- Returns:
- a valid ID value.