content: package androidx.appcompat.view.menu;
  
  import android.content.Context;
  import android.content.Intent;
  import android.content.res.ColorStateList;
  import android.graphics.PorterDuff;
  import android.graphics.drawable.Drawable;
  import android.view.ActionProvider;
  import android.view.ContextMenu;
  import android.view.KeyEvent;
  import android.view.MenuItem;
  import android.view.SubMenu;
  import android.view.View;
  import androidx.core.content.ContextCompat;
  import androidx.core.graphics.drawable.DrawableCompat;
  import androidx.core.internal.view.SupportMenuItem;
  
  public class ActionMenuItem implements SupportMenuItem {
      private static final int CHECKABLE = 1;
      private static final int CHECKED = 2;
      private static final int ENABLED = 16;
      private static final int EXCLUSIVE = 4;
      private static final int HIDDEN = 8;
      private MenuItem.OnMenuItemClickListener mClickListener;
      private CharSequence mContentDescription;
      private Context mContext;
      private int mFlags = 16;
      private final int mGroup;
      private boolean mHasIconTint = false;
      private boolean mHasIconTintMode = false;
      private Drawable mIconDrawable;
      private ColorStateList mIconTintList = null;
      private PorterDuff.Mode mIconTintMode = null;
      private final int mId;
      private Intent mIntent;
      private final int mOrdering;
      private char mShortcutAlphabeticChar;
      private int mShortcutAlphabeticModifiers = 4096;
      private char mShortcutNumericChar;
      private int mShortcutNumericModifiers = 4096;
      private CharSequence mTitle;
      private CharSequence mTitleCondensed;
      private CharSequence mTooltipText;
  
      public ActionMenuItem(Context context, int group, int id, int categoryOrder, int ordering, CharSequence title) {
          this.mContext = context;
          this.mId = id;
          this.mGroup = group;
          this.mOrdering = ordering;
          this.mTitle = title;
      }
  
      private void applyIconTint() {
          Drawable drawable = this.mIconDrawable;
          if (drawable == null) {
              return;
          }
          if (this.mHasIconTint || this.mHasIconTintMode) {
              Drawable wrap = DrawableCompat.wrap(drawable);
              this.mIconDrawable = wrap;
              Drawable mutate = wrap.mutate();
              this.mIconDrawable = mutate;
              if (this.mHasIconTint) {
                  DrawableCompat.setTintList(mutate, this.mIconTintList);
              }
              if (this.mHasIconTintMode) {
                  DrawableCompat.setTintMode(this.mIconDrawable, this.mIconTintMode);
              }
          }
      }
  
      public boolean collapseActionView() {
          return false;
      }
  
      public boolean expandActionView() {
          return false;
      }
  
      public ActionProvider getActionProvider() {
          throw new UnsupportedOperationException();
      }
  
      public View getActionView() {
          return null;
      }
  
      public int getAlphabeticModifiers() {
          return this.mShortcutAlphabeticModifiers;
      }
  
      public char getAlphabeticShortcut() {
          return this.mShortcutAlphabeticChar;
      }
  
      public CharSequence getContentDescription() {
          return this.mContentDescription;
      }
  
      public int getGroupId() {
          return this.mGroup;
      }
  
      public Drawable getIcon() {
          return this.mIconDrawable;
      }
  
      public ColorStateList getIconTintList() {
          return this.mIconTintList;
      }
  
      public PorterDuff.Mode getIconTintMode() {
          return this.mIconTintMode;
      }
  
      public Intent getIntent() {
          return this.mIntent;
      }
  
      public int getItemId() {
          return this.mId;
      }
  
      public ContextMenu.ContextMenuInfo getMenuInfo() {
          return null;
      }
  
      public int getNumericModifiers() {
          return this.mShortcutNumericModifiers;
      }
  
      public char getNumericShortcut() {
          return this.mShortcutNumericChar;
      }
  
      public int getOrder() {
          return this.mOrdering;
      }
  
      public SubMenu getSubMenu() {
          return null;
      }
  
      public androidx.core.view.ActionProvider getSupportActionProvider() {
          return null;
      }
  
      public CharSequence getTitle() {
          return this.mTitle;
      }
  
      public CharSequence getTitleCondensed() {
          CharSequence charSequence = this.mTitleCondensed;
          return charSequence != null ? charSequence : this.mTitle;
      }
  
      public CharSequence getTooltipText() {
          return this.mTooltipText;
      }
  
      public boolean hasSubMenu() {
          return false;
      }
  
      public boolean invoke() {
          MenuItem.OnMenuItemClickListener onMenuItemClickListener = this.mClickListener;
          if (onMenuItemClickListener != null && onMenuItemClickListener.onMenuItemClick(this)) {
              return true;
          }
          Intent intent = this.mIntent;
          if (intent == null) {
              return false;
          }
          this.mContext.startActivity(intent);
          return true;
      }
  
      public boolean isActionViewExpanded() {
          return false;
      }
  
      public boolean isCheckable() {
          return (this.mFlags & 1) != 0;
      }
  
      public boolean isChecked() {
          return (this.mFlags & 2) != 0;
      }
  
      public boolean isEnabled() {
          return (this.mFlags & 16) != 0;
      }
  
      public boolean isVisible() {
          return (this.mFlags & 8) == 0;
      }
  
      public boolean requiresActionButton() {
          return true;
      }
  
      public boolean requiresOverflow() {
          return false;
      }
  
      public MenuItem setActionProvider(ActionProvider actionProvider) {
          throw new UnsupportedOperationException();
      }
  
      public SupportMenuItem setActionView(int resId) {
          throw new UnsupportedOperationException();
      }
  
      public SupportMenuItem setActionView(View actionView) {
          throw new UnsupportedOperationException();
      }
  
      public MenuItem setAlphabeticShortcut(char alphaChar) {
          this.mShortcutAlphabeticChar = Character.toLowerCase(alphaChar);
          return this;
      }
  
      public MenuItem setAlphabeticShortcut(char alphaChar, int alphaModifiers) {
          this.mShortcutAlphabeticChar = Character.toLowerCase(alphaChar);
          this.mShortcutAlphabeticModifiers = KeyEvent.normalizeMetaState(alphaModifiers);
          return this;
      }
  
      public MenuItem setCheckable(boolean checkable) {
          this.mFlags = (this.mFlags & true) | checkable ? 1 : 0;
          return this;
      }
  
      public MenuItem setChecked(boolean checked) {
          this.mFlags = (this.mFlags & -3) | (checked ? 2 : 0);
          return this;
      }
  
      public SupportMenuItem setContentDescription(CharSequence contentDescription) {
          this.mContentDescription = contentDescription;
          return this;
      }
  
      public MenuItem setEnabled(boolean enabled) {
          this.mFlags = (this.mFlags & -17) | (enabled ? 16 : 0);
          return this;
      }
  
      public ActionMenuItem setExclusiveCheckable(boolean exclusive) {
          this.mFlags = (this.mFlags & -5) | (exclusive ? 4 : 0);
          return this;
      }
  
      public MenuItem setIcon(int iconRes) {
          this.mIconDrawable = ContextCompat.getDrawable(this.mContext, iconRes);
          applyIconTint();
          return this;
      }
  
      public MenuItem setIcon(Drawable icon) {
          this.mIconDrawable = icon;
          applyIconTint();
          return this;
      }
  
      public MenuItem setIconTintList(ColorStateList iconTintList) {
          this.mIconTintList = iconTintList;
          this.mHasIconTint = true;
          applyIconTint();
          return this;
      }
  
      public MenuItem setIconTintMode(PorterDuff.Mode iconTintMode) {
          this.mIconTintMode = iconTintMode;
          this.mHasIconTintMode = true;
          applyIconTint();
          return this;
      }
  
      public MenuItem setIntent(Intent intent) {
          this.mIntent = intent;
          return this;
      }
  
      public MenuItem setNumericShortcut(char numericChar) {
          this.mShortcutNumericChar = numericChar;
          return this;
      }
  
      public MenuItem setNumericShortcut(char numericChar, int numericModifiers) {
          this.mShortcutNumericChar = numericChar;
          this.mShortcutNumericModifiers = KeyEvent.normalizeMetaState(numericModifiers);
          return this;
      }
  
      public MenuItem setOnActionExpandListener(MenuItem.OnActionExpandListener listener) {
          throw new UnsupportedOperationException();
      }
  
      public MenuItem setOnMenuItemClickListener(MenuItem.OnMenuItemClickListener menuItemClickListener) {
          this.mClickListener = menuItemClickListener;
          return this;
      }
  
      public MenuItem setShortcut(char numericChar, char alphaChar) {
          this.mShortcutNumericChar = numericChar;
          this.mShortcutAlphabeticChar = Character.toLowerCase(alphaChar);
          return this;
      }
  
      public MenuItem setShortcut(char numericChar, char alphaChar, int numericModifiers, int alphaModifiers) {
          this.mShortcutNumericChar = numericChar;
          this.mShortcutNumericModifiers = KeyEvent.normalizeMetaState(numericModifiers);
          this.mShortcutAlphabeticChar = Character.toLowerCase(alphaChar);
          this.mShortcutAlphabeticModifiers = KeyEvent.normalizeMetaState(alphaModifiers);
          return this;
      }
  
      public void setShowAsAction(int show) {
      }
  
      public SupportMenuItem setShowAsActionFlags(int actionEnum) {
          setShowAsAction(actionEnum);
          return this;
      }
  
      public SupportMenuItem setSupportActionProvider(androidx.core.view.ActionProvider actionProvider) {
          throw new UnsupportedOperationException();
      }
  
      public MenuItem setTitle(int title) {
          this.mTitle = this.mContext.getResources().getString(title);
          return this;
      }
  
      public MenuItem setTitle(CharSequence title) {
          this.mTitle = title;
          return this;
      }
  
      public MenuItem setTitleCondensed(CharSequence title) {
          this.mTitleCondensed = title;
          return this;
      }
  
      public SupportMenuItem setTooltipText(CharSequence tooltipText) {
          this.mTooltipText = tooltipText;
          return this;
      }
  
      public MenuItem setVisible(boolean visible) {
          int i = 8;
          int i2 = this.mFlags & 8;
          if (visible) {
              i = 0;
          }
          this.mFlags = i2 | i;
          return this;
      }
  }
  