Package icyllis.modernui.view.menu
Class StandardMenuPopup
java.lang.Object
icyllis.modernui.view.menu.MenuPopup
icyllis.modernui.view.menu.StandardMenuPopup
- All Implemented Interfaces:
MenuPresenter
,ShowableListMenu
,View.OnKeyListener
,AdapterView.OnItemClickListener
,PopupWindow.OnDismissListener
public final class StandardMenuPopup
extends MenuPopup
implements PopupWindow.OnDismissListener, AdapterView.OnItemClickListener, MenuPresenter, View.OnKeyListener
A standard menu popup in which when a submenu is opened, it replaces its parent menu in the
viewport.
-
Nested Class Summary
Nested classes/interfaces inherited from interface icyllis.modernui.view.menu.MenuPresenter
MenuPresenter.Callback
-
Constructor Summary
ConstructorDescriptionStandardMenuPopup
(Context context, MenuBuilder menu, View anchorView, boolean overflowOnly) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addMenu
(MenuBuilder menu) Adds the given menu to the popup, if it is capable of displaying submenus within itself.void
dismiss()
boolean
Called by Menu implementations to flag items that will be shown as actions.boolean
void
onCloseMenu
(MenuBuilder menu, boolean allMenusAreClosing) Called by Menu implementations to indicate that a menu or submenu is closing.void
Called when this popup window is dismissed.boolean
Called when a hardware key is dispatched to a view.boolean
onSubMenuSelected
(SubMenuBuilder subMenu) Called by Menu implementations to indicate that a submenu item has been selected.void
setAnchorView
(View anchor) void
Set a callback object that will be notified of menu events related to this specific presentation.void
setForceShowIcon
(boolean forceShow) void
setGravity
(int gravity) void
setHorizontalOffset
(int x) void
Set a listener to receive a callback when the popup is dismissed.void
setShowTitle
(boolean showTitle) Set whether a title entry should be shown in the popup menu (if a title exists for the menu).void
setVerticalOffset
(int y) void
show()
void
updateMenuView
(boolean cleared) Update the menu UI in response to a change.Methods inherited from class icyllis.modernui.view.menu.MenuPopup
collapseItemActionView, expandItemActionView, getEpicenterBounds, getId, getMenuView, initForMenu, measureIndividualMenuWidth, onItemClick, setEpicenterBounds, shouldPreserveIconSpacing, toMenuAdapter
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface icyllis.modernui.widget.AdapterView.OnItemClickListener
onItemClick
Methods inherited from interface icyllis.modernui.view.menu.MenuPresenter
collapseItemActionView, expandItemActionView, getId, getMenuView, initForMenu
-
Constructor Details
-
Method Details
-
setForceShowIcon
public void setForceShowIcon(boolean forceShow) - Specified by:
setForceShowIcon
in classMenuPopup
-
setGravity
public void setGravity(int gravity) - Specified by:
setGravity
in classMenuPopup
-
show
public void show()- Specified by:
show
in interfaceShowableListMenu
-
dismiss
public void dismiss()- Specified by:
dismiss
in interfaceShowableListMenu
-
isShowing
public boolean isShowing()- Specified by:
isShowing
in interfaceShowableListMenu
-
onDismiss
public void onDismiss()Description copied from interface:PopupWindow.OnDismissListener
Called when this popup window is dismissed.- Specified by:
onDismiss
in interfacePopupWindow.OnDismissListener
-
updateMenuView
public void updateMenuView(boolean cleared) Description copied from interface:MenuPresenter
Update the menu UI in response to a change. Called by MenuBuilder during the normal course of operation.- Specified by:
updateMenuView
in interfaceMenuPresenter
- Parameters:
cleared
- true if the menu was entirely cleared
-
flagActionItems
public boolean flagActionItems()Description copied from interface:MenuPresenter
Called by Menu implementations to flag items that will be shown as actions.- Specified by:
flagActionItems
in interfaceMenuPresenter
- Returns:
- true if this presenter changed the action status of any items.
-
setAnchorView
- Specified by:
setAnchorView
in classMenuPopup
-
onKey
Description copied from interface:View.OnKeyListener
Called when a hardware key is dispatched to a view. This allows listeners to get a chance to respond before the target view.Key presses in software keyboards will generally NOT trigger this method, although some may elect to do so in some situations. Do not assume a software input method has to be key-based; even if it is, it may use key presses in a different way than you expect, so there is no way to reliably catch soft input key presses.
- Specified by:
onKey
in interfaceView.OnKeyListener
- Parameters:
v
- The view the key has been dispatched to.keyCode
- The code for the physical key that was pressedevent
- The KeyEvent object containing full information about the event.- Returns:
- True if the listener has consumed the event, false otherwise.
-
setOnDismissListener
Description copied from class:MenuPopup
Set a listener to receive a callback when the popup is dismissed.- Specified by:
setOnDismissListener
in classMenuPopup
- Parameters:
listener
- Listener that will be notified when the popup is dismissed.
-
getListView
- Specified by:
getListView
in interfaceShowableListMenu
- Returns:
- The internal ListView for the visible menu.
-
setHorizontalOffset
public void setHorizontalOffset(int x) - Specified by:
setHorizontalOffset
in classMenuPopup
-
setVerticalOffset
public void setVerticalOffset(int y) - Specified by:
setVerticalOffset
in classMenuPopup
-
setShowTitle
public void setShowTitle(boolean showTitle) Description copied from class:MenuPopup
Set whether a title entry should be shown in the popup menu (if a title exists for the menu).- Specified by:
setShowTitle
in classMenuPopup
- Parameters:
showTitle
- show title
-