package sk.m217.actionbarcompat;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.util.Log;
import android.view.ActionProvider;
import android.view.ContextMenu;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.SubMenu;
import android.view.View;
public class implements MenuItemICS {
private static final String TAG = "SimpleMenuItem";
private static final int SHOW_AS_ACTION_MASK = SHOW_AS_ACTION_NEVER |
SHOW_AS_ACTION_IF_ROOM |
SHOW_AS_ACTION_ALWAYS;
private SimpleMenu mMenu;
private final int mId;
private final int mOrder;
private CharSequence mTitle;
private CharSequence mTitleCondensed;
private Intent mIntent;
private Drawable mIconDrawable;
private int mIconResId = NO_ICON;
private boolean mEnabled = true;
private int mShowAsAction = SHOW_AS_ACTION_NEVER;
private View mActionView;
private View mView;
private OnActionExpandListener mOnActionExpandListener;
private boolean mIsActionViewExpanded = false;
private boolean mIsVisible = true;
private OnMenuItemClickListener mClickListener;
static final int NO_ICON = 0;
public (SimpleMenu menu, int id, int order, CharSequence title) {
mMenu = menu;
mId = id;
mOrder = order;
mTitle = title;
}
return mId;
}
return mOrder;
}
public MenuItem
setTitle(CharSequence title) {
mTitle = title;
mMenu.onItemChanged(this, SimpleMenu.ITEM_CHANGED_TITLE);
return this;
}
public MenuItem
setTitle(
int titleRes) {
return setTitle(mMenu.getContext().getString(titleRes));
}
return mTitle;
}
mTitleCondensed = title;
return this;
}
return mTitleCondensed != null ? mTitleCondensed : mTitle;
}
public MenuItem
setIcon(Drawable icon) {
mIconResId = NO_ICON;
mIconDrawable = icon;
mMenu.onItemChanged(this, SimpleMenu.ITEM_CHANGED_ICON);
return this;
}
public MenuItem
setIcon(
int iconResId) {
mIconDrawable = null;
mIconResId = iconResId;
mMenu.onItemChanged(this, SimpleMenu.ITEM_CHANGED_ICON);
return this;
}
if (mIconDrawable != null) {
return mIconDrawable;
}
if (mIconResId != NO_ICON) {
return mMenu.getResources().getDrawable(mIconResId);
}
return null;
}
mEnabled = enabled;
return this;
}
return mEnabled;
}
return 0;
}
return mActionView;
}
return this;
}
return null;
}
if ((mShowAsAction & SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW) == 0 || mActionView == null) {
return false;
}
if (mOnActionExpandListener == null ||
mOnActionExpandListener.onMenuItemActionExpand(this)) {
return mMenu.expandItemActionView(this);
}
return false;
}
if ((mShowAsAction & SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW) == 0) {
return false;
}
if (mActionView == null) {
return true;
}
if (mOnActionExpandListener == null ||
mOnActionExpandListener.onMenuItemActionCollapse(this)) {
return mMenu.collapseItemActionView(this);
}
return false;
}
return mIsActionViewExpanded;
}
@Override
return this;
}
mOnActionExpandListener = onActionExpandListener;
return this;
}
mIntent = intent;
return this;
}
return mIntent;
}
return this;
}
return this;
}
return 0;
}
return this;
}
return 0;
}
return this;
}
return false;
}
return this;
}
return false;
}
mIsVisible = visible;
mMenu.onItemChanged(this, SimpleMenu.ITEM_CHANGED_VISIBILITY);
return this;
}
return mIsVisible;
}
if (mClickListener != null && mClickListener.onMenuItemClick(this)) {
return true;
}
if (mMenu.dispatchMenuItemSelected(mMenu, this)) {
return true;
}
if (mIntent != null) {
try {
mMenu.getContext().startActivity(mIntent);
return true;
} catch (ActivityNotFoundException e) {
Log.e(TAG, "Can't find activity to handle intent; ignoring", e);
}
}
return false;
}
public boolean () {
return false;
}
public SubMenu () {
return null;
}
public MenuItem (OnMenuItemClickListener onMenuItemClickListener) {
mClickListener = onMenuItemClickListener;
return this;
}
public ContextMenu.ContextMenuInfo () {
return null;
}
switch (actionEnum & SHOW_AS_ACTION_MASK) {
case SHOW_AS_ACTION_ALWAYS:
case SHOW_AS_ACTION_IF_ROOM:
case SHOW_AS_ACTION_NEVER:
break;
default:
throw new IllegalArgumentException("SHOW_AS_ACTION_ALWAYS, SHOW_AS_ACTION_IF_ROOM,"
+ " and SHOW_AS_ACTION_NEVER are mutually exclusive.");
}
mShowAsAction = actionEnum;
mMenu.onItemChanged(this, SimpleMenu.ITEM_CHANGED_ACTION);
}
setShowAsAction(actionEnum);
return null;
}
mActionView = view;
if (view != null && view.getId() == View.NO_ID && mId > 0) {
view.setId(mId);
}
mMenu.onItemChanged(this, SimpleMenu.ITEM_CHANGED_ACTION_VIEW);
return this;
}
final Context context = mMenu.getContext();
final LayoutInflater inflater = LayoutInflater.from(context);
setActionView(inflater.inflate(resId, null));
return this;
}
return (mShowAsAction & SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW) != 0 && mActionView != null;
}
mIsActionViewExpanded = isExpanded;
}
return mView;
}
mView = view;
}
}