Package icyllis.modernui.view.menu
Class ContextMenuBuilder
java.lang.Object
icyllis.modernui.view.menu.MenuBuilder
icyllis.modernui.view.menu.ContextMenuBuilder
- All Implemented Interfaces:
ContextMenu,Menu
Implementation of the
ContextMenu interface.
Most clients of the menu framework will never need to touch this class. However, if the client has a window that is not a content view of a Dialog or Activity (for example, the view was added directly to the window manager) and needs to show context menus, it will use this class.
To use this class, instantiate it via ContextMenuBuilder(Context),
and optionally populate it with any of your custom items. Finally,
call showPopup(Context, View, float, float) which will populate the menu
with a view's context menu items and show the context menu.
-
Nested Class Summary
Nested classes/interfaces inherited from class icyllis.modernui.view.menu.MenuBuilder
MenuBuilder.Callback, MenuBuilder.ItemInvokerNested classes/interfaces inherited from interface icyllis.modernui.view.ContextMenu
ContextMenu.ContextMenuInfo -
Field Summary
Fields inherited from interface icyllis.modernui.view.Menu
CATEGORY_ALTERNATIVE, CATEGORY_CONTAINER, CATEGORY_MASK, CATEGORY_SECONDARY, CATEGORY_SHIFT, CATEGORY_SYSTEM, FIRST, FLAG_ALWAYS_PERFORM_CLOSE, FLAG_PERFORM_NO_CLOSE, NONE, SUPPORTED_MODIFIERS_MASK, USER_MASK, USER_SHIFT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionsetHeaderIcon(Drawable icon) Sets the context menu header's icon to the icon given in iconDrawable.setHeaderTitle(CharSequence title) Sets the context menu header's title to the title given in title.setHeaderView(View view) Sets the header of the context menu to theViewgiven in view.Methods inherited from class icyllis.modernui.view.menu.MenuBuilder
add, add, addMenuPresenter, addMenuPresenter, addSubMenu, addSubMenu, changeMenuMode, clear, clearAll, clearHeader, close, close, collapseItemActionView, expandItemActionView, findGroupIndex, findGroupIndex, findItem, findItemIndex, flagActionItems, getActionItems, getContext, getExpandedItem, getHeaderIcon, getHeaderTitle, getHeaderView, getItem, getNonActionItems, getRootMenu, getVisibleItems, hasVisibleItems, isGroupDividerEnabled, isShortcutKey, isShortcutsVisible, onItemsChanged, performIdentifierAction, performItemAction, performItemAction, performShortcut, removeGroup, removeItem, removeItemAt, removeMenuPresenter, setCallback, setCurrentMenuInfo, setDefaultShowAsAction, setGroupCheckable, setGroupDividerEnabled, setGroupEnabled, setGroupVisible, setHeaderIconInt, setHeaderTitleInt, setHeaderViewInt, setOptionalIconsVisible, setQwertyMode, setShortcutsVisible, size, startDispatchingItemsChanged, stopDispatchingItemsChangedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface icyllis.modernui.view.ContextMenu
clearHeaderMethods inherited from interface icyllis.modernui.view.Menu
add, add, addSubMenu, addSubMenu, clear, close, findItem, getItem, hasVisibleItems, isShortcutKey, performIdentifierAction, performShortcut, removeGroup, removeItem, setGroupCheckable, setGroupDividerEnabled, setGroupEnabled, setGroupVisible, setOptionalIconsVisible, setQwertyMode, size
-
Constructor Details
-
ContextMenuBuilder
-
-
Method Details
-
setHeaderIcon
Description copied from interface:ContextMenuSets the context menu header's icon to the icon given in iconDrawable.- Specified by:
setHeaderIconin interfaceContextMenu- Parameters:
icon- TheDrawableused for the icon.- Returns:
- This ContextMenu so additional setters can be called.
-
setHeaderTitle
Description copied from interface:ContextMenuSets the context menu header's title to the title given in title.- Specified by:
setHeaderTitlein interfaceContextMenu- Parameters:
title- The character sequence used for the title.- Returns:
- This ContextMenu so additional setters can be called.
-
setHeaderView
Description copied from interface:ContextMenuSets the header of the context menu to theViewgiven in view. This replaces the header title and icon (and those replace this).- Specified by:
setHeaderViewin interfaceContextMenu- Parameters:
view- TheViewused for the header.- Returns:
- This ContextMenu so additional setters can be called.
-
showPopup
-