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
@Internal
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
ConstructorsConstructorDescriptionStandardMenuPopup(Context context, MenuBuilder menu, View anchorView, ResourceId popupStyleAttr, ResourceId popupStyleRes, boolean overflowOnly) -
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 this popup window is 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 gravity) 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.widget.AdapterView.OnItemClickListener
onItemClickMethods 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:
setForceShowIconin classMenuPopup
-
setGravity
public void setGravity(int gravity) - Specified by:
setGravityin classMenuPopup
-
show
public void show()- Specified by:
showin interfaceShowableListMenu
-
dismiss
public void dismiss()- Specified by:
dismissin interfaceShowableListMenu
-
isShowing
public boolean isShowing()- Specified by:
isShowingin interfaceShowableListMenu
-
onDismiss
public void onDismiss()Description copied from interface:PopupWindow.OnDismissListenerCalled when this popup window is 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.
-
setAnchorView
- Specified by:
setAnchorViewin classMenuPopup
-
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.
-
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
-