/** * @return Whether this menu item should be showing shortcuts (depends on * whether the menu should show shortcuts and whether this item has * a shortcut defined) */ boolean shouldShowShortcut() { // Show shortcuts if the menu is supposed to show shortcuts AND this item has a shortcut return mMenu.isShortcutsVisible() && (getShortcut() != 0); }
/** * @return Whether this menu item should be showing shortcuts (depends on * whether the menu should show shortcuts and whether this item has * a shortcut defined) */ boolean shouldShowShortcut() { // Show shortcuts if the menu is supposed to show shortcuts AND this item has a shortcut return mMenu.isShortcutsVisible() && (getShortcut() != 0); }
/** * @return The label to show for the shortcut. This includes the chording * key (for example 'Menu+a'). Also, any non-human readable * characters should be human readable (for example 'Menu+enter'). */ String getShortcutLabel() { char shortcut = getShortcut(); if (shortcut == 0) { return ""; } StringBuilder sb = new StringBuilder(sPrependShortcutLabel); switch (shortcut) { case '\n': sb.append(sEnterShortcutLabel); break; case '\b': sb.append(sDeleteShortcutLabel); break; case ' ': sb.append(sSpaceShortcutLabel); break; default: sb.append(shortcut); break; } return sb.toString(); }
/** * @return The label to show for the shortcut. This includes the chording * key (for example 'Menu+a'). Also, any non-human readable * characters should be human readable (for example 'Menu+enter'). */ String getShortcutLabel() { char shortcut = getShortcut(); if (shortcut == 0) { return ""; } StringBuilder sb = new StringBuilder(sPrependShortcutLabel); switch (shortcut) { case '\n': sb.append(sEnterShortcutLabel); break; case '\b': sb.append(sDeleteShortcutLabel); break; case ' ': sb.append(sSpaceShortcutLabel); break; default: sb.append(shortcut); break; } return sb.toString(); }
public void initialize(MenuItemImpl itemData, int menuType) { mItemData = itemData; //UNUSED mMenuType = menuType; setVisibility(itemData.isVisible() ? View.VISIBLE : View.GONE); setTitle(itemData.getTitleForItemView(this)); setCheckable(itemData.isCheckable()); setShortcut(itemData.shouldShowShortcut(), itemData.getShortcut()); setIcon(itemData.getIcon()); setEnabled(itemData.isEnabled()); }
public void initialize(MenuItemImpl itemData, int menuType) { mItemData = itemData; //UNUSED mMenuType = menuType; setVisibility(itemData.isVisible() ? View.VISIBLE : View.GONE); setTitle(itemData.getTitleForItemView(this)); setCheckable(itemData.isCheckable()); setShortcut(itemData.shouldShowShortcut(), itemData.getShortcut()); setIcon(itemData.getIcon()); setEnabled(itemData.isEnabled()); }