@Override public void initialize(MenuItemImpl itemData, int menuType) { mItemData = itemData; 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()); }
@Override public void setShortcut(boolean showShortcut, char shortcutKey) { final int newVisibility = showShortcut && mItemData.shouldShowShortcut() ? View.VISIBLE : View.GONE; if (newVisibility == View.VISIBLE) { mShortcutView.setText(mItemData.getShortcutLabel()); } if (mShortcutView.getVisibility() != newVisibility) { mShortcutView.setVisibility(newVisibility); } }