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 TypeMethodDescriptionGets the item data that this view is displaying.void
initialize
(MenuItemImpl itemData, int menuType) Initializes with the provided MenuItemData.boolean
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
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
Whether this item view shows an icon.
-
Method Details
-
getItemData
MenuItemImpl getItemData()Gets the item data that this view is displaying.- Returns:
- the item data, or null if there is not one
-
setTitle
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 usesetChecked(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, callsetCheckable(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
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.