Package icyllis.modernui.view.menu

# Class SubMenuBuilder

java.lang.Object
icyllis.modernui.view.menu.MenuBuilder
icyllis.modernui.view.menu.SubMenuBuilder

All Implemented Interfaces:
  `Menu`, `SubMenu`

public class SubMenuBuilder extends MenuBuilder implements SubMenu
The model for a sub menu, which is an extension of the menu. Most methods are proxied to the parent menu.

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from class icyllis.modernui.view.menu.MenuBuilder

  `MenuBuilder.Callback, MenuBuilder.ItemInvoker`

- ## 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
  Constructor
  Description
  `SubMenuBuilder(Context context, MenuBuilder parentMenu, MenuItemImpl item)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `collapseItemActionView(MenuItemImpl item)`
  `boolean`
  `expandItemActionView(MenuItemImpl item)`
  `MenuItem`
  `getItem()`
  Gets the `MenuItem` that represents this submenu in the parent menu.
  `Menu`
  `getParentMenu()`
  `MenuBuilder`
  `getRootMenu()`
  Gets the root menu (if this is a submenu, find its root menu).
  `boolean`
  `isGroupDividerEnabled()`
  `boolean`
  `isQwertyMode()`
  `boolean`
  `isShortcutsVisible()`
  `void`
  `setCallback(MenuBuilder.Callback callback)`
  `void`
  `setGroupDividerEnabled(boolean groupDividerEnabled)`
  Enable or disable the group dividers.
  `SubMenu`
  `setHeaderIcon(Drawable icon)`
  Sets the submenu header's icon to the icon given in icon `Drawable`.
  `SubMenu`
  `setHeaderTitle(CharSequence title)`
  Sets the submenu header's title to the title given in title.
  `SubMenu`
  `setHeaderView(View view)`
  Sets the header of the submenu to the `View` given in view.
  `SubMenu`
  `setIcon(Drawable icon)`
  Change the icon associated with this submenu's item in its parent menu.
  `void`
  `setQwertyMode(boolean isQwerty)`
  Control whether the menu should be running in qwerty mode (alphabetic shortcuts) or 12-key mode (numeric shortcuts).
  `void`
  `setShortcutsVisible(boolean shortcutsVisible)`
  Sets whether the shortcuts should be visible on menus.

  ### Methods inherited from class icyllis.modernui.view.menu.MenuBuilder

  `add, add, addMenuPresenter, addMenuPresenter, addSubMenu, addSubMenu, changeMenuMode, clear, clearAll, clearHeader, close, close, findGroupIndex, findGroupIndex, findItem, findItemIndex, flagActionItems, getActionItems, getContext, getExpandedItem, getHeaderIcon, getHeaderTitle, getHeaderView, getItem, getNonActionItems, getVisibleItems, hasVisibleItems, isShortcutKey, onItemsChanged, performIdentifierAction, performItemAction, performItemAction, performShortcut, removeGroup, removeItem, removeItemAt, removeMenuPresenter, setCurrentMenuInfo, setDefaultShowAsAction, setGroupCheckable, setGroupEnabled, setGroupVisible, setHeaderIconInt, setHeaderTitleInt, setHeaderViewInt, setOptionalIconsVisible, size, startDispatchingItemsChanged, stopDispatchingItemsChanged`

  ### 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

  `add, add, addSubMenu, addSubMenu, clear, close, findItem, getItem, hasVisibleItems, isShortcutKey, performIdentifierAction, performShortcut, removeGroup, removeItem, setGroupCheckable, setGroupEnabled, setGroupVisible, size`

  ### Methods inherited from interface icyllis.modernui.view.SubMenu

  `clearHeader`

- ## Constructor Details

  - ### SubMenuBuilder

    public SubMenuBuilder(Context context, MenuBuilder parentMenu, MenuItemImpl item)

- ## Method Details

  - ### setQwertyMode

    public void setQwertyMode(boolean isQwerty)
    Description copied from interface: `Menu`
    Control whether the menu should be running in qwerty mode (alphabetic shortcuts) or 12-key mode (numeric shortcuts).
    Specified by:
      `setQwertyMode` in interface `Menu`
    Overrides:
      `setQwertyMode` in class `MenuBuilder`
    Parameters:
      `isQwerty` - If true the menu will use alphabetic shortcuts; else it will use numeric shortcuts.

  - ### isQwertyMode

    public boolean isQwertyMode()

  - ### setShortcutsVisible

    public void setShortcutsVisible(boolean shortcutsVisible)
    Description copied from class: `MenuBuilder`
    Sets whether the shortcuts should be visible on menus. Devices without hardware key input will never make shortcuts visible even if this method is passed 'true'.
    Overrides:
      `setShortcutsVisible` in class `MenuBuilder`
    Parameters:
      `shortcutsVisible` - Whether shortcuts should be visible (if true and a menu item does not have a shortcut defined, that item will still NOT show a shortcut)

  - ### isShortcutsVisible

    public boolean isShortcutsVisible()
    Overrides:
      `isShortcutsVisible` in class `MenuBuilder`
    Returns:
      Whether shortcuts should be visible on menus.

  - ### getParentMenu

    public Menu getParentMenu()

  - ### getItem

    @NonNull public MenuItem getItem()
    Description copied from interface: `SubMenu`
    Gets the `MenuItem` that represents this submenu in the parent menu. Use this for setting additional item attributes.
    Specified by:
      `getItem` in interface `SubMenu`
    Returns:
      The `MenuItem` that launches the submenu when invoked.

  - ### setCallback

    public void setCallback(MenuBuilder.Callback callback)
    Overrides:
      `setCallback` in class `MenuBuilder`

  - ### getRootMenu

    public MenuBuilder getRootMenu()
    Description copied from class: `MenuBuilder`
    Gets the root menu (if this is a submenu, find its root menu).
    Overrides:
      `getRootMenu` in class `MenuBuilder`
    Returns:
      The root menu.

  - ### setIcon

    @NonNull public SubMenu setIcon(Drawable icon)
    Description copied from interface: `SubMenu`
    Change the icon associated with this submenu's item in its parent menu.
    Specified by:
      `setIcon` in interface `SubMenu`
    Parameters:
      `icon` - The new icon (as a Drawable) to be displayed.
    Returns:
      This SubMenu so additional setters can be called.
    See Also:
      - `MenuItem.setIcon(Drawable)`

  - ### setHeaderIcon

    @NonNull public SubMenu setHeaderIcon(Drawable icon)
    Description copied from interface: `SubMenu`
    Sets the submenu header's icon to the icon given in icon `Drawable`.
    Specified by:
      `setHeaderIcon` in interface `SubMenu`
    Parameters:
      `icon` - The `Drawable` used for the icon.
    Returns:
      This SubMenu so additional setters can be called.

  - ### setHeaderTitle

    @NonNull public SubMenu setHeaderTitle(CharSequence title)
    Description copied from interface: `SubMenu`
    Sets the submenu header's title to the title given in title.
    Specified by:
      `setHeaderTitle` in interface `SubMenu`
    Parameters:
      `title` - The character sequence used for the title.
    Returns:
      This SubMenu so additional setters can be called.

  - ### setHeaderView

    @NonNull public SubMenu setHeaderView(View view)
    Description copied from interface: `SubMenu`
    Sets the header of the submenu to the `View` given in view. This replaces the header title and icon (and those replace this).
    Specified by:
      `setHeaderView` in interface `SubMenu`
    Parameters:
      `view` - The `View` used for the header.
    Returns:
      This SubMenu so additional setters can be called.

  - ### expandItemActionView

    public boolean expandItemActionView(MenuItemImpl item)
    Overrides:
      `expandItemActionView` in class `MenuBuilder`

  - ### collapseItemActionView

    public boolean collapseItemActionView(MenuItemImpl item)
    Overrides:
      `collapseItemActionView` in class `MenuBuilder`

  - ### setGroupDividerEnabled

    public void setGroupDividerEnabled(boolean groupDividerEnabled)
    Description copied from interface: `Menu`
    Enable or disable the group dividers.
    Specified by:
      `setGroupDividerEnabled` in interface `Menu`
    Overrides:
      `setGroupDividerEnabled` in class `MenuBuilder`

  - ### isGroupDividerEnabled

    public boolean isGroupDividerEnabled()
    Overrides:
      `isGroupDividerEnabled` in class `MenuBuilder`