2021-06-27 20:44:35 +00:00
|
|
|
package androidx.appcompat.view;
|
|
|
|
|
|
|
|
import android.app.Activity;
|
|
|
|
import android.content.Context;
|
|
|
|
import android.content.ContextWrapper;
|
|
|
|
import android.content.res.ColorStateList;
|
|
|
|
import android.content.res.TypedArray;
|
|
|
|
import android.content.res.XmlResourceParser;
|
|
|
|
import android.graphics.PorterDuff;
|
|
|
|
import android.util.AttributeSet;
|
|
|
|
import android.util.Log;
|
|
|
|
import android.util.Xml;
|
|
|
|
import android.view.InflateException;
|
|
|
|
import android.view.Menu;
|
|
|
|
import android.view.MenuInflater;
|
|
|
|
import android.view.MenuItem;
|
|
|
|
import android.view.SubMenu;
|
|
|
|
import android.view.View;
|
|
|
|
import androidx.annotation.LayoutRes;
|
|
|
|
import androidx.annotation.RestrictTo;
|
|
|
|
import androidx.appcompat.R;
|
|
|
|
import androidx.appcompat.view.menu.MenuItemImpl;
|
|
|
|
import androidx.appcompat.view.menu.MenuItemWrapperICS;
|
|
|
|
import androidx.appcompat.widget.DrawableUtils;
|
|
|
|
import androidx.appcompat.widget.TintTypedArray;
|
|
|
|
import androidx.core.internal.view.SupportMenu;
|
|
|
|
import androidx.core.view.ActionProvider;
|
|
|
|
import androidx.core.view.MenuItemCompat;
|
2021-12-17 21:59:34 +00:00
|
|
|
import b.d.b.a.a;
|
2021-06-27 20:44:35 +00:00
|
|
|
import java.io.IOException;
|
|
|
|
import java.lang.reflect.Constructor;
|
|
|
|
import java.lang.reflect.Method;
|
|
|
|
import org.xmlpull.v1.XmlPullParser;
|
|
|
|
import org.xmlpull.v1.XmlPullParserException;
|
|
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
|
2022-03-07 09:34:54 +00:00
|
|
|
/* loaded from: classes.dex */
|
2021-06-27 20:44:35 +00:00
|
|
|
public class SupportMenuInflater extends MenuInflater {
|
|
|
|
public static final Class<?>[] ACTION_PROVIDER_CONSTRUCTOR_SIGNATURE;
|
|
|
|
public static final Class<?>[] ACTION_VIEW_CONSTRUCTOR_SIGNATURE;
|
|
|
|
public static final String LOG_TAG = "SupportMenuInflater";
|
|
|
|
public static final int NO_ID = 0;
|
|
|
|
private static final String XML_GROUP = "group";
|
|
|
|
private static final String XML_ITEM = "item";
|
|
|
|
private static final String XML_MENU = "menu";
|
|
|
|
public final Object[] mActionProviderConstructorArguments;
|
|
|
|
public final Object[] mActionViewConstructorArguments;
|
|
|
|
public Context mContext;
|
|
|
|
private Object mRealOwner;
|
|
|
|
|
2022-03-07 09:34:54 +00:00
|
|
|
/* loaded from: classes.dex */
|
2021-06-27 20:44:35 +00:00
|
|
|
public static class InflatedOnMenuItemClickListener implements MenuItem.OnMenuItemClickListener {
|
|
|
|
private static final Class<?>[] PARAM_TYPES = {MenuItem.class};
|
|
|
|
private Method mMethod;
|
|
|
|
private Object mRealOwner;
|
|
|
|
|
|
|
|
public InflatedOnMenuItemClickListener(Object obj, String str) {
|
|
|
|
this.mRealOwner = obj;
|
|
|
|
Class<?> cls = obj.getClass();
|
|
|
|
try {
|
|
|
|
this.mMethod = cls.getMethod(str, PARAM_TYPES);
|
|
|
|
} catch (Exception e) {
|
2022-03-14 07:58:47 +00:00
|
|
|
StringBuilder X = a.X("Couldn't resolve menu item onClick handler ", str, " in class ");
|
|
|
|
X.append(cls.getName());
|
|
|
|
InflateException inflateException = new InflateException(X.toString());
|
2021-06-27 20:44:35 +00:00
|
|
|
inflateException.initCause(e);
|
|
|
|
throw inflateException;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // android.view.MenuItem.OnMenuItemClickListener
|
|
|
|
public boolean onMenuItemClick(MenuItem menuItem) {
|
|
|
|
try {
|
|
|
|
if (this.mMethod.getReturnType() == Boolean.TYPE) {
|
|
|
|
return ((Boolean) this.mMethod.invoke(this.mRealOwner, menuItem)).booleanValue();
|
|
|
|
}
|
|
|
|
this.mMethod.invoke(this.mRealOwner, menuItem);
|
|
|
|
return true;
|
|
|
|
} catch (Exception e) {
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-07 09:34:54 +00:00
|
|
|
/* loaded from: classes.dex */
|
2021-06-27 20:44:35 +00:00
|
|
|
public class MenuState {
|
|
|
|
private static final int defaultGroupId = 0;
|
|
|
|
private static final int defaultItemCategory = 0;
|
|
|
|
private static final int defaultItemCheckable = 0;
|
|
|
|
private static final boolean defaultItemChecked = false;
|
|
|
|
private static final boolean defaultItemEnabled = true;
|
|
|
|
private static final int defaultItemId = 0;
|
|
|
|
private static final int defaultItemOrder = 0;
|
|
|
|
private static final boolean defaultItemVisible = true;
|
|
|
|
private int groupCategory;
|
|
|
|
private int groupCheckable;
|
|
|
|
private boolean groupEnabled;
|
|
|
|
private int groupId;
|
|
|
|
private int groupOrder;
|
|
|
|
private boolean groupVisible;
|
|
|
|
public ActionProvider itemActionProvider;
|
|
|
|
private String itemActionProviderClassName;
|
|
|
|
private String itemActionViewClassName;
|
|
|
|
private int itemActionViewLayout;
|
|
|
|
private boolean itemAdded;
|
|
|
|
private int itemAlphabeticModifiers;
|
|
|
|
private char itemAlphabeticShortcut;
|
|
|
|
private int itemCategoryOrder;
|
|
|
|
private int itemCheckable;
|
|
|
|
private boolean itemChecked;
|
|
|
|
private CharSequence itemContentDescription;
|
|
|
|
private boolean itemEnabled;
|
|
|
|
private int itemIconResId;
|
|
|
|
private ColorStateList itemIconTintList = null;
|
|
|
|
private PorterDuff.Mode itemIconTintMode = null;
|
|
|
|
private int itemId;
|
|
|
|
private String itemListenerMethodName;
|
|
|
|
private int itemNumericModifiers;
|
|
|
|
private char itemNumericShortcut;
|
|
|
|
private int itemShowAsAction;
|
|
|
|
private CharSequence itemTitle;
|
|
|
|
private CharSequence itemTitleCondensed;
|
|
|
|
private CharSequence itemTooltipText;
|
|
|
|
private boolean itemVisible;
|
|
|
|
private Menu menu;
|
|
|
|
|
|
|
|
public MenuState(Menu menu) {
|
|
|
|
this.menu = menu;
|
|
|
|
resetGroup();
|
|
|
|
}
|
|
|
|
|
|
|
|
private char getShortcut(String str) {
|
|
|
|
if (str == null) {
|
2022-03-07 09:34:54 +00:00
|
|
|
return (char) 0;
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
return str.charAt(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
private <T> T newInstance(String str, Class<?>[] clsArr, Object[] objArr) {
|
|
|
|
try {
|
|
|
|
Constructor<?> constructor = Class.forName(str, false, SupportMenuInflater.this.mContext.getClassLoader()).getConstructor(clsArr);
|
|
|
|
constructor.setAccessible(true);
|
|
|
|
return (T) constructor.newInstance(objArr);
|
|
|
|
} catch (Exception e) {
|
2021-08-09 22:51:56 +00:00
|
|
|
Log.w(SupportMenuInflater.LOG_TAG, "Cannot instantiate class: " + str, e);
|
2021-06-27 20:44:35 +00:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void setItem(MenuItem menuItem) {
|
|
|
|
boolean z2 = false;
|
|
|
|
menuItem.setChecked(this.itemChecked).setVisible(this.itemVisible).setEnabled(this.itemEnabled).setCheckable(this.itemCheckable >= 1).setTitleCondensed(this.itemTitleCondensed).setIcon(this.itemIconResId);
|
|
|
|
int i = this.itemShowAsAction;
|
|
|
|
if (i >= 0) {
|
|
|
|
menuItem.setShowAsAction(i);
|
|
|
|
}
|
|
|
|
if (this.itemListenerMethodName != null) {
|
|
|
|
if (!SupportMenuInflater.this.mContext.isRestricted()) {
|
|
|
|
menuItem.setOnMenuItemClickListener(new InflatedOnMenuItemClickListener(SupportMenuInflater.this.getRealOwner(), this.itemListenerMethodName));
|
|
|
|
} else {
|
|
|
|
throw new IllegalStateException("The android:onClick attribute cannot be used within a restricted context");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (this.itemCheckable >= 2) {
|
|
|
|
if (menuItem instanceof MenuItemImpl) {
|
|
|
|
((MenuItemImpl) menuItem).setExclusiveCheckable(true);
|
|
|
|
} else if (menuItem instanceof MenuItemWrapperICS) {
|
|
|
|
((MenuItemWrapperICS) menuItem).setExclusiveCheckable(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
String str = this.itemActionViewClassName;
|
|
|
|
if (str != null) {
|
|
|
|
menuItem.setActionView((View) newInstance(str, SupportMenuInflater.ACTION_VIEW_CONSTRUCTOR_SIGNATURE, SupportMenuInflater.this.mActionViewConstructorArguments));
|
|
|
|
z2 = true;
|
|
|
|
}
|
|
|
|
int i2 = this.itemActionViewLayout;
|
|
|
|
if (i2 > 0) {
|
|
|
|
if (!z2) {
|
|
|
|
menuItem.setActionView(i2);
|
|
|
|
} else {
|
2021-08-09 22:51:56 +00:00
|
|
|
Log.w(SupportMenuInflater.LOG_TAG, "Ignoring attribute 'itemActionViewLayout'. Action view already specified.");
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
ActionProvider actionProvider = this.itemActionProvider;
|
|
|
|
if (actionProvider != null) {
|
|
|
|
MenuItemCompat.setActionProvider(menuItem, actionProvider);
|
|
|
|
}
|
|
|
|
MenuItemCompat.setContentDescription(menuItem, this.itemContentDescription);
|
|
|
|
MenuItemCompat.setTooltipText(menuItem, this.itemTooltipText);
|
|
|
|
MenuItemCompat.setAlphabeticShortcut(menuItem, this.itemAlphabeticShortcut, this.itemAlphabeticModifiers);
|
|
|
|
MenuItemCompat.setNumericShortcut(menuItem, this.itemNumericShortcut, this.itemNumericModifiers);
|
|
|
|
PorterDuff.Mode mode = this.itemIconTintMode;
|
|
|
|
if (mode != null) {
|
|
|
|
MenuItemCompat.setIconTintMode(menuItem, mode);
|
|
|
|
}
|
|
|
|
ColorStateList colorStateList = this.itemIconTintList;
|
|
|
|
if (colorStateList != null) {
|
|
|
|
MenuItemCompat.setIconTintList(menuItem, colorStateList);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void addItem() {
|
|
|
|
this.itemAdded = true;
|
|
|
|
setItem(this.menu.add(this.groupId, this.itemId, this.itemCategoryOrder, this.itemTitle));
|
|
|
|
}
|
|
|
|
|
|
|
|
public SubMenu addSubMenuItem() {
|
|
|
|
this.itemAdded = true;
|
|
|
|
SubMenu addSubMenu = this.menu.addSubMenu(this.groupId, this.itemId, this.itemCategoryOrder, this.itemTitle);
|
|
|
|
setItem(addSubMenu.getItem());
|
|
|
|
return addSubMenu;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean hasAddedItem() {
|
|
|
|
return this.itemAdded;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void readGroup(AttributeSet attributeSet) {
|
|
|
|
TypedArray obtainStyledAttributes = SupportMenuInflater.this.mContext.obtainStyledAttributes(attributeSet, R.styleable.MenuGroup);
|
|
|
|
this.groupId = obtainStyledAttributes.getResourceId(R.styleable.MenuGroup_android_id, 0);
|
|
|
|
this.groupCategory = obtainStyledAttributes.getInt(R.styleable.MenuGroup_android_menuCategory, 0);
|
|
|
|
this.groupOrder = obtainStyledAttributes.getInt(R.styleable.MenuGroup_android_orderInCategory, 0);
|
|
|
|
this.groupCheckable = obtainStyledAttributes.getInt(R.styleable.MenuGroup_android_checkableBehavior, 0);
|
|
|
|
this.groupVisible = obtainStyledAttributes.getBoolean(R.styleable.MenuGroup_android_visible, true);
|
|
|
|
this.groupEnabled = obtainStyledAttributes.getBoolean(R.styleable.MenuGroup_android_enabled, true);
|
|
|
|
obtainStyledAttributes.recycle();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void readItem(AttributeSet attributeSet) {
|
|
|
|
TintTypedArray obtainStyledAttributes = TintTypedArray.obtainStyledAttributes(SupportMenuInflater.this.mContext, attributeSet, R.styleable.MenuItem);
|
|
|
|
this.itemId = obtainStyledAttributes.getResourceId(R.styleable.MenuItem_android_id, 0);
|
2022-03-07 09:34:54 +00:00
|
|
|
this.itemCategoryOrder = (obtainStyledAttributes.getInt(R.styleable.MenuItem_android_menuCategory, this.groupCategory) & (-65536)) | (obtainStyledAttributes.getInt(R.styleable.MenuItem_android_orderInCategory, this.groupOrder) & 65535);
|
2021-06-27 20:44:35 +00:00
|
|
|
this.itemTitle = obtainStyledAttributes.getText(R.styleable.MenuItem_android_title);
|
|
|
|
this.itemTitleCondensed = obtainStyledAttributes.getText(R.styleable.MenuItem_android_titleCondensed);
|
|
|
|
this.itemIconResId = obtainStyledAttributes.getResourceId(R.styleable.MenuItem_android_icon, 0);
|
|
|
|
this.itemAlphabeticShortcut = getShortcut(obtainStyledAttributes.getString(R.styleable.MenuItem_android_alphabeticShortcut));
|
|
|
|
this.itemAlphabeticModifiers = obtainStyledAttributes.getInt(R.styleable.MenuItem_alphabeticModifiers, 4096);
|
|
|
|
this.itemNumericShortcut = getShortcut(obtainStyledAttributes.getString(R.styleable.MenuItem_android_numericShortcut));
|
|
|
|
this.itemNumericModifiers = obtainStyledAttributes.getInt(R.styleable.MenuItem_numericModifiers, 4096);
|
|
|
|
int i = R.styleable.MenuItem_android_checkable;
|
|
|
|
if (obtainStyledAttributes.hasValue(i)) {
|
|
|
|
this.itemCheckable = obtainStyledAttributes.getBoolean(i, false) ? 1 : 0;
|
|
|
|
} else {
|
|
|
|
this.itemCheckable = this.groupCheckable;
|
|
|
|
}
|
|
|
|
this.itemChecked = obtainStyledAttributes.getBoolean(R.styleable.MenuItem_android_checked, false);
|
|
|
|
this.itemVisible = obtainStyledAttributes.getBoolean(R.styleable.MenuItem_android_visible, this.groupVisible);
|
|
|
|
this.itemEnabled = obtainStyledAttributes.getBoolean(R.styleable.MenuItem_android_enabled, this.groupEnabled);
|
|
|
|
this.itemShowAsAction = obtainStyledAttributes.getInt(R.styleable.MenuItem_showAsAction, -1);
|
|
|
|
this.itemListenerMethodName = obtainStyledAttributes.getString(R.styleable.MenuItem_android_onClick);
|
|
|
|
this.itemActionViewLayout = obtainStyledAttributes.getResourceId(R.styleable.MenuItem_actionLayout, 0);
|
|
|
|
this.itemActionViewClassName = obtainStyledAttributes.getString(R.styleable.MenuItem_actionViewClass);
|
|
|
|
String string = obtainStyledAttributes.getString(R.styleable.MenuItem_actionProviderClass);
|
|
|
|
this.itemActionProviderClassName = string;
|
|
|
|
boolean z2 = string != null;
|
|
|
|
if (z2 && this.itemActionViewLayout == 0 && this.itemActionViewClassName == null) {
|
|
|
|
this.itemActionProvider = (ActionProvider) newInstance(string, SupportMenuInflater.ACTION_PROVIDER_CONSTRUCTOR_SIGNATURE, SupportMenuInflater.this.mActionProviderConstructorArguments);
|
|
|
|
} else {
|
|
|
|
if (z2) {
|
2021-08-09 22:51:56 +00:00
|
|
|
Log.w(SupportMenuInflater.LOG_TAG, "Ignoring attribute 'actionProviderClass'. Action view already specified.");
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
this.itemActionProvider = null;
|
|
|
|
}
|
|
|
|
this.itemContentDescription = obtainStyledAttributes.getText(R.styleable.MenuItem_contentDescription);
|
|
|
|
this.itemTooltipText = obtainStyledAttributes.getText(R.styleable.MenuItem_tooltipText);
|
|
|
|
int i2 = R.styleable.MenuItem_iconTintMode;
|
|
|
|
if (obtainStyledAttributes.hasValue(i2)) {
|
|
|
|
this.itemIconTintMode = DrawableUtils.parseTintMode(obtainStyledAttributes.getInt(i2, -1), this.itemIconTintMode);
|
|
|
|
} else {
|
|
|
|
this.itemIconTintMode = null;
|
|
|
|
}
|
|
|
|
int i3 = R.styleable.MenuItem_iconTint;
|
|
|
|
if (obtainStyledAttributes.hasValue(i3)) {
|
|
|
|
this.itemIconTintList = obtainStyledAttributes.getColorStateList(i3);
|
|
|
|
} else {
|
|
|
|
this.itemIconTintList = null;
|
|
|
|
}
|
|
|
|
obtainStyledAttributes.recycle();
|
|
|
|
this.itemAdded = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void resetGroup() {
|
|
|
|
this.groupId = 0;
|
|
|
|
this.groupCategory = 0;
|
|
|
|
this.groupOrder = 0;
|
|
|
|
this.groupCheckable = 0;
|
|
|
|
this.groupVisible = true;
|
|
|
|
this.groupEnabled = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static {
|
|
|
|
Class<?>[] clsArr = {Context.class};
|
|
|
|
ACTION_VIEW_CONSTRUCTOR_SIGNATURE = clsArr;
|
|
|
|
ACTION_PROVIDER_CONSTRUCTOR_SIGNATURE = clsArr;
|
|
|
|
}
|
|
|
|
|
|
|
|
public SupportMenuInflater(Context context) {
|
|
|
|
super(context);
|
|
|
|
this.mContext = context;
|
|
|
|
Object[] objArr = {context};
|
|
|
|
this.mActionViewConstructorArguments = objArr;
|
|
|
|
this.mActionProviderConstructorArguments = objArr;
|
|
|
|
}
|
|
|
|
|
|
|
|
private Object findRealOwner(Object obj) {
|
|
|
|
return (!(obj instanceof Activity) && (obj instanceof ContextWrapper)) ? findRealOwner(((ContextWrapper) obj).getBaseContext()) : obj;
|
|
|
|
}
|
|
|
|
|
|
|
|
private void parseMenu(XmlPullParser xmlPullParser, AttributeSet attributeSet, Menu menu) throws XmlPullParserException, IOException {
|
|
|
|
MenuState menuState = new MenuState(menu);
|
|
|
|
int eventType = xmlPullParser.getEventType();
|
|
|
|
while (true) {
|
|
|
|
if (eventType != 2) {
|
|
|
|
eventType = xmlPullParser.next();
|
|
|
|
if (eventType == 1) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
String name = xmlPullParser.getName();
|
2021-08-09 22:51:56 +00:00
|
|
|
if (name.equals(XML_MENU)) {
|
2021-06-27 20:44:35 +00:00
|
|
|
eventType = xmlPullParser.next();
|
|
|
|
} else {
|
2021-11-05 06:48:17 +00:00
|
|
|
throw new RuntimeException(a.v("Expecting menu, got ", name));
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
boolean z2 = false;
|
|
|
|
boolean z3 = false;
|
|
|
|
String str = null;
|
|
|
|
while (!z2) {
|
|
|
|
if (eventType != 1) {
|
|
|
|
if (eventType != 2) {
|
|
|
|
if (eventType == 3) {
|
|
|
|
String name2 = xmlPullParser.getName();
|
|
|
|
if (z3 && name2.equals(str)) {
|
|
|
|
str = null;
|
|
|
|
z3 = false;
|
2021-08-09 22:51:56 +00:00
|
|
|
} else if (name2.equals(XML_GROUP)) {
|
2021-06-27 20:44:35 +00:00
|
|
|
menuState.resetGroup();
|
2021-08-09 22:51:56 +00:00
|
|
|
} else if (name2.equals(XML_ITEM)) {
|
2021-06-27 20:44:35 +00:00
|
|
|
if (!menuState.hasAddedItem()) {
|
|
|
|
ActionProvider actionProvider = menuState.itemActionProvider;
|
|
|
|
if (actionProvider == null || !actionProvider.hasSubMenu()) {
|
|
|
|
menuState.addItem();
|
|
|
|
} else {
|
|
|
|
menuState.addSubMenuItem();
|
|
|
|
}
|
|
|
|
}
|
2021-08-09 22:51:56 +00:00
|
|
|
} else if (name2.equals(XML_MENU)) {
|
2021-06-27 20:44:35 +00:00
|
|
|
z2 = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (!z3) {
|
|
|
|
String name3 = xmlPullParser.getName();
|
2021-08-09 22:51:56 +00:00
|
|
|
if (name3.equals(XML_GROUP)) {
|
2021-06-27 20:44:35 +00:00
|
|
|
menuState.readGroup(attributeSet);
|
2021-08-09 22:51:56 +00:00
|
|
|
} else if (name3.equals(XML_ITEM)) {
|
2021-06-27 20:44:35 +00:00
|
|
|
menuState.readItem(attributeSet);
|
2021-08-09 22:51:56 +00:00
|
|
|
} else if (name3.equals(XML_MENU)) {
|
2021-06-27 20:44:35 +00:00
|
|
|
parseMenu(xmlPullParser, attributeSet, menuState.addSubMenuItem());
|
|
|
|
} else {
|
|
|
|
z3 = true;
|
|
|
|
str = name3;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
eventType = xmlPullParser.next();
|
|
|
|
} else {
|
|
|
|
throw new RuntimeException("Unexpected end of document");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public Object getRealOwner() {
|
|
|
|
if (this.mRealOwner == null) {
|
|
|
|
this.mRealOwner = findRealOwner(this.mContext);
|
|
|
|
}
|
|
|
|
return this.mRealOwner;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // android.view.MenuInflater
|
|
|
|
public void inflate(@LayoutRes int i, Menu menu) {
|
|
|
|
if (!(menu instanceof SupportMenu)) {
|
|
|
|
super.inflate(i, menu);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
XmlResourceParser xmlResourceParser = null;
|
|
|
|
try {
|
2022-03-07 09:34:54 +00:00
|
|
|
try {
|
|
|
|
try {
|
|
|
|
xmlResourceParser = this.mContext.getResources().getLayout(i);
|
|
|
|
parseMenu(xmlResourceParser, Xml.asAttributeSet(xmlResourceParser), menu);
|
|
|
|
} catch (XmlPullParserException e) {
|
|
|
|
throw new InflateException("Error inflating menu XML", e);
|
|
|
|
}
|
|
|
|
} catch (IOException e2) {
|
|
|
|
throw new InflateException("Error inflating menu XML", e2);
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
2022-03-07 09:34:54 +00:00
|
|
|
} finally {
|
2021-06-27 20:44:35 +00:00
|
|
|
if (xmlResourceParser != null) {
|
|
|
|
xmlResourceParser.close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|