public class IconMenuPresenter extends BaseMenuPresenter
MenuPresenter.Callback
mContext, mInflater, mMenu, mMenuView, mSystemContext, mSystemInflater
Constructor and Description |
---|
IconMenuPresenter(Context context) |
Modifier and Type | Method and Description |
---|---|
protected void |
addItemView(View itemView,
int childIndex)
Add an item view at the given index.
|
void |
bindItemView(MenuItemImpl item,
MenuView.ItemView itemView)
Bind item data to an existing item view.
|
protected boolean |
filterLeftoverView(ViewGroup parent,
int childIndex)
Filter the child view at index and remove it if appropriate.
|
int |
getNumActualItemsShown() |
void |
initForMenu(Context context,
MenuBuilder menu)
Initializes this presenter for the given context and menu.
|
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 |
restoreHierarchyState(Bundle inState) |
void |
saveHierarchyState(Bundle outState) |
boolean |
shouldIncludeItem(int childIndex,
MenuItemImpl item)
Filter item by child index and item data.
|
void |
updateMenuView(boolean cleared)
Reuses item views when it can
|
collapseItemActionView, createItemView, expandItemActionView, flagActionItems, getCallback, getId, getItemView, getMenuView, onCloseMenu, setCallback, setId
public IconMenuPresenter(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 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 presentprotected void addItemView(View itemView, int childIndex)
BaseMenuPresenter
addItemView
in class BaseMenuPresenter
itemView
- View to addchildIndex
- Index within the parent to insert atpublic boolean onSubMenuSelected(SubMenuBuilder subMenu)
MenuPresenter
onSubMenuSelected
in interface MenuPresenter
onSubMenuSelected
in class BaseMenuPresenter
subMenu
- SubMenu being openedpublic void updateMenuView(boolean cleared)
BaseMenuPresenter
updateMenuView
in interface MenuPresenter
updateMenuView
in class BaseMenuPresenter
cleared
- true if the menu was entirely clearedprotected boolean filterLeftoverView(ViewGroup parent, int childIndex)
BaseMenuPresenter
filterLeftoverView
in class BaseMenuPresenter
parent
- Parent to filter fromchildIndex
- Index to filterpublic int getNumActualItemsShown()
public void saveHierarchyState(Bundle outState)
public void restoreHierarchyState(Bundle inState)
public Parcelable onSaveInstanceState()
MenuPresenter
MenuPresenter.onRestoreInstanceState(Parcelable)
method of the presenter sharing the same ID later.public void onRestoreInstanceState(Parcelable state)
MenuPresenter
state
- The previously saved instance state