FileDocCategorySizeDatePackage
ActionMenuItem.javaAPI DocAndroid 5.1 API7045Thu Mar 12 22:22:10 GMT 2015com.android.internal.view.menu

ActionMenuItem

public class ActionMenuItem extends Object implements android.view.MenuItem
hide

Fields Summary
private final int
mId
private final int
mGroup
private final int
mCategoryOrder
private final int
mOrdering
private CharSequence
mTitle
private CharSequence
mTitleCondensed
private android.content.Intent
mIntent
private char
mShortcutNumericChar
private char
mShortcutAlphabeticChar
private android.graphics.drawable.Drawable
mIconDrawable
private int
mIconResId
private android.content.Context
mContext
private MenuItem.OnMenuItemClickListener
mClickListener
private static final int
NO_ICON
private int
mFlags
private static final int
CHECKABLE
private static final int
CHECKED
private static final int
EXCLUSIVE
private static final int
HIDDEN
private static final int
ENABLED
Constructors Summary
public ActionMenuItem(android.content.Context context, int group, int id, int categoryOrder, int ordering, CharSequence title)

    
              
              
        mContext = context;
        mId = id;
        mGroup = group;
        mCategoryOrder = categoryOrder;
        mOrdering = ordering;
        mTitle = title;
    
Methods Summary
public booleancollapseActionView()

        return false;
    
public booleanexpandActionView()

        return false;
    
public android.view.ActionProvidergetActionProvider()

        return null;
    
public android.view.ViewgetActionView()

        return null;
    
public chargetAlphabeticShortcut()

        return mShortcutAlphabeticChar;
    
public intgetGroupId()

        return mGroup;
    
public android.graphics.drawable.DrawablegetIcon()

        return mIconDrawable;
    
public android.content.IntentgetIntent()

        return mIntent;
    
public intgetItemId()

        return mId;
    
public android.view.ContextMenu.ContextMenuInfogetMenuInfo()

        return null;
    
public chargetNumericShortcut()

        return mShortcutNumericChar;
    
public intgetOrder()

        return mOrdering;
    
public android.view.SubMenugetSubMenu()

        return null;
    
public java.lang.CharSequencegetTitle()

        return mTitle;
    
public java.lang.CharSequencegetTitleCondensed()

        return mTitleCondensed != null ? mTitleCondensed : mTitle;
    
public booleanhasSubMenu()

        return false;
    
public booleaninvoke()

        if (mClickListener != null && mClickListener.onMenuItemClick(this)) {
            return true;
        }
        
        if (mIntent != null) {
            mContext.startActivity(mIntent);
            return true;
        }
        
        return false;
    
public booleanisActionViewExpanded()

        return false;
    
public booleanisCheckable()

        return (mFlags & CHECKABLE) != 0; 
    
public booleanisChecked()

        return (mFlags & CHECKED) != 0;
    
public booleanisEnabled()

        return (mFlags & ENABLED) != 0;
    
public booleanisVisible()

        return (mFlags & HIDDEN) == 0;
    
public android.view.MenuItemsetActionProvider(android.view.ActionProvider actionProvider)

        throw new UnsupportedOperationException();
    
public android.view.MenuItemsetActionView(android.view.View actionView)

        throw new UnsupportedOperationException();
    
public android.view.MenuItemsetActionView(int resId)

        throw new UnsupportedOperationException();
    
public android.view.MenuItemsetAlphabeticShortcut(char alphaChar)

        mShortcutAlphabeticChar = alphaChar;
        return this;
    
public android.view.MenuItemsetCheckable(boolean checkable)

        mFlags = (mFlags & ~CHECKABLE) | (checkable ? CHECKABLE : 0);
        return this;
    
public android.view.MenuItemsetChecked(boolean checked)

        mFlags = (mFlags & ~CHECKED) | (checked ? CHECKED : 0);
        return this;
    
public android.view.MenuItemsetEnabled(boolean enabled)

        mFlags = (mFlags & ~ENABLED) | (enabled ? ENABLED : 0);
        return this;
    
public com.android.internal.view.menu.ActionMenuItemsetExclusiveCheckable(boolean exclusive)

        mFlags = (mFlags & ~EXCLUSIVE) | (exclusive ? EXCLUSIVE : 0);
        return this;
    
public android.view.MenuItemsetIcon(android.graphics.drawable.Drawable icon)

        mIconDrawable = icon;
        mIconResId = NO_ICON;
        return this;
    
public android.view.MenuItemsetIcon(int iconRes)

        mIconResId = iconRes;
        mIconDrawable = mContext.getDrawable(iconRes);
        return this;
    
public android.view.MenuItemsetIntent(android.content.Intent intent)

        mIntent = intent;
        return this;
    
public android.view.MenuItemsetNumericShortcut(char numericChar)

        mShortcutNumericChar = numericChar;
        return this;
    
public android.view.MenuItemsetOnActionExpandListener(OnActionExpandListener listener)

        // No need to save the listener; ActionMenuItem does not support collapsing items.
        return this;
    
public android.view.MenuItemsetOnMenuItemClickListener(OnMenuItemClickListener menuItemClickListener)

        mClickListener = menuItemClickListener;
        return this;
    
public android.view.MenuItemsetShortcut(char numericChar, char alphaChar)

        mShortcutNumericChar = numericChar;
        mShortcutAlphabeticChar = alphaChar;
        return this;
    
public voidsetShowAsAction(int show)

        // Do nothing. ActionMenuItems always show as action buttons.
    
public android.view.MenuItemsetShowAsActionFlags(int actionEnum)

        setShowAsAction(actionEnum);
        return this;
    
public android.view.MenuItemsetTitle(java.lang.CharSequence title)

        mTitle = title;
        return this;
    
public android.view.MenuItemsetTitle(int title)

        mTitle = mContext.getResources().getString(title);
        return this;
    
public android.view.MenuItemsetTitleCondensed(java.lang.CharSequence title)

        mTitleCondensed = title;
        return this;
    
public android.view.MenuItemsetVisible(boolean visible)

        mFlags = (mFlags & HIDDEN) | (visible ? 0 : HIDDEN);
        return this;