372 lines
15 KiB
Java
372 lines
15 KiB
Java
package o;
|
|
|
|
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.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.appcompat.view.menu.MenuItemImpl;
|
|
import androidx.appcompat.view.menu.MenuItemWrapperICS;
|
|
import java.io.IOException;
|
|
import java.lang.reflect.Constructor;
|
|
import java.lang.reflect.Method;
|
|
import o.SYO;
|
|
import org.xmlpull.v1.XmlPullParser;
|
|
import org.xmlpull.v1.XmlPullParserException;
|
|
|
|
/* loaded from: classes.dex */
|
|
public final class JHJ extends MenuInflater {
|
|
static final Class<?>[] d;
|
|
private static Class<?>[] e;
|
|
final Object[] a;
|
|
final Object[] b;
|
|
Context c;
|
|
private Object i;
|
|
|
|
static {
|
|
Class<?>[] clsArr = {Context.class};
|
|
d = clsArr;
|
|
e = clsArr;
|
|
}
|
|
|
|
public JHJ(Context context) {
|
|
super(context);
|
|
this.c = context;
|
|
Object[] objArr = {context};
|
|
this.b = objArr;
|
|
this.a = objArr;
|
|
}
|
|
|
|
@Override // android.view.MenuInflater
|
|
public final void inflate(int i, Menu menu) {
|
|
if (!(menu instanceof InterfaceMenuC13010fNw)) {
|
|
super.inflate(i, menu);
|
|
return;
|
|
}
|
|
XmlResourceParser xmlResourceParser = null;
|
|
try {
|
|
try {
|
|
try {
|
|
xmlResourceParser = this.c.getResources().getLayout(i);
|
|
el_(xmlResourceParser, Xml.asAttributeSet(xmlResourceParser), menu);
|
|
} catch (XmlPullParserException e2) {
|
|
throw new InflateException("Error inflating menu XML", e2);
|
|
}
|
|
} catch (IOException e3) {
|
|
throw new InflateException("Error inflating menu XML", e3);
|
|
}
|
|
} finally {
|
|
if (xmlResourceParser != null) {
|
|
xmlResourceParser.close();
|
|
}
|
|
}
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
private void el_(XmlPullParser xmlPullParser, AttributeSet attributeSet, Menu menu) throws XmlPullParserException, IOException {
|
|
int i;
|
|
LWm lWm = new LWm(this, menu);
|
|
int eventType = xmlPullParser.getEventType();
|
|
while (true) {
|
|
if (eventType == 2) {
|
|
String name = xmlPullParser.getName();
|
|
if (name.equals("menu")) {
|
|
eventType = xmlPullParser.next();
|
|
} else {
|
|
throw new RuntimeException("Expecting menu, got ".concat(String.valueOf(name)));
|
|
}
|
|
} else {
|
|
eventType = xmlPullParser.next();
|
|
if (eventType == 1) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
String str = null;
|
|
boolean z = false;
|
|
boolean z2 = false;
|
|
while (!z) {
|
|
if (eventType == 1) {
|
|
throw new RuntimeException("Unexpected end of document");
|
|
}
|
|
if (eventType != 2) {
|
|
if (eventType == 3) {
|
|
String name2 = xmlPullParser.getName();
|
|
if (z2 && name2.equals(str)) {
|
|
str = null;
|
|
z2 = false;
|
|
} else if (!name2.equals("group")) {
|
|
if (!name2.equals("item")) {
|
|
if (name2.equals("menu")) {
|
|
z = true;
|
|
}
|
|
} else if (!lWm.n) {
|
|
if (lWm.g != null && lWm.g.b()) {
|
|
lWm.en_();
|
|
} else {
|
|
lWm.n = true;
|
|
lWm.em_(lWm.I.add(lWm.a, lWm.y, lWm.m, lWm.A));
|
|
}
|
|
}
|
|
} else {
|
|
lWm.a = 0;
|
|
lWm.d = 0;
|
|
lWm.c = 0;
|
|
lWm.b = 0;
|
|
lWm.h = true;
|
|
lWm.e = true;
|
|
}
|
|
}
|
|
} else if (!z2) {
|
|
String name3 = xmlPullParser.getName();
|
|
if (!name3.equals("group")) {
|
|
if (!name3.equals("item")) {
|
|
if (name3.equals("menu")) {
|
|
el_(xmlPullParser, attributeSet, lWm.en_());
|
|
} else {
|
|
str = name3;
|
|
z2 = true;
|
|
}
|
|
} else {
|
|
Context context = lWm.E.c;
|
|
C0683McA c0683McA = new C0683McA(context, context.obtainStyledAttributes(attributeSet, SYO.ZqN.MenuItem));
|
|
lWm.y = c0683McA.d.getResourceId(SYO.ZqN.MenuItem_android_id, 0);
|
|
lWm.m = (c0683McA.d.getInt(SYO.ZqN.MenuItem_android_menuCategory, lWm.d) & (-65536)) | (c0683McA.d.getInt(SYO.ZqN.MenuItem_android_orderInCategory, lWm.c) & 65535);
|
|
lWm.A = c0683McA.d.getText(SYO.ZqN.MenuItem_android_title);
|
|
lWm.D = c0683McA.d.getText(SYO.ZqN.MenuItem_android_titleCondensed);
|
|
lWm.p = c0683McA.d.getResourceId(SYO.ZqN.MenuItem_android_icon, 0);
|
|
String string = c0683McA.d.getString(SYO.ZqN.MenuItem_android_alphabeticShortcut);
|
|
lWm.f8218o = string == null ? (char) 0 : string.charAt(0);
|
|
lWm.k = c0683McA.d.getInt(SYO.ZqN.MenuItem_alphabeticModifiers, 4096);
|
|
String string2 = c0683McA.d.getString(SYO.ZqN.MenuItem_android_numericShortcut);
|
|
lWm.x = string2 == null ? (char) 0 : string2.charAt(0);
|
|
lWm.u = c0683McA.d.getInt(SYO.ZqN.MenuItem_numericModifiers, 4096);
|
|
if (!c0683McA.d.hasValue(SYO.ZqN.MenuItem_android_checkable)) {
|
|
i = lWm.b;
|
|
} else {
|
|
i = c0683McA.d.getBoolean(SYO.ZqN.MenuItem_android_checkable, false);
|
|
}
|
|
lWm.l = i;
|
|
lWm.t = c0683McA.d.getBoolean(SYO.ZqN.MenuItem_android_checked, false);
|
|
lWm.C = c0683McA.d.getBoolean(SYO.ZqN.MenuItem_android_visible, lWm.h);
|
|
lWm.q = c0683McA.d.getBoolean(SYO.ZqN.MenuItem_android_enabled, lWm.e);
|
|
lWm.B = c0683McA.d.getInt(SYO.ZqN.MenuItem_showAsAction, -1);
|
|
lWm.w = c0683McA.d.getString(SYO.ZqN.MenuItem_android_onClick);
|
|
lWm.i = c0683McA.d.getResourceId(SYO.ZqN.MenuItem_actionLayout, 0);
|
|
lWm.f = c0683McA.d.getString(SYO.ZqN.MenuItem_actionViewClass);
|
|
String string3 = c0683McA.d.getString(SYO.ZqN.MenuItem_actionProviderClass);
|
|
lWm.j = string3;
|
|
if (string3 != null && lWm.i == 0 && lWm.f == null) {
|
|
lWm.g = (hbU) lWm.b(string3, e, lWm.E.a);
|
|
} else {
|
|
lWm.g = null;
|
|
}
|
|
lWm.s = c0683McA.d.getText(SYO.ZqN.MenuItem_contentDescription);
|
|
lWm.z = c0683McA.d.getText(SYO.ZqN.MenuItem_tooltipText);
|
|
if (c0683McA.d.hasValue(SYO.ZqN.MenuItem_iconTintMode)) {
|
|
lWm.v = FIj.hZ_(c0683McA.d.getInt(SYO.ZqN.MenuItem_iconTintMode, -1), lWm.v);
|
|
} else {
|
|
lWm.v = null;
|
|
}
|
|
if (c0683McA.d.hasValue(SYO.ZqN.MenuItem_iconTint)) {
|
|
lWm.r = c0683McA.jK_(SYO.ZqN.MenuItem_iconTint);
|
|
} else {
|
|
lWm.r = null;
|
|
}
|
|
c0683McA.d.recycle();
|
|
lWm.n = false;
|
|
}
|
|
} else {
|
|
TypedArray obtainStyledAttributes = lWm.E.c.obtainStyledAttributes(attributeSet, SYO.ZqN.MenuGroup);
|
|
lWm.a = obtainStyledAttributes.getResourceId(SYO.ZqN.MenuGroup_android_id, 0);
|
|
lWm.d = obtainStyledAttributes.getInt(SYO.ZqN.MenuGroup_android_menuCategory, 0);
|
|
lWm.c = obtainStyledAttributes.getInt(SYO.ZqN.MenuGroup_android_orderInCategory, 0);
|
|
lWm.b = obtainStyledAttributes.getInt(SYO.ZqN.MenuGroup_android_checkableBehavior, 0);
|
|
lWm.h = obtainStyledAttributes.getBoolean(SYO.ZqN.MenuGroup_android_visible, true);
|
|
lWm.e = obtainStyledAttributes.getBoolean(SYO.ZqN.MenuGroup_android_enabled, true);
|
|
obtainStyledAttributes.recycle();
|
|
}
|
|
}
|
|
eventType = xmlPullParser.next();
|
|
}
|
|
}
|
|
|
|
private Object e(Object obj) {
|
|
return (!(obj instanceof Activity) && (obj instanceof ContextWrapper)) ? e(((ContextWrapper) obj).getBaseContext()) : obj;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* loaded from: classes.dex */
|
|
public static class RVV implements MenuItem.OnMenuItemClickListener {
|
|
private static final Class<?>[] a = {MenuItem.class};
|
|
private Method b;
|
|
private Object e;
|
|
|
|
public RVV(Object obj, String str) {
|
|
this.e = obj;
|
|
Class<?> cls = obj.getClass();
|
|
try {
|
|
this.b = cls.getMethod(str, a);
|
|
} catch (Exception e) {
|
|
StringBuilder sb = new StringBuilder("Couldn't resolve menu item onClick handler ");
|
|
sb.append(str);
|
|
sb.append(" in class ");
|
|
sb.append(cls.getName());
|
|
InflateException inflateException = new InflateException(sb.toString());
|
|
inflateException.initCause(e);
|
|
throw inflateException;
|
|
}
|
|
}
|
|
|
|
@Override // android.view.MenuItem.OnMenuItemClickListener
|
|
public final boolean onMenuItemClick(MenuItem menuItem) {
|
|
try {
|
|
if (this.b.getReturnType() == Boolean.TYPE) {
|
|
return ((Boolean) this.b.invoke(this.e, menuItem)).booleanValue();
|
|
}
|
|
this.b.invoke(this.e, menuItem);
|
|
return true;
|
|
} catch (Exception e) {
|
|
throw new RuntimeException(e);
|
|
}
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* loaded from: classes.dex */
|
|
public class LWm {
|
|
CharSequence A;
|
|
int B;
|
|
boolean C;
|
|
CharSequence D;
|
|
final JHJ E;
|
|
Menu I;
|
|
String f;
|
|
hbU g;
|
|
int i;
|
|
String j;
|
|
int k;
|
|
int l;
|
|
int m;
|
|
boolean n;
|
|
|
|
/* renamed from: o, reason: collision with root package name */
|
|
char f8218o;
|
|
int p;
|
|
boolean q;
|
|
CharSequence s;
|
|
boolean t;
|
|
int u;
|
|
String w;
|
|
char x;
|
|
int y;
|
|
CharSequence z;
|
|
ColorStateList r = null;
|
|
PorterDuff.Mode v = null;
|
|
int a = 0;
|
|
int d = 0;
|
|
int c = 0;
|
|
int b = 0;
|
|
boolean h = true;
|
|
boolean e = true;
|
|
|
|
public LWm(JHJ jhj, Menu menu) {
|
|
this.E = jhj;
|
|
this.I = menu;
|
|
}
|
|
|
|
final void em_(MenuItem menuItem) {
|
|
boolean z = true;
|
|
menuItem.setChecked(this.t).setVisible(this.C).setEnabled(this.q).setCheckable(this.l > 0).setTitleCondensed(this.D).setIcon(this.p);
|
|
int i = this.B;
|
|
if (i >= 0) {
|
|
menuItem.setShowAsAction(i);
|
|
}
|
|
if (this.w != null) {
|
|
if (this.E.c.isRestricted()) {
|
|
throw new IllegalStateException("The android:onClick attribute cannot be used within a restricted context");
|
|
}
|
|
menuItem.setOnMenuItemClickListener(new RVV(this.E.c(), this.w));
|
|
}
|
|
if (this.l >= 2) {
|
|
if (menuItem instanceof MenuItemImpl) {
|
|
MenuItemImpl menuItemImpl = (MenuItemImpl) menuItem;
|
|
menuItemImpl.a = (menuItemImpl.a & (-5)) | 4;
|
|
} else if (menuItem instanceof MenuItemWrapperICS) {
|
|
((MenuItemWrapperICS) menuItem).b();
|
|
}
|
|
}
|
|
String str = this.f;
|
|
if (str != null) {
|
|
menuItem.setActionView((View) b(str, JHJ.d, this.E.b));
|
|
} else {
|
|
z = false;
|
|
}
|
|
int i2 = this.i;
|
|
if (i2 > 0 && !z) {
|
|
menuItem.setActionView(i2);
|
|
}
|
|
hbU hbu = this.g;
|
|
if (hbu != null) {
|
|
qdX.rJ_(menuItem, hbu);
|
|
}
|
|
qdX.rL_(menuItem, this.s);
|
|
qdX.rP_(menuItem, this.z);
|
|
qdX.rK_(menuItem, this.f8218o, this.k);
|
|
qdX.rO_(menuItem, this.x, this.u);
|
|
PorterDuff.Mode mode = this.v;
|
|
if (mode != null) {
|
|
qdX.rN_(menuItem, mode);
|
|
}
|
|
ColorStateList colorStateList = this.r;
|
|
if (colorStateList != null) {
|
|
qdX.rM_(menuItem, colorStateList);
|
|
}
|
|
}
|
|
|
|
public final SubMenu en_() {
|
|
this.n = true;
|
|
SubMenu addSubMenu = this.I.addSubMenu(this.a, this.y, this.m, this.A);
|
|
em_(addSubMenu.getItem());
|
|
return addSubMenu;
|
|
}
|
|
|
|
final <T> T b(String str, Class<?>[] clsArr, Object[] objArr) {
|
|
try {
|
|
Constructor<?> constructor = Class.forName(str, false, this.E.c.getClassLoader()).getConstructor(clsArr);
|
|
constructor.setAccessible(true);
|
|
return (T) constructor.newInstance(objArr);
|
|
} catch (Exception unused) {
|
|
return null;
|
|
}
|
|
}
|
|
}
|
|
|
|
final Object c() {
|
|
if (this.i == null) {
|
|
Object obj = this.c;
|
|
if (!(obj instanceof Activity) && (obj instanceof ContextWrapper)) {
|
|
obj = ((ContextWrapper) obj).getBaseContext();
|
|
if (!(obj instanceof Activity) && (obj instanceof ContextWrapper)) {
|
|
obj = ((ContextWrapper) obj).getBaseContext();
|
|
if (!(obj instanceof Activity) && (obj instanceof ContextWrapper)) {
|
|
obj = e(((ContextWrapper) obj).getBaseContext());
|
|
}
|
|
}
|
|
}
|
|
this.i = obj;
|
|
}
|
|
return this.i;
|
|
}
|
|
}
|