public class MenuPopupHelper extends Object implements android.widget.AdapterView.OnItemClickListener, android.view.View.OnKeyListener, android.view.ViewTreeObserver.OnGlobalLayoutListener, android.widget.PopupWindow.OnDismissListener, View_OnAttachStateChangeListener, MenuPresenter
MenuPresenter.Callback
Constructor and Description |
---|
MenuPopupHelper(android.content.Context context,
MenuBuilder menu) |
MenuPopupHelper(android.content.Context context,
MenuBuilder menu,
android.view.View anchorView) |
MenuPopupHelper(android.content.Context context,
MenuBuilder menu,
android.view.View anchorView,
boolean overflowOnly) |
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.
|
void |
dismiss() |
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.
|
boolean |
isShowing() |
void |
onCloseMenu(MenuBuilder menu,
boolean allMenusAreClosing)
Called by Menu implementations to indicate that a menu or submenu is
closing.
|
void |
onDismiss() |
void |
onGlobalLayout() |
void |
onItemClick(android.widget.AdapterView<?> parent,
android.view.View view,
int position,
long id) |
boolean |
onKey(android.view.View v,
int keyCode,
android.view.KeyEvent event) |
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 |
onViewAttachedToWindow(android.view.View v) |
void |
onViewDetachedFromWindow(android.view.View v) |
void |
setAnchorView(android.view.View anchor) |
void |
setCallback(MenuPresenter.Callback cb)
Set a callback object that will be notified of menu events
related to this specific presentation.
|
void |
setForceShowIcon(boolean forceShow) |
void |
show() |
boolean |
tryShow() |
void |
updateMenuView(boolean cleared)
Update the menu UI in response to a change.
|
public MenuPopupHelper(android.content.Context context, MenuBuilder menu)
public MenuPopupHelper(android.content.Context context, MenuBuilder menu, android.view.View anchorView)
public MenuPopupHelper(android.content.Context context, MenuBuilder menu, android.view.View anchorView, boolean overflowOnly)
public void setAnchorView(android.view.View anchor)
public void setForceShowIcon(boolean forceShow)
public void show()
public boolean tryShow()
public void dismiss()
public void onDismiss()
onDismiss
in interface android.widget.PopupWindow.OnDismissListener
public boolean isShowing()
public void onItemClick(android.widget.AdapterView<?> parent, android.view.View view, int position, long id)
onItemClick
in interface android.widget.AdapterView.OnItemClickListener
public boolean onKey(android.view.View v, int keyCode, android.view.KeyEvent event)
onKey
in interface android.view.View.OnKeyListener
public void onGlobalLayout()
onGlobalLayout
in interface android.view.ViewTreeObserver.OnGlobalLayoutListener
public void onViewAttachedToWindow(android.view.View v)
onViewAttachedToWindow
in interface View_OnAttachStateChangeListener
public void onViewDetachedFromWindow(android.view.View v)
onViewDetachedFromWindow
in interface View_OnAttachStateChangeListener
public void initForMenu(android.content.Context context, MenuBuilder menu)
MenuPresenter
MenuBuilder.addMenuPresenter(MenuPresenter)
initForMenu
in interface MenuPresenter
context
- Context for this presenter; used for view creation and resource managementmenu
- Menu to hostpublic MenuView getMenuView(android.view.ViewGroup root)
MenuPresenter
#initForMenu(Context, Menu)
.getMenuView
in interface MenuPresenter
root
- Intended parent of the MenuView.public void updateMenuView(boolean cleared)
MenuPresenter
updateMenuView
in interface MenuPresenter
cleared
- true if the menu was entirely clearedpublic void setCallback(MenuPresenter.Callback cb)
MenuPresenter
setCallback
in interface MenuPresenter
cb
- Callback that will be notified of future eventspublic boolean onSubMenuSelected(SubMenuBuilder subMenu)
MenuPresenter
onSubMenuSelected
in interface MenuPresenter
subMenu
- SubMenu being openedpublic void onCloseMenu(MenuBuilder menu, boolean allMenusAreClosing)
MenuPresenter
onCloseMenu
in interface MenuPresenter
menu
- Menu or submenu that is closing.allMenusAreClosing
- True if all associated menus are closing.public boolean flagActionItems()
MenuPresenter
flagActionItems
in interface MenuPresenter
public boolean expandItemActionView(MenuBuilder menu, MenuItemImpl item)
MenuPresenter
expandItemActionView
in interface MenuPresenter
menu
- Menu containing the item to be expandeditem
- Item to be expandedpublic boolean collapseItemActionView(MenuBuilder menu, MenuItemImpl item)
MenuPresenter
collapseItemActionView
in interface MenuPresenter
menu
- Menu containing the item to be collapseditem
- Item to be collapsedpublic int getId()
MenuPresenter
getId
in interface MenuPresenter
public android.os.Parcelable onSaveInstanceState()
MenuPresenter
MenuPresenter.onRestoreInstanceState(Parcelable)
method of the presenter sharing the same ID later.onSaveInstanceState
in interface MenuPresenter
public void onRestoreInstanceState(android.os.Parcelable state)
MenuPresenter
onRestoreInstanceState
in interface MenuPresenter
state
- The previously saved instance stateCopyright © 2011–2014. All rights reserved.