Rabbit-R1/original r1/java/sources/androidx/appcompat/view/menu/MenuItemWrapperICS.java

493 lines
16 KiB
Java
Raw Normal View History

2024-05-21 21:08:36 +00:00
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.util.Log;
import android.view.ActionProvider;
import android.view.CollapsibleActionView;
import android.view.ContextMenu;
import android.view.MenuItem;
import android.view.SubMenu;
import android.view.View;
import android.widget.FrameLayout;
import androidx.core.internal.view.SupportMenuItem;
import androidx.core.view.ActionProvider;
import java.lang.reflect.Method;
/* loaded from: classes.dex */
public class MenuItemWrapperICS extends BaseMenuWrapper implements MenuItem {
static final String LOG_TAG = "MenuItemWrapper";
private Method mSetExclusiveCheckableMethod;
private final SupportMenuItem mWrappedObject;
public MenuItemWrapperICS(Context context, SupportMenuItem supportMenuItem) {
super(context);
if (supportMenuItem == null) {
throw new IllegalArgumentException("Wrapped Object can not be null.");
}
this.mWrappedObject = supportMenuItem;
}
@Override // android.view.MenuItem
public int getItemId() {
return this.mWrappedObject.getItemId();
}
@Override // android.view.MenuItem
public int getGroupId() {
return this.mWrappedObject.getGroupId();
}
@Override // android.view.MenuItem
public int getOrder() {
return this.mWrappedObject.getOrder();
}
@Override // android.view.MenuItem
public MenuItem setTitle(CharSequence charSequence) {
this.mWrappedObject.setTitle(charSequence);
return this;
}
@Override // android.view.MenuItem
public MenuItem setTitle(int i) {
this.mWrappedObject.setTitle(i);
return this;
}
@Override // android.view.MenuItem
public CharSequence getTitle() {
return this.mWrappedObject.getTitle();
}
@Override // android.view.MenuItem
public MenuItem setTitleCondensed(CharSequence charSequence) {
this.mWrappedObject.setTitleCondensed(charSequence);
return this;
}
@Override // android.view.MenuItem
public CharSequence getTitleCondensed() {
return this.mWrappedObject.getTitleCondensed();
}
@Override // android.view.MenuItem
public MenuItem setIcon(Drawable drawable) {
this.mWrappedObject.setIcon(drawable);
return this;
}
@Override // android.view.MenuItem
public MenuItem setIcon(int i) {
this.mWrappedObject.setIcon(i);
return this;
}
@Override // android.view.MenuItem
public Drawable getIcon() {
return this.mWrappedObject.getIcon();
}
@Override // android.view.MenuItem
public MenuItem setIntent(Intent intent) {
this.mWrappedObject.setIntent(intent);
return this;
}
@Override // android.view.MenuItem
public Intent getIntent() {
return this.mWrappedObject.getIntent();
}
@Override // android.view.MenuItem
public MenuItem setShortcut(char c, char c2) {
this.mWrappedObject.setShortcut(c, c2);
return this;
}
@Override // android.view.MenuItem
public MenuItem setShortcut(char c, char c2, int i, int i2) {
this.mWrappedObject.setShortcut(c, c2, i, i2);
return this;
}
@Override // android.view.MenuItem
public MenuItem setNumericShortcut(char c) {
this.mWrappedObject.setNumericShortcut(c);
return this;
}
@Override // android.view.MenuItem
public MenuItem setNumericShortcut(char c, int i) {
this.mWrappedObject.setNumericShortcut(c, i);
return this;
}
@Override // android.view.MenuItem
public char getNumericShortcut() {
return this.mWrappedObject.getNumericShortcut();
}
@Override // android.view.MenuItem
public int getNumericModifiers() {
return this.mWrappedObject.getNumericModifiers();
}
@Override // android.view.MenuItem
public MenuItem setAlphabeticShortcut(char c) {
this.mWrappedObject.setAlphabeticShortcut(c);
return this;
}
@Override // android.view.MenuItem
public MenuItem setAlphabeticShortcut(char c, int i) {
this.mWrappedObject.setAlphabeticShortcut(c, i);
return this;
}
@Override // android.view.MenuItem
public char getAlphabeticShortcut() {
return this.mWrappedObject.getAlphabeticShortcut();
}
@Override // android.view.MenuItem
public int getAlphabeticModifiers() {
return this.mWrappedObject.getAlphabeticModifiers();
}
@Override // android.view.MenuItem
public MenuItem setCheckable(boolean z) {
this.mWrappedObject.setCheckable(z);
return this;
}
@Override // android.view.MenuItem
public boolean isCheckable() {
return this.mWrappedObject.isCheckable();
}
@Override // android.view.MenuItem
public MenuItem setChecked(boolean z) {
this.mWrappedObject.setChecked(z);
return this;
}
@Override // android.view.MenuItem
public boolean isChecked() {
return this.mWrappedObject.isChecked();
}
@Override // android.view.MenuItem
public MenuItem setVisible(boolean z) {
return this.mWrappedObject.setVisible(z);
}
@Override // android.view.MenuItem
public boolean isVisible() {
return this.mWrappedObject.isVisible();
}
@Override // android.view.MenuItem
public MenuItem setEnabled(boolean z) {
this.mWrappedObject.setEnabled(z);
return this;
}
@Override // android.view.MenuItem
public boolean isEnabled() {
return this.mWrappedObject.isEnabled();
}
@Override // android.view.MenuItem
public boolean hasSubMenu() {
return this.mWrappedObject.hasSubMenu();
}
@Override // android.view.MenuItem
public SubMenu getSubMenu() {
return getSubMenuWrapper(this.mWrappedObject.getSubMenu());
}
@Override // android.view.MenuItem
public MenuItem setOnMenuItemClickListener(MenuItem.OnMenuItemClickListener onMenuItemClickListener) {
this.mWrappedObject.setOnMenuItemClickListener(onMenuItemClickListener != null ? new OnMenuItemClickListenerWrapper(onMenuItemClickListener) : null);
return this;
}
@Override // android.view.MenuItem
public ContextMenu.ContextMenuInfo getMenuInfo() {
return this.mWrappedObject.getMenuInfo();
}
@Override // android.view.MenuItem
public void setShowAsAction(int i) {
this.mWrappedObject.setShowAsAction(i);
}
@Override // android.view.MenuItem
public MenuItem setShowAsActionFlags(int i) {
this.mWrappedObject.setShowAsActionFlags(i);
return this;
}
@Override // android.view.MenuItem
public MenuItem setActionView(View view) {
if (view instanceof CollapsibleActionView) {
view = new CollapsibleActionViewWrapper(view);
}
this.mWrappedObject.setActionView(view);
return this;
}
@Override // android.view.MenuItem
public MenuItem setActionView(int i) {
this.mWrappedObject.setActionView(i);
View actionView = this.mWrappedObject.getActionView();
if (actionView instanceof CollapsibleActionView) {
this.mWrappedObject.setActionView(new CollapsibleActionViewWrapper(actionView));
}
return this;
}
@Override // android.view.MenuItem
public View getActionView() {
View actionView = this.mWrappedObject.getActionView();
return actionView instanceof CollapsibleActionViewWrapper ? ((CollapsibleActionViewWrapper) actionView).getWrappedView() : actionView;
}
@Override // android.view.MenuItem
public MenuItem setActionProvider(ActionProvider actionProvider) {
ActionProviderWrapperJB actionProviderWrapperJB = new ActionProviderWrapperJB(this.mContext, actionProvider);
SupportMenuItem supportMenuItem = this.mWrappedObject;
if (actionProvider == null) {
actionProviderWrapperJB = null;
}
supportMenuItem.setSupportActionProvider(actionProviderWrapperJB);
return this;
}
@Override // android.view.MenuItem
public ActionProvider getActionProvider() {
androidx.core.view.ActionProvider supportActionProvider = this.mWrappedObject.getSupportActionProvider();
if (supportActionProvider instanceof ActionProviderWrapper) {
return ((ActionProviderWrapper) supportActionProvider).mInner;
}
return null;
}
@Override // android.view.MenuItem
public boolean expandActionView() {
return this.mWrappedObject.expandActionView();
}
@Override // android.view.MenuItem
public boolean collapseActionView() {
return this.mWrappedObject.collapseActionView();
}
@Override // android.view.MenuItem
public boolean isActionViewExpanded() {
return this.mWrappedObject.isActionViewExpanded();
}
@Override // android.view.MenuItem
public MenuItem setOnActionExpandListener(MenuItem.OnActionExpandListener onActionExpandListener) {
this.mWrappedObject.setOnActionExpandListener(onActionExpandListener != null ? new OnActionExpandListenerWrapper(onActionExpandListener) : null);
return this;
}
@Override // android.view.MenuItem
public MenuItem setContentDescription(CharSequence charSequence) {
this.mWrappedObject.setContentDescription(charSequence);
return this;
}
@Override // android.view.MenuItem
public CharSequence getContentDescription() {
return this.mWrappedObject.getContentDescription();
}
@Override // android.view.MenuItem
public MenuItem setTooltipText(CharSequence charSequence) {
this.mWrappedObject.setTooltipText(charSequence);
return this;
}
@Override // android.view.MenuItem
public CharSequence getTooltipText() {
return this.mWrappedObject.getTooltipText();
}
@Override // android.view.MenuItem
public MenuItem setIconTintList(ColorStateList colorStateList) {
this.mWrappedObject.setIconTintList(colorStateList);
return this;
}
@Override // android.view.MenuItem
public ColorStateList getIconTintList() {
return this.mWrappedObject.getIconTintList();
}
@Override // android.view.MenuItem
public MenuItem setIconTintMode(PorterDuff.Mode mode) {
this.mWrappedObject.setIconTintMode(mode);
return this;
}
@Override // android.view.MenuItem
public PorterDuff.Mode getIconTintMode() {
return this.mWrappedObject.getIconTintMode();
}
public void setExclusiveCheckable(boolean z) {
try {
if (this.mSetExclusiveCheckableMethod == null) {
this.mSetExclusiveCheckableMethod = this.mWrappedObject.getClass().getDeclaredMethod("setExclusiveCheckable", Boolean.TYPE);
}
this.mSetExclusiveCheckableMethod.invoke(this.mWrappedObject, Boolean.valueOf(z));
} catch (Exception e) {
Log.w(LOG_TAG, "Error while calling setExclusiveCheckable", e);
}
}
/* loaded from: classes.dex */
private class OnMenuItemClickListenerWrapper implements MenuItem.OnMenuItemClickListener {
private final MenuItem.OnMenuItemClickListener mObject;
OnMenuItemClickListenerWrapper(MenuItem.OnMenuItemClickListener onMenuItemClickListener) {
this.mObject = onMenuItemClickListener;
}
@Override // android.view.MenuItem.OnMenuItemClickListener
public boolean onMenuItemClick(MenuItem menuItem) {
return this.mObject.onMenuItemClick(MenuItemWrapperICS.this.getMenuItemWrapper(menuItem));
}
}
/* loaded from: classes.dex */
private class OnActionExpandListenerWrapper implements MenuItem.OnActionExpandListener {
private final MenuItem.OnActionExpandListener mObject;
OnActionExpandListenerWrapper(MenuItem.OnActionExpandListener onActionExpandListener) {
this.mObject = onActionExpandListener;
}
@Override // android.view.MenuItem.OnActionExpandListener
public boolean onMenuItemActionExpand(MenuItem menuItem) {
return this.mObject.onMenuItemActionExpand(MenuItemWrapperICS.this.getMenuItemWrapper(menuItem));
}
@Override // android.view.MenuItem.OnActionExpandListener
public boolean onMenuItemActionCollapse(MenuItem menuItem) {
return this.mObject.onMenuItemActionCollapse(MenuItemWrapperICS.this.getMenuItemWrapper(menuItem));
}
}
/* loaded from: classes.dex */
private class ActionProviderWrapper extends androidx.core.view.ActionProvider {
final ActionProvider mInner;
ActionProviderWrapper(Context context, ActionProvider actionProvider) {
super(context);
this.mInner = actionProvider;
}
@Override // androidx.core.view.ActionProvider
public View onCreateActionView() {
return this.mInner.onCreateActionView();
}
@Override // androidx.core.view.ActionProvider
public boolean onPerformDefaultAction() {
return this.mInner.onPerformDefaultAction();
}
@Override // androidx.core.view.ActionProvider
public boolean hasSubMenu() {
return this.mInner.hasSubMenu();
}
@Override // androidx.core.view.ActionProvider
public void onPrepareSubMenu(SubMenu subMenu) {
this.mInner.onPrepareSubMenu(MenuItemWrapperICS.this.getSubMenuWrapper(subMenu));
}
}
/* loaded from: classes.dex */
private class ActionProviderWrapperJB extends ActionProviderWrapper implements ActionProvider.VisibilityListener {
private ActionProvider.VisibilityListener mListener;
ActionProviderWrapperJB(Context context, android.view.ActionProvider actionProvider) {
super(context, actionProvider);
}
@Override // androidx.core.view.ActionProvider
public View onCreateActionView(MenuItem menuItem) {
return this.mInner.onCreateActionView(menuItem);
}
@Override // androidx.core.view.ActionProvider
public boolean overridesItemVisibility() {
return this.mInner.overridesItemVisibility();
}
@Override // androidx.core.view.ActionProvider
public boolean isVisible() {
return this.mInner.isVisible();
}
@Override // androidx.core.view.ActionProvider
public void refreshVisibility() {
this.mInner.refreshVisibility();
}
@Override // androidx.core.view.ActionProvider
public void setVisibilityListener(ActionProvider.VisibilityListener visibilityListener) {
this.mListener = visibilityListener;
android.view.ActionProvider actionProvider = this.mInner;
if (visibilityListener == null) {
this = null;
}
actionProvider.setVisibilityListener(this);
}
@Override // android.view.ActionProvider.VisibilityListener
public void onActionProviderVisibilityChanged(boolean z) {
ActionProvider.VisibilityListener visibilityListener = this.mListener;
if (visibilityListener != null) {
visibilityListener.onActionProviderVisibilityChanged(z);
}
}
}
/* loaded from: classes.dex */
static class CollapsibleActionViewWrapper extends FrameLayout implements androidx.appcompat.view.CollapsibleActionView {
final CollapsibleActionView mWrappedView;
/* JADX WARN: Multi-variable type inference failed */
CollapsibleActionViewWrapper(View view) {
super(view.getContext());
this.mWrappedView = (CollapsibleActionView) view;
addView(view);
}
@Override // androidx.appcompat.view.CollapsibleActionView
public void onActionViewExpanded() {
this.mWrappedView.onActionViewExpanded();
}
@Override // androidx.appcompat.view.CollapsibleActionView
public void onActionViewCollapsed() {
this.mWrappedView.onActionViewCollapsed();
}
View getWrappedView() {
return (View) this.mWrappedView;
}
}
}