public void setShortcut(boolean showShortcut, char shortcutKey) { final int newVisibility = (showShortcut && mItemData.shouldShowShortcut()) ? VISIBLE : GONE; if (newVisibility == VISIBLE) { mShortcutView.setText(mItemData.getShortcutLabel()); } if (mShortcutView.getVisibility() != newVisibility) { mShortcutView.setVisibility(newVisibility); } }