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.OnDismissListenerpublic boolean isShowing()
public 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 onGlobalLayout()
onGlobalLayout in interface android.view.ViewTreeObserver.OnGlobalLayoutListenerpublic void onViewAttachedToWindow(android.view.View v)
onViewAttachedToWindow in interface View_OnAttachStateChangeListenerpublic void onViewDetachedFromWindow(android.view.View v)
onViewDetachedFromWindow in interface View_OnAttachStateChangeListenerpublic 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 MenuView getMenuView(android.view.ViewGroup root)
MenuPresenter#initForMenu(Context, Menu).getMenuView in interface MenuPresenterroot - Intended parent of the MenuView.public void updateMenuView(boolean cleared)
MenuPresenterupdateMenuView in interface MenuPresentercleared - true if the menu was entirely clearedpublic void setCallback(MenuPresenter.Callback cb)
MenuPresentersetCallback in interface MenuPresentercb - Callback that will be notified of future eventspublic boolean onSubMenuSelected(SubMenuBuilder subMenu)
MenuPresenteronSubMenuSelected in interface MenuPresentersubMenu - SubMenu being openedpublic 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 boolean flagActionItems()
MenuPresenterflagActionItems in interface MenuPresenterpublic boolean expandItemActionView(MenuBuilder menu, MenuItemImpl item)
MenuPresenterexpandItemActionView in interface MenuPresentermenu - Menu containing the item to be expandeditem - Item to be expandedpublic boolean collapseItemActionView(MenuBuilder menu, MenuItemImpl item)
MenuPresentercollapseItemActionView in interface MenuPresentermenu - Menu containing the item to be collapseditem - Item to be collapsedpublic int getId()
MenuPresentergetId in interface MenuPresenterpublic android.os.Parcelable onSaveInstanceState()
MenuPresenterMenuPresenter.onRestoreInstanceState(Parcelable)
 method of the presenter sharing the same ID later.onSaveInstanceState in interface MenuPresenterpublic void onRestoreInstanceState(android.os.Parcelable state)
MenuPresenteronRestoreInstanceState in interface MenuPresenterstate - The previously saved instance stateCopyright © 2011–2014. All rights reserved.