Package icyllis.modernui.view.menu
Class CascadingMenuPopup
java.lang.Object
icyllis.modernui.view.menu.MenuPopup
icyllis.modernui.view.menu.CascadingMenuPopup
- All Implemented Interfaces:
MenuPresenter
,ShowableListMenu
,View.OnKeyListener
,AdapterView.OnItemClickListener
,PopupWindow.OnDismissListener
public final class CascadingMenuPopup
extends MenuPopup
implements MenuPresenter, View.OnKeyListener, PopupWindow.OnDismissListener
A popup for a menu which will allow multiple submenus to appear in a cascading fashion, side by
side.
-
Nested Class Summary
Nested classes/interfaces inherited from interface icyllis.modernui.view.menu.MenuPresenter
MenuPresenter.Callback
-
Constructor Summary
ConstructorDescriptionCascadingMenuPopup
(Context context, View anchorView, boolean overflowOnly) Initializes a new cascading-capable menu popup. -
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 one or more of the popup windows was 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 dropDownGravity) 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.view.menu.MenuPresenter
collapseItemActionView, expandItemActionView, getId, getMenuView, initForMenu
-
Constructor Details
-
CascadingMenuPopup
Initializes a new cascading-capable menu popup.
-
-
Method Details
-
setForceShowIcon
public void setForceShowIcon(boolean forceShow) - Specified by:
setForceShowIcon
in classMenuPopup
-
show
public void show()- Specified by:
show
in interfaceShowableListMenu
-
dismiss
public void dismiss()- Specified by:
dismiss
in interfaceShowableListMenu
-
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.
-
isShowing
public boolean isShowing()- Specified by:
isShowing
in interfaceShowableListMenu
- Returns:
true
if the popup is currently showing,false
otherwise.
-
onDismiss
public void onDismiss()Called when one or more of the popup windows was 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.
-
setGravity
public void setGravity(int dropDownGravity) - Specified by:
setGravity
in classMenuPopup
-
setAnchorView
- Specified by:
setAnchorView
in classMenuPopup
-
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
-