Package icyllis.modernui.view.menu

# Interface MenuView.ItemView

All Known Implementing Classes:
  `ListMenuItemView`

Enclosing interface:
  `MenuView`

public static interface MenuView.ItemView
Minimal interface for a menu item view. `initialize(MenuItemImpl, int)` must be called for the item to be functional.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `MenuItemImpl`
  `getItemData()`
  Gets the item data that this view is displaying.
  `void`
  `initialize(MenuItemImpl itemData, int menuType)`
  Initializes with the provided MenuItemData.
  `boolean`
  `prefersCondensedTitle()`
  Whether this item view prefers displaying the condensed title rather than the normal title.
  `void`
  `setCheckable(boolean checkable)`
  Displays the checkbox for the item view.
  `void`
  `setChecked(boolean checked)`
  Checks the checkbox for the item view.
  `void`
  `setEnabled(boolean enabled)`
  Sets the enabled state of the item view.
  `void`
  `setIcon(Drawable icon)`
  Set the icon of this item view.
  `void`
  `setShortcut(boolean showShortcut, char shortcutKey)`
  Sets the shortcut for the item.
  `void`
  `setTitle(CharSequence title)`
  Sets the title of the item view.
  `boolean`
  `showsIcon()`
  Whether this item view shows an icon.

- ## Method Details

  - ### initialize

    void initialize(@NonNull MenuItemImpl itemData, int menuType)
    Initializes with the provided MenuItemData. This should be called after the view is inflated.
    Parameters:
      `itemData` - The item that this ItemView should display.
      `menuType` - The type of this menu, one of
      invalid reference

          MenuBuilder#TYPE_ICON

      ,
      invalid reference

          MenuBuilder#TYPE_EXPANDED

      ,
      invalid reference

          MenuBuilder#TYPE_DIALOG

      ).

  - ### getItemData

    MenuItemImpl getItemData()
    Gets the item data that this view is displaying.
    Returns:
      the item data, or null if there is not one

  - ### setTitle

    void setTitle(CharSequence title)
    Sets the title of the item view.
    Parameters:
      `title` - The title to set.

  - ### setEnabled

    void setEnabled(boolean enabled)
    Sets the enabled state of the item view.
    Parameters:
      `enabled` - Whether the item view should be enabled.

  - ### setCheckable

    void setCheckable(boolean checkable)
    Displays the checkbox for the item view. This does not ensure the item view will be checked, for that use `setChecked(boolean)`.
    Parameters:
      `checkable` - Whether to display the checkbox or to hide it

  - ### setChecked

    void setChecked(boolean checked)
    Checks the checkbox for the item view. If the checkbox is hidden, it will NOT be made visible, call `setCheckable(boolean)` for that.
    Parameters:
      `checked` - Whether the checkbox should be checked

  - ### setShortcut

    void setShortcut(boolean showShortcut, char shortcutKey)
    Sets the shortcut for the item.
    Parameters:
      `showShortcut` - Whether a shortcut should be shown(if false, the value of shortcutKey should be ignored).
      `shortcutKey` - The shortcut key that should be shown on the ItemView.

  - ### setIcon

    void setIcon(Drawable icon)
    Set the icon of this item view.
    Parameters:
      `icon` - The icon of this item. null to hide the icon.

  - ### prefersCondensedTitle

    boolean prefersCondensedTitle()
    Whether this item view prefers displaying the condensed title rather than the normal title. If a condensed title is not available, the normal title will be used.
    Returns:
      Whether this item view prefers displaying the condensed title.

  - ### showsIcon

    boolean showsIcon()
    Whether this item view shows an icon.
    Returns:
      Whether this item view shows an icon.