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.
  • Constructor Details

  • 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:
    • 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