package h; 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.appcompat.widget.i2; import androidx.appcompat.widget.j1; import androidx.core.view.c0; import java.io.IOException; import java.lang.reflect.Constructor; import java.lang.reflect.Method; import org.xmlpull.v1.XmlPullParserException; /* loaded from: classes.dex */ public class g extends MenuInflater { /* renamed from: e, reason: collision with root package name */ static final Class[] f9890e; /* renamed from: f, reason: collision with root package name */ static final Class[] f9891f; /* renamed from: a, reason: collision with root package name */ final Object[] f9892a; /* renamed from: b, reason: collision with root package name */ final Object[] f9893b; /* renamed from: c, reason: collision with root package name */ Context f9894c; /* renamed from: d, reason: collision with root package name */ private Object f9895d; private static class a implements MenuItem.OnMenuItemClickListener { /* renamed from: c, reason: collision with root package name */ private static final Class[] f9896c = {MenuItem.class}; /* renamed from: a, reason: collision with root package name */ private Object f9897a; /* renamed from: b, reason: collision with root package name */ private Method f9898b; public a(Object obj, String str) { this.f9897a = obj; Class cls = obj.getClass(); try { this.f9898b = cls.getMethod(str, f9896c); } catch (Exception e10) { InflateException inflateException = new InflateException("Couldn't resolve menu item onClick handler " + str + " in class " + cls.getName()); inflateException.initCause(e10); throw inflateException; } } @Override // android.view.MenuItem.OnMenuItemClickListener public boolean onMenuItemClick(MenuItem menuItem) { try { if (this.f9898b.getReturnType() == Boolean.TYPE) { return ((Boolean) this.f9898b.invoke(this.f9897a, menuItem)).booleanValue(); } this.f9898b.invoke(this.f9897a, menuItem); return true; } catch (Exception e10) { throw new RuntimeException(e10); } } } private class b { androidx.core.view.b A; private CharSequence B; private CharSequence C; private ColorStateList D = null; private PorterDuff.Mode E = null; /* renamed from: a, reason: collision with root package name */ private Menu f9899a; /* renamed from: b, reason: collision with root package name */ private int f9900b; /* renamed from: c, reason: collision with root package name */ private int f9901c; /* renamed from: d, reason: collision with root package name */ private int f9902d; /* renamed from: e, reason: collision with root package name */ private int f9903e; /* renamed from: f, reason: collision with root package name */ private boolean f9904f; /* renamed from: g, reason: collision with root package name */ private boolean f9905g; /* renamed from: h, reason: collision with root package name */ private boolean f9906h; /* renamed from: i, reason: collision with root package name */ private int f9907i; /* renamed from: j, reason: collision with root package name */ private int f9908j; /* renamed from: k, reason: collision with root package name */ private CharSequence f9909k; /* renamed from: l, reason: collision with root package name */ private CharSequence f9910l; /* renamed from: m, reason: collision with root package name */ private int f9911m; /* renamed from: n, reason: collision with root package name */ private char f9912n; /* renamed from: o, reason: collision with root package name */ private int f9913o; /* renamed from: p, reason: collision with root package name */ private char f9914p; /* renamed from: q, reason: collision with root package name */ private int f9915q; /* renamed from: r, reason: collision with root package name */ private int f9916r; /* renamed from: s, reason: collision with root package name */ private boolean f9917s; /* renamed from: t, reason: collision with root package name */ private boolean f9918t; /* renamed from: u, reason: collision with root package name */ private boolean f9919u; /* renamed from: v, reason: collision with root package name */ private int f9920v; /* renamed from: w, reason: collision with root package name */ private int f9921w; /* renamed from: x, reason: collision with root package name */ private String f9922x; /* renamed from: y, reason: collision with root package name */ private String f9923y; /* renamed from: z, reason: collision with root package name */ private String f9924z; public b(Menu menu) { this.f9899a = menu; h(); } private char c(String str) { if (str == null) { return (char) 0; } return str.charAt(0); } private Object e(String str, Class[] clsArr, Object[] objArr) { try { Constructor constructor = Class.forName(str, false, g.this.f9894c.getClassLoader()).getConstructor(clsArr); constructor.setAccessible(true); return constructor.newInstance(objArr); } catch (Exception e10) { Log.w("SupportMenuInflater", "Cannot instantiate class: " + str, e10); return null; } } private void i(MenuItem menuItem) { boolean z10 = false; menuItem.setChecked(this.f9917s).setVisible(this.f9918t).setEnabled(this.f9919u).setCheckable(this.f9916r >= 1).setTitleCondensed(this.f9910l).setIcon(this.f9911m); int i10 = this.f9920v; if (i10 >= 0) { menuItem.setShowAsAction(i10); } if (this.f9924z != null) { if (g.this.f9894c.isRestricted()) { throw new IllegalStateException("The android:onClick attribute cannot be used within a restricted context"); } menuItem.setOnMenuItemClickListener(new a(g.this.b(), this.f9924z)); } if (this.f9916r >= 2) { if (menuItem instanceof androidx.appcompat.view.menu.g) { ((androidx.appcompat.view.menu.g) menuItem).t(true); } else if (menuItem instanceof i.c) { ((i.c) menuItem).h(true); } } String str = this.f9922x; if (str != null) { menuItem.setActionView((View) e(str, g.f9890e, g.this.f9892a)); z10 = true; } int i11 = this.f9921w; if (i11 > 0) { if (z10) { Log.w("SupportMenuInflater", "Ignoring attribute 'itemActionViewLayout'. Action view already specified."); } else { menuItem.setActionView(i11); } } androidx.core.view.b bVar = this.A; if (bVar != null) { c0.a(menuItem, bVar); } c0.c(menuItem, this.B); c0.g(menuItem, this.C); c0.b(menuItem, this.f9912n, this.f9913o); c0.f(menuItem, this.f9914p, this.f9915q); PorterDuff.Mode mode = this.E; if (mode != null) { c0.e(menuItem, mode); } ColorStateList colorStateList = this.D; if (colorStateList != null) { c0.d(menuItem, colorStateList); } } public void a() { this.f9906h = true; i(this.f9899a.add(this.f9900b, this.f9907i, this.f9908j, this.f9909k)); } public SubMenu b() { this.f9906h = true; SubMenu addSubMenu = this.f9899a.addSubMenu(this.f9900b, this.f9907i, this.f9908j, this.f9909k); i(addSubMenu.getItem()); return addSubMenu; } public boolean d() { return this.f9906h; } public void f(AttributeSet attributeSet) { TypedArray obtainStyledAttributes = g.this.f9894c.obtainStyledAttributes(attributeSet, d.j.f8901r1); this.f9900b = obtainStyledAttributes.getResourceId(d.j.f8911t1, 0); this.f9901c = obtainStyledAttributes.getInt(d.j.f8921v1, 0); this.f9902d = obtainStyledAttributes.getInt(d.j.f8926w1, 0); this.f9903e = obtainStyledAttributes.getInt(d.j.f8931x1, 0); this.f9904f = obtainStyledAttributes.getBoolean(d.j.f8916u1, true); this.f9905g = obtainStyledAttributes.getBoolean(d.j.f8906s1, true); obtainStyledAttributes.recycle(); } public void g(AttributeSet attributeSet) { i2 u10 = i2.u(g.this.f9894c, attributeSet, d.j.f8936y1); this.f9907i = u10.n(d.j.B1, 0); this.f9908j = (u10.k(d.j.E1, this.f9901c) & (-65536)) | (u10.k(d.j.F1, this.f9902d) & 65535); this.f9909k = u10.p(d.j.G1); this.f9910l = u10.p(d.j.H1); this.f9911m = u10.n(d.j.f8941z1, 0); this.f9912n = c(u10.o(d.j.I1)); this.f9913o = u10.k(d.j.P1, 4096); this.f9914p = c(u10.o(d.j.J1)); this.f9915q = u10.k(d.j.T1, 4096); int i10 = d.j.K1; if (u10.s(i10)) { this.f9916r = u10.a(i10, false) ? 1 : 0; } else { this.f9916r = this.f9903e; } this.f9917s = u10.a(d.j.C1, false); this.f9918t = u10.a(d.j.D1, this.f9904f); this.f9919u = u10.a(d.j.A1, this.f9905g); this.f9920v = u10.k(d.j.U1, -1); this.f9924z = u10.o(d.j.L1); this.f9921w = u10.n(d.j.M1, 0); this.f9922x = u10.o(d.j.O1); String o10 = u10.o(d.j.N1); this.f9923y = o10; boolean z10 = o10 != null; if (z10 && this.f9921w == 0 && this.f9922x == null) { this.A = (androidx.core.view.b) e(o10, g.f9891f, g.this.f9893b); } else { if (z10) { Log.w("SupportMenuInflater", "Ignoring attribute 'actionProviderClass'. Action view already specified."); } this.A = null; } this.B = u10.p(d.j.Q1); this.C = u10.p(d.j.V1); int i11 = d.j.S1; if (u10.s(i11)) { this.E = j1.d(u10.k(i11, -1), this.E); } else { this.E = null; } int i12 = d.j.R1; if (u10.s(i12)) { this.D = u10.c(i12); } else { this.D = null; } u10.w(); this.f9906h = false; } public void h() { this.f9900b = 0; this.f9901c = 0; this.f9902d = 0; this.f9903e = 0; this.f9904f = true; this.f9905g = true; } } static { Class[] clsArr = {Context.class}; f9890e = clsArr; f9891f = clsArr; } public g(Context context) { super(context); this.f9894c = context; Object[] objArr = {context}; this.f9892a = objArr; this.f9893b = objArr; } private Object a(Object obj) { return obj instanceof Activity ? obj : obj instanceof ContextWrapper ? a(((ContextWrapper) obj).getBaseContext()) : obj; } /* JADX WARN: Code restructure failed: missing block: B:11:0x0048, code lost: if (r15 == 2) goto L41; */ /* JADX WARN: Code restructure failed: missing block: B:13:0x004b, code lost: if (r15 == 3) goto L20; */ /* JADX WARN: Code restructure failed: missing block: B:14:0x004f, code lost: r15 = r13.getName(); */ /* JADX WARN: Code restructure failed: missing block: B:15:0x0053, code lost: if (r7 == false) goto L25; */ /* JADX WARN: Code restructure failed: missing block: B:17:0x0059, code lost: if (r15.equals(r8) == false) goto L25; */ /* JADX WARN: Code restructure failed: missing block: B:18:0x005b, code lost: r8 = null; r7 = false; */ /* JADX WARN: Code restructure failed: missing block: B:20:0x00b9, code lost: r15 = r13.next(); */ /* JADX WARN: Code restructure failed: missing block: B:22:0x0062, code lost: if (r15.equals("group") == false) goto L28; */ /* JADX WARN: Code restructure failed: missing block: B:23:0x0064, code lost: r0.h(); */ /* JADX WARN: Code restructure failed: missing block: B:26:0x006c, code lost: if (r15.equals("item") == false) goto L38; */ /* JADX WARN: Code restructure failed: missing block: B:28:0x0072, code lost: if (r0.d() != false) goto L65; */ /* JADX WARN: Code restructure failed: missing block: B:29:0x0074, code lost: r15 = r0.A; */ /* JADX WARN: Code restructure failed: missing block: B:30:0x0076, code lost: if (r15 == null) goto L37; */ /* JADX WARN: Code restructure failed: missing block: B:32:0x007c, code lost: if (r15.a() == false) goto L37; */ /* JADX WARN: Code restructure failed: missing block: B:33:0x007e, code lost: r0.b(); */ /* JADX WARN: Code restructure failed: missing block: B:35:0x0082, code lost: r0.a(); */ /* JADX WARN: Code restructure failed: missing block: B:39:0x008a, code lost: if (r15.equals("menu") == false) goto L68; */ /* JADX WARN: Code restructure failed: missing block: B:40:0x008c, code lost: r6 = true; */ /* JADX WARN: Code restructure failed: missing block: B:44:0x008e, code lost: if (r7 == false) goto L43; */ /* JADX WARN: Code restructure failed: missing block: B:45:0x0091, code lost: r15 = r13.getName(); */ /* JADX WARN: Code restructure failed: missing block: B:46:0x0099, code lost: if (r15.equals("group") == false) goto L46; */ /* JADX WARN: Code restructure failed: missing block: B:47:0x009b, code lost: r0.f(r14); */ /* JADX WARN: Code restructure failed: missing block: B:50:0x00a3, code lost: if (r15.equals("item") == false) goto L49; */ /* JADX WARN: Code restructure failed: missing block: B:51:0x00a5, code lost: r0.g(r14); */ /* JADX WARN: Code restructure failed: missing block: B:54:0x00ad, code lost: if (r15.equals("menu") == false) goto L52; */ /* JADX WARN: Code restructure failed: missing block: B:55:0x00af, code lost: c(r13, r14, r0.b()); */ /* JADX WARN: Code restructure failed: missing block: B:57:0x00b7, code lost: r8 = r15; r7 = true; */ /* JADX WARN: Code restructure failed: missing block: B:62:0x00c5, code lost: throw new java.lang.RuntimeException("Unexpected end of document"); */ /* JADX WARN: Code restructure failed: missing block: B:65:0x00c6, code lost: return; */ /* JADX WARN: Code restructure failed: missing block: B:7:0x003b, code lost: r8 = null; r6 = false; r7 = false; */ /* JADX WARN: Code restructure failed: missing block: B:8:0x0040, code lost: if (r6 != false) goto L60; */ /* JADX WARN: Code restructure failed: missing block: B:9:0x0042, code lost: if (r15 == 1) goto L61; */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct code enable 'Show inconsistent code' option in preferences */ private void c(org.xmlpull.v1.XmlPullParser r13, android.util.AttributeSet r14, android.view.Menu r15) { /* r12 = this; h.g$b r0 = new h.g$b r0.(r15) int r15 = r13.getEventType() L9: r1 = 2 java.lang.String r2 = "menu" r3 = 1 if (r15 != r1) goto L35 java.lang.String r15 = r13.getName() boolean r4 = r15.equals(r2) if (r4 == 0) goto L1e int r15 = r13.next() goto L3b L1e: java.lang.RuntimeException r13 = new java.lang.RuntimeException java.lang.StringBuilder r14 = new java.lang.StringBuilder r14.() java.lang.String r0 = "Expecting menu, got " r14.append(r0) r14.append(r15) java.lang.String r14 = r14.toString() r13.(r14) throw r13 L35: int r15 = r13.next() if (r15 != r3) goto L9 L3b: r4 = 0 r5 = 0 r8 = r5 r6 = 0 r7 = 0 L40: if (r6 != 0) goto Lc6 if (r15 == r3) goto Lbe java.lang.String r9 = "item" java.lang.String r10 = "group" if (r15 == r1) goto L8e r11 = 3 if (r15 == r11) goto L4f goto Lb9 L4f: java.lang.String r15 = r13.getName() if (r7 == 0) goto L5e boolean r11 = r15.equals(r8) if (r11 == 0) goto L5e r8 = r5 r7 = 0 goto Lb9 L5e: boolean r10 = r15.equals(r10) if (r10 == 0) goto L68 r0.h() goto Lb9 L68: boolean r9 = r15.equals(r9) if (r9 == 0) goto L86 boolean r15 = r0.d() if (r15 != 0) goto Lb9 androidx.core.view.b r15 = r0.A if (r15 == 0) goto L82 boolean r15 = r15.a() if (r15 == 0) goto L82 r0.b() goto Lb9 L82: r0.a() goto Lb9 L86: boolean r15 = r15.equals(r2) if (r15 == 0) goto Lb9 r6 = 1 goto Lb9 L8e: if (r7 == 0) goto L91 goto Lb9 L91: java.lang.String r15 = r13.getName() boolean r10 = r15.equals(r10) if (r10 == 0) goto L9f r0.f(r14) goto Lb9 L9f: boolean r9 = r15.equals(r9) if (r9 == 0) goto La9 r0.g(r14) goto Lb9 La9: boolean r9 = r15.equals(r2) if (r9 == 0) goto Lb7 android.view.SubMenu r15 = r0.b() r12.c(r13, r14, r15) goto Lb9 Lb7: r8 = r15 r7 = 1 Lb9: int r15 = r13.next() goto L40 Lbe: java.lang.RuntimeException r13 = new java.lang.RuntimeException java.lang.String r14 = "Unexpected end of document" r13.(r14) throw r13 Lc6: return */ throw new UnsupportedOperationException("Method not decompiled: h.g.c(org.xmlpull.v1.XmlPullParser, android.util.AttributeSet, android.view.Menu):void"); } Object b() { if (this.f9895d == null) { this.f9895d = a(this.f9894c); } return this.f9895d; } @Override // android.view.MenuInflater public void inflate(int i10, Menu menu) { if (!(menu instanceof s.a)) { super.inflate(i10, menu); return; } XmlResourceParser xmlResourceParser = null; try { try { try { xmlResourceParser = this.f9894c.getResources().getLayout(i10); c(xmlResourceParser, Xml.asAttributeSet(xmlResourceParser), menu); } catch (IOException e10) { throw new InflateException("Error inflating menu XML", e10); } } catch (XmlPullParserException e11) { throw new InflateException("Error inflating menu XML", e11); } } finally { if (xmlResourceParser != null) { xmlResourceParser.close(); } } } }