public MenuItem setActionProvider(ActionProvider actionProvider) { mActionView = null; mActionProvider = actionProvider; mMenu.onItemsChanged(true); // Measurement can be changed return this; }
/** * Called by {@link MenuItemImpl} when its visible flag is changed. * @param item The item that has gone through a visibility change. */ void onItemVisibleChanged(MenuItemImpl item) { // Notify of items being changed mIsVisibleItemsStale = true; onItemsChanged(true); }
/** * Called by {@link MenuItemImpl} when its action request status is changed. * @param item The item that has gone through a change in action request status. */ void onItemActionRequestChanged(MenuItemImpl item) { // Notify of items being changed mIsActionItemsStale = true; onItemsChanged(true); }
public void clearHeader() { mHeaderIcon = null; mHeaderTitle = null; mHeaderView = null; onItemsChanged(false); }
public MenuItem setNumericShortcut(char numericChar) { if (mShortcutNumericChar == numericChar) return this; mShortcutNumericChar = numericChar; mMenu.onItemsChanged(false); return this; }
public MenuItem setTitleCondensed(CharSequence title) { mTitleCondensed = title; // Could use getTitle() in the loop below, but just cache what it would do here if (title == null) { title = mTitle; } mMenu.onItemsChanged(false); return this; }
public MenuItem setActionProvider(ActionProvider actionProvider) { mActionView = null; mActionProvider = actionProvider; mMenu.onItemsChanged(true); // Measurement can be changed return this; }
public MenuItem setEnabled(boolean enabled) { if (enabled) { mFlags |= ENABLED; } else { mFlags &= ~ENABLED; } mMenu.onItemsChanged(false); return this; }
public MenuItem setIcon(Drawable icon) { mIconResId = NO_ICON; mIconDrawable = icon; mMenu.onItemsChanged(false); return this; }
public void setQwertyMode(boolean isQwerty) { mQwertyMode = isQwerty; onItemsChanged(false); }
/** * Called by {@link MenuItemImpl} when its visible flag is changed. * @param item The item that has gone through a visibility change. */ void onItemVisibleChanged(MenuItemImpl item) { // Notify of items being changed mIsVisibleItemsStale = true; onItemsChanged(true); }
public MenuItem setEnabled(boolean enabled) { if (enabled) { mFlags |= ENABLED; } else { mFlags &= ~ENABLED; } mMenu.onItemsChanged(false); return this; }
public MenuItem setIcon(Drawable icon) { mIconResId = NO_ICON; mIconDrawable = icon; mMenu.onItemsChanged(false); return this; }
public MenuItem setCheckable(boolean checkable) { final int oldFlags = mFlags; mFlags = (mFlags & ~CHECKABLE) | (checkable ? CHECKABLE : 0); if (oldFlags != mFlags) { mMenu.onItemsChanged(false); } return this; }
public MenuItem setShortcut(char numericChar, char alphaChar) { mShortcutNumericChar = numericChar; mShortcutAlphabeticChar = Character.toLowerCase(alphaChar); mMenu.onItemsChanged(false); return this; }
public MenuItem setAlphabeticShortcut(char alphaChar) { if (mShortcutAlphabeticChar == alphaChar) return this; mShortcutAlphabeticChar = Character.toLowerCase(alphaChar); mMenu.onItemsChanged(false); return this; }
/** * Sets whether the shortcuts should be visible on menus. Devices without hardware * key input will never make shortcuts visible even if this method is passed 'true'. * * @param shortcutsVisible Whether shortcuts should be visible (if true and a * menu item does not have a shortcut defined, that item will * still NOT show a shortcut) */ public void setShortcutsVisible(boolean shortcutsVisible) { if (mShortcutsVisible == shortcutsVisible) return; setShortcutsVisibleInner(shortcutsVisible); onItemsChanged(false); }
public MenuItem setTitle(CharSequence title) { mTitle = title; mMenu.onItemsChanged(false); if (mSubMenu != null) { mSubMenu.setHeaderTitle(title); } return this; }
public void setGroupVisible(int group, boolean visible) { final int N = mItems.size(); // We handle the notification of items being changed ourselves, so we use setVisibleInt rather // than setVisible and at the end notify of items being changed boolean changedAtLeastOneItem = false; for (int i = 0; i < N; i++) { MenuItemImpl item = mItems.get(i); if (item.getGroupId() == group) { if (item.setVisibleInt(visible)) changedAtLeastOneItem = true; } } if (changedAtLeastOneItem) onItemsChanged(true); }
public void clearAll() { mPreventDispatchingItemsChanged = true; clear(); clearHeader(); mPreventDispatchingItemsChanged = false; mItemsChangedWhileDispatchPrevented = false; onItemsChanged(true); }