public class PopupMenuHelper extends Object implements android.widget.AdapterView.OnItemClickListener, android.view.View.OnKeyListener, android.view.ViewTreeObserver.OnGlobalLayoutListener, PopupWindow.OnDismissListener, View_OnAttachStateChangeListener, MenuPresenter
MenuPresenter.Callback| Constructor and Description |
|---|
PopupMenuHelper(android.content.Context context,
MenuBuilder menu,
android.view.View decorView) |
| 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 |
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 PopupMenuHelper(android.content.Context context,
MenuBuilder menu,
android.view.View decorView)
public boolean collapseItemActionView(MenuBuilder menu, MenuItemImpl item)
MenuPresentercollapseItemActionView in interface MenuPresentermenu - Menu containing the item to be collapseditem - Item to be collapsedpublic void dismiss()
public boolean expandItemActionView(MenuBuilder menu, MenuItemImpl item)
MenuPresenterexpandItemActionView in interface MenuPresentermenu - Menu containing the item to be expandeditem - Item to be expandedpublic boolean flagActionItems()
MenuPresenterflagActionItems in interface MenuPresenterpublic int getId()
MenuPresentergetId in interface MenuPresenterpublic MenuView getMenuView(android.view.ViewGroup root)
MenuPresenter#initForMenu(Context, Menu).getMenuView in interface MenuPresenterroot - Intended parent of the MenuView.public void initForMenu(android.content.Context context,
MenuBuilder menu)
MenuPresenterMenuBuilder.addMenuPresenter(MenuPresenter)initForMenu in interface MenuPresentercontext - Context for this presenter; used for view creation and resource managementmenu - Menu to hostpublic boolean isShowing()
public void onCloseMenu(MenuBuilder menu, boolean allMenusAreClosing)
MenuPresenteronCloseMenu in interface MenuPresentermenu - Menu or submenu that is closing.allMenusAreClosing - True if all associated menus are closing.public void onDismiss()
onDismiss in interface PopupWindow.OnDismissListenerpublic void onGlobalLayout()
onGlobalLayout in interface android.view.ViewTreeObserver.OnGlobalLayoutListenerpublic void onItemClick(android.widget.AdapterView<?> parent,
android.view.View view,
int position,
long id)
onItemClick in interface android.widget.AdapterView.OnItemClickListenerpublic boolean onKey(android.view.View v,
int keyCode,
android.view.KeyEvent event)
onKey in interface android.view.View.OnKeyListenerpublic void onRestoreInstanceState(android.os.Parcelable state)
MenuPresenteronRestoreInstanceState in interface MenuPresenterstate - The previously saved instance statepublic android.os.Parcelable onSaveInstanceState()
MenuPresenterMenuPresenter.onRestoreInstanceState(Parcelable)
method of the presenter sharing the same ID later.onSaveInstanceState in interface MenuPresenterpublic boolean onSubMenuSelected(SubMenuBuilder subMenu)
MenuPresenteronSubMenuSelected in interface MenuPresentersubMenu - SubMenu being openedpublic void onViewAttachedToWindow(android.view.View v)
onViewAttachedToWindow in interface View_OnAttachStateChangeListenerpublic void onViewDetachedFromWindow(android.view.View v)
onViewDetachedFromWindow in interface View_OnAttachStateChangeListenerpublic void setCallback(MenuPresenter.Callback cb)
MenuPresentersetCallback in interface MenuPresentercb - Callback that will be notified of future eventspublic void setForceShowIcon(boolean forceShow)
public void show()
public boolean tryShow()
public void updateMenuView(boolean cleared)
MenuPresenterupdateMenuView in interface MenuPresentercleared - true if the menu was entirely clearedCopyright © 2012-2013. All Rights Reserved.