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
@Internal
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 ClassesNested classes/interfaces inherited from interface icyllis.modernui.view.menu.MenuPresenter
MenuPresenter.Callback -
Constructor Summary
ConstructorsConstructorDescriptionCascadingMenuPopup(Context context, View anchorView, ResourceId popupStyleAttr, ResourceId popupStyleRes, boolean overflowOnly) Initializes a new cascading-capable menu popup. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMenu(MenuBuilder menu) Adds the given menu to the popup, if it is capable of displaying submenus within itself.voiddismiss()booleanCalled by Menu implementations to flag items that will be shown as actions.booleanvoidonCloseMenu(MenuBuilder menu, boolean allMenusAreClosing) Called by Menu implementations to indicate that a menu or submenu is closing.voidCalled when one or more of the popup windows was dismissed.booleanCalled when a hardware key is dispatched to a view.booleanonSubMenuSelected(SubMenuBuilder subMenu) Called by Menu implementations to indicate that a submenu item has been selected.voidsetAnchorView(View anchor) voidSet a callback object that will be notified of menu events related to this specific presentation.voidsetForceShowIcon(boolean forceShow) voidsetGravity(int dropDownGravity) voidsetHorizontalOffset(int x) voidSet a listener to receive a callback when the popup is dismissed.voidsetShowTitle(boolean showTitle) Set whether a title entry should be shown in the popup menu (if a title exists for the menu).voidsetVerticalOffset(int y) voidshow()voidupdateMenuView(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, toMenuAdapterMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface icyllis.modernui.view.menu.MenuPresenter
collapseItemActionView, expandItemActionView, getId, getMenuView, initForMenu
-
Constructor Details
-
CascadingMenuPopup
public CascadingMenuPopup(@NonNull Context context, @NonNull View anchorView, @AttrRes ResourceId popupStyleAttr, @StyleRes ResourceId popupStyleRes, boolean overflowOnly) Initializes a new cascading-capable menu popup.
-
-
Method Details
-
setForceShowIcon
public void setForceShowIcon(boolean forceShow) - Specified by:
setForceShowIconin classMenuPopup
-
show
public void show()- Specified by:
showin interfaceShowableListMenu
-
dismiss
public void dismiss()- Specified by:
dismissin interfaceShowableListMenu
-
onKey
Description copied from interface:View.OnKeyListenerCalled 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:
onKeyin 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:
isShowingin interfaceShowableListMenu- Returns:
trueif the popup is currently showing,falseotherwise.
-
onDismiss
public void onDismiss()Called when one or more of the popup windows was dismissed.- Specified by:
onDismissin interfacePopupWindow.OnDismissListener
-
updateMenuView
public void updateMenuView(boolean cleared) Description copied from interface:MenuPresenterUpdate the menu UI in response to a change. Called by MenuBuilder during the normal course of operation.- Specified by:
updateMenuViewin interfaceMenuPresenter- Parameters:
cleared- true if the menu was entirely cleared
-
flagActionItems
public boolean flagActionItems()Description copied from interface:MenuPresenterCalled by Menu implementations to flag items that will be shown as actions.- Specified by:
flagActionItemsin interfaceMenuPresenter- Returns:
- true if this presenter changed the action status of any items.
-
setGravity
public void setGravity(int dropDownGravity) - Specified by:
setGravityin classMenuPopup
-
setAnchorView
- Specified by:
setAnchorViewin classMenuPopup
-
setOnDismissListener
Description copied from class:MenuPopupSet a listener to receive a callback when the popup is dismissed.- Specified by:
setOnDismissListenerin classMenuPopup- Parameters:
listener- Listener that will be notified when the popup is dismissed.
-
getListView
- Specified by:
getListViewin interfaceShowableListMenu- Returns:
- The internal ListView for the visible menu.
-
setHorizontalOffset
public void setHorizontalOffset(int x) - Specified by:
setHorizontalOffsetin classMenuPopup
-
setVerticalOffset
public void setVerticalOffset(int y) - Specified by:
setVerticalOffsetin classMenuPopup
-
setShowTitle
public void setShowTitle(boolean showTitle) Description copied from class:MenuPopupSet whether a title entry should be shown in the popup menu (if a title exists for the menu).- Specified by:
setShowTitlein classMenuPopup- Parameters:
showTitle- show title
-