public class ActionMenuPresenter extends BaseMenuPresenter implements ActionProvider.SubUiVisibilityListener
MenuPresenter.Callback
mContext, mInflater, mMenu, mMenuView, mSystemContext, mSystemInflater
Constructor and Description |
---|
ActionMenuPresenter(Context context) |
Modifier and Type | Method and Description |
---|---|
void |
bindItemView(MenuItemImpl item,
MenuView.ItemView itemView)
Bind item data to an existing item view.
|
boolean |
dismissPopupMenus()
Dismiss all popup menus - overflow and submenus.
|
boolean |
filterLeftoverView(ViewGroup parent,
int childIndex)
Filter the child view at index and remove it if appropriate.
|
boolean |
flagActionItems()
Called by Menu implementations to flag items that will be shown as actions.
|
View |
getItemView(MenuItemImpl item,
View convertView,
ViewGroup parent)
Prepare an item view for use.
|
MenuView |
getMenuView(ViewGroup root)
Retrieve a MenuView to display the menu specified in
MenuPresenter.initForMenu(Context, MenuBuilder) . |
Drawable |
getOverflowIcon() |
boolean |
hideOverflowMenu()
Hide the overflow menu if it is currently showing.
|
boolean |
hideSubMenus()
Dismiss all submenu popups.
|
void |
initForMenu(Context context,
MenuBuilder menu)
Initializes this presenter for the given context and menu.
|
boolean |
isOverflowMenuShowing() |
boolean |
isOverflowMenuShowPending() |
boolean |
isOverflowReserved() |
void |
onCloseMenu(MenuBuilder menu,
boolean allMenusAreClosing)
Called by Menu implementations to indicate that a menu or submenu is
closing.
|
void |
onConfigurationChanged(Configuration newConfig) |
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 |
onSubUiVisibilityChanged(boolean isVisible) |
void |
setExpandedActionViewsExclusive(boolean isExclusive) |
void |
setItemLimit(int itemCount) |
void |
setMenuView(ActionMenuView menuView) |
void |
setOverflowIcon(Drawable icon) |
void |
setReserveOverflow(boolean reserveOverflow) |
void |
setWidthLimit(int width,
boolean strict) |
boolean |
shouldIncludeItem(int childIndex,
MenuItemImpl item)
Filter item by child index and item data.
|
boolean |
showOverflowMenu()
Display the overflow menu if one is present.
|
void |
updateMenuView(boolean cleared)
Reuses item views when it can
|
addItemView, collapseItemActionView, createItemView, expandItemActionView, getCallback, getId, setCallback, setId
public ActionMenuPresenter(Context context)
public void initForMenu(Context context, MenuBuilder menu)
MenuPresenter
This method is called by MenuBuilder when a presenter is added. See
MenuBuilder.addMenuPresenter(MenuPresenter)
.
initForMenu
in interface MenuPresenter
initForMenu
in class BaseMenuPresenter
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 menupublic void onConfigurationChanged(Configuration newConfig)
public void setWidthLimit(int width, boolean strict)
public void setReserveOverflow(boolean reserveOverflow)
public void setItemLimit(int itemCount)
public void setExpandedActionViewsExclusive(boolean isExclusive)
public void setOverflowIcon(Drawable icon)
public Drawable getOverflowIcon()
public MenuView getMenuView(ViewGroup root)
MenuPresenter
MenuPresenter.initForMenu(Context, MenuBuilder)
.getMenuView
in interface MenuPresenter
getMenuView
in class BaseMenuPresenter
root
- Intended parent of the MenuView.public View getItemView(MenuItemImpl item, View convertView, ViewGroup parent)
BaseMenuPresenter
getItemView
in class BaseMenuPresenter
item
- Item to presentconvertView
- Existing view to reuseparent
- Intended parent view - use for inflation.public void bindItemView(MenuItemImpl item, MenuView.ItemView itemView)
BaseMenuPresenter
bindItemView
in class BaseMenuPresenter
item
- Item to binditemView
- View to populate with item datapublic boolean shouldIncludeItem(int childIndex, MenuItemImpl item)
BaseMenuPresenter
shouldIncludeItem
in class BaseMenuPresenter
childIndex
- Indended presentation index of this itemitem
- Item to presentpublic void updateMenuView(boolean cleared)
BaseMenuPresenter
updateMenuView
in interface MenuPresenter
updateMenuView
in class BaseMenuPresenter
cleared
- true if the menu was entirely clearedpublic boolean filterLeftoverView(ViewGroup parent, int childIndex)
BaseMenuPresenter
filterLeftoverView
in class BaseMenuPresenter
parent
- Parent to filter fromchildIndex
- Index to filterpublic boolean onSubMenuSelected(SubMenuBuilder subMenu)
MenuPresenter
onSubMenuSelected
in interface MenuPresenter
onSubMenuSelected
in class BaseMenuPresenter
subMenu
- SubMenu being openedpublic boolean showOverflowMenu()
public boolean hideOverflowMenu()
public boolean dismissPopupMenus()
public boolean hideSubMenus()
public boolean isOverflowMenuShowing()
public boolean isOverflowMenuShowPending()
public boolean isOverflowReserved()
public boolean flagActionItems()
MenuPresenter
flagActionItems
in interface MenuPresenter
flagActionItems
in class BaseMenuPresenter
public void onCloseMenu(MenuBuilder menu, boolean allMenusAreClosing)
MenuPresenter
onCloseMenu
in interface MenuPresenter
onCloseMenu
in class BaseMenuPresenter
menu
- the menu or submenu that is closingallMenusAreClosing
- true
if all displayed menus and
submenus are closing, false
if only
the specified menu is closingpublic Parcelable onSaveInstanceState()
MenuPresenter
MenuPresenter.onRestoreInstanceState(Parcelable)
method of the presenter sharing the same ID later.onSaveInstanceState
in interface MenuPresenter
public void onRestoreInstanceState(Parcelable state)
MenuPresenter
onRestoreInstanceState
in interface MenuPresenter
state
- The previously saved instance statepublic void onSubUiVisibilityChanged(boolean isVisible)
onSubUiVisibilityChanged
in interface ActionProvider.SubUiVisibilityListener
public void setMenuView(ActionMenuView menuView)