package o; import android.content.Context; import android.graphics.drawable.Drawable; import android.text.TextUtils; import android.util.Base64; import android.view.LayoutInflater; import android.view.Menu; import android.view.View; import android.view.ViewGroup; import android.view.Window; import android.widget.ImageButton; import androidx.appcompat.view.menu.MenuItemImpl; import androidx.appcompat.widget.ActionMenuPresenter; import androidx.appcompat.widget.ActionMenuView; import androidx.appcompat.widget.Toolbar; import androidx.core.view.ViewCompat; import androidx.core.view.ViewPropertyAnimatorCompat; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import java.nio.charset.StandardCharsets; import o.InterfaceC15933jjG; import o.NoP; import o.SYO; /* renamed from: o.Rry, reason: case insensitive filesystem */ /* loaded from: classes.dex */ public final class C0926Rry implements InterfaceC15489grq { private static byte p = 6; private static int q = 1; private static int s; Window.Callback a; private ActionMenuPresenter b; boolean c; Toolbar d; CharSequence e; private View f; private CharSequence g; private int h; private int i; private Drawable j; private CharSequence k; private Drawable l; private Drawable m; private int n; /* renamed from: o, reason: collision with root package name */ private Drawable f8349o; private View r; private boolean t; private void u(String str, Object[] objArr) { byte[] decode = Base64.decode(str, 0); byte[] bArr = new byte[decode.length]; for (int i = 0; i < decode.length; i++) { bArr[i] = (byte) (decode[(decode.length - i) - 1] ^ p); } objArr[0] = new String(bArr, StandardCharsets.UTF_8); } public C0926Rry(Toolbar toolbar, boolean z) { this(toolbar, z, SYO.tOB.abc_action_bar_up_description); } private C0926Rry(Toolbar toolbar, boolean z, int i) { int i2; Drawable drawable; this.n = 0; this.i = 0; this.d = toolbar; this.e = toolbar.q; this.k = toolbar.l; this.t = this.e != null; ImageButton imageButton = toolbar.j; this.l = imageButton != null ? imageButton.getDrawable() : null; Context context = toolbar.getContext(); C0683McA c0683McA = new C0683McA(context, context.obtainStyledAttributes(null, SYO.ZqN.ActionBar, SYO.IeS.actionBarStyle, 0)); this.j = c0683McA.jL_(SYO.ZqN.ActionBar_homeAsUpIndicator); if (z) { CharSequence text = c0683McA.d.getText(SYO.ZqN.ActionBar_title); if (!TextUtils.isEmpty(text)) { this.t = true; b(text); } CharSequence text2 = c0683McA.d.getText(SYO.ZqN.ActionBar_subtitle); if (!TextUtils.isEmpty(text2)) { this.k = text2; if ((this.h & 8) != 0) { this.d.setSubtitle(text2); } } Drawable jL_ = c0683McA.jL_(SYO.ZqN.ActionBar_logo); if (jL_ != null) { this.m = jL_; t(); } Drawable jL_2 = c0683McA.jL_(SYO.ZqN.ActionBar_icon); if (jL_2 != null) { this.f8349o = jL_2; t(); } if (this.l == null && (drawable = this.j) != null) { this.l = drawable; p(); } e(c0683McA.d.getInt(SYO.ZqN.ActionBar_displayOptions, 0)); int resourceId = c0683McA.d.getResourceId(SYO.ZqN.ActionBar_customNavigationLayout, 0); if (resourceId != 0) { e(LayoutInflater.from(this.d.getContext()).inflate(resourceId, (ViewGroup) this.d, false)); e(this.h | 16); } int layoutDimension = c0683McA.d.getLayoutDimension(SYO.ZqN.ActionBar_height, 0); if (layoutDimension > 0) { ViewGroup.LayoutParams layoutParams = this.d.getLayoutParams(); layoutParams.height = layoutDimension; this.d.setLayoutParams(layoutParams); } int dimensionPixelOffset = c0683McA.d.getDimensionPixelOffset(SYO.ZqN.ActionBar_contentInsetStart, -1); int dimensionPixelOffset2 = c0683McA.d.getDimensionPixelOffset(SYO.ZqN.ActionBar_contentInsetEnd, -1); if (dimensionPixelOffset >= 0 || dimensionPixelOffset2 >= 0) { this.d.setContentInsetsRelative(Math.max(dimensionPixelOffset, 0), Math.max(dimensionPixelOffset2, 0)); } int resourceId2 = c0683McA.d.getResourceId(SYO.ZqN.ActionBar_titleTextStyle, 0); if (resourceId2 != 0) { Toolbar toolbar2 = this.d; toolbar2.setTitleTextAppearance(toolbar2.getContext(), resourceId2); } int resourceId3 = c0683McA.d.getResourceId(SYO.ZqN.ActionBar_subtitleTextStyle, 0); if (resourceId3 != 0) { Toolbar toolbar3 = this.d; toolbar3.setSubtitleTextAppearance(toolbar3.getContext(), resourceId3); } int resourceId4 = c0683McA.d.getResourceId(SYO.ZqN.ActionBar_popupTheme, 0); if (resourceId4 != 0) { this.d.setPopupTheme(resourceId4); } } else { ImageButton imageButton2 = this.d.j; if ((imageButton2 != null ? imageButton2.getDrawable() : null) != null) { ImageButton imageButton3 = this.d.j; this.j = imageButton3 != null ? imageButton3.getDrawable() : null; i2 = 15; } else { i2 = 11; } this.h = i2; } c0683McA.d.recycle(); if (i != this.i) { this.i = i; ImageButton imageButton4 = this.d.j; if (TextUtils.isEmpty(imageButton4 != null ? imageButton4.getContentDescription() : null)) { c(this.i); } } ImageButton imageButton5 = this.d.j; this.g = imageButton5 != null ? imageButton5.getContentDescription() : null; this.d.setNavigationOnClickListener(new View.OnClickListener(this) { // from class: o.Rry.3 final DyP b; final C0926Rry d; { this.d = this; this.b = new DyP(this.d.getContext(), this.e); } @Override // android.view.View.OnClickListener public final void onClick(View view) { if (this.d.a == null || !this.d.c) { return; } this.d.a.onMenuItemSelected(0, this.b); } }); } @Override // o.InterfaceC15489grq public final Context c() { return this.d.getContext(); } @Override // o.InterfaceC15489grq public final boolean f() { Toolbar.RVV rvv = this.d.a; return (rvv == null || rvv.b == null) ? false : true; } @Override // o.InterfaceC15489grq public final void d() { Toolbar.RVV rvv = this.d.a; MenuItemImpl menuItemImpl = rvv == null ? null : rvv.b; if (menuItemImpl != null) { menuItemImpl.collapseActionView(); } } @Override // o.InterfaceC15489grq public final void c(CharSequence charSequence) { if (this.t) { return; } b(charSequence); } @Override // o.InterfaceC15489grq public final void a(CharSequence charSequence) { this.t = true; b(charSequence); } private void b(CharSequence charSequence) { this.e = charSequence; if ((this.h & 8) != 0) { this.d.setTitle(charSequence); if (this.t) { ViewCompat.d(this.d.getRootView(), charSequence); } } } @Override // o.InterfaceC15489grq public final void a(int i) { this.f8349o = i != 0 ? AgY.dT_(this.d.getContext(), i) : null; t(); } @Override // o.InterfaceC15489grq public final void jX_(Drawable drawable) { this.f8349o = drawable; t(); } @Override // o.InterfaceC15489grq public final void d(int i) { this.m = i != 0 ? AgY.dT_(this.d.getContext(), i) : null; t(); } private void t() { Drawable drawable; int i = this.h; if ((i & 2) == 0) { drawable = null; } else if ((i & 1) == 0 || (drawable = this.m) == null) { drawable = this.f8349o; } this.d.setLogo(drawable); } @Override // o.InterfaceC15489grq public final boolean k() { return this.d.f(); } @Override // o.InterfaceC15489grq public final boolean o() { ActionMenuPresenter actionMenuPresenter; ActionMenuView actionMenuView = this.d.f; return (actionMenuView == null || (actionMenuPresenter = actionMenuView.b) == null || (actionMenuPresenter.s == null && !actionMenuPresenter.d())) ? false : true; } @Override // o.InterfaceC15489grq public final boolean n() { return this.d.h(); } @Override // o.InterfaceC15489grq public final boolean h() { ActionMenuPresenter actionMenuPresenter; ActionMenuView actionMenuView = this.d.f; return (actionMenuView == null || (actionMenuPresenter = actionMenuView.b) == null || !actionMenuPresenter.c()) ? false : true; } @Override // o.InterfaceC15489grq public final void jY_(Menu menu, InterfaceC15933jjG.Sts sts) { if (this.b == null) { ActionMenuPresenter actionMenuPresenter = new ActionMenuPresenter(this.d.getContext()); this.b = actionMenuPresenter; actionMenuPresenter.e = SYO.saX.action_menu_presenter; } this.b.a = sts; this.d.setMenu((NoP) menu, this.b); } @Override // o.InterfaceC15489grq public final void e() { ActionMenuPresenter actionMenuPresenter; ActionMenuView actionMenuView = this.d.f; if (actionMenuView == null || (actionMenuPresenter = actionMenuView.b) == null) { return; } actionMenuPresenter.c(); ActionMenuPresenter.HBt hBt = actionMenuPresenter.j; if (hBt != null) { hBt.a(); } } @Override // o.InterfaceC15489grq public final void e(int i) { View view; int i2 = this.h ^ i; this.h = i; if (i2 != 0) { if ((i2 & 4) != 0) { if ((i & 4) != 0) { q(); } p(); } if ((i2 & 3) != 0) { t(); } if ((i2 & 8) != 0) { if ((i & 8) != 0) { this.d.setTitle(this.e); this.d.setSubtitle(this.k); } else { this.d.setTitle((CharSequence) null); this.d.setSubtitle((CharSequence) null); } } if ((i2 & 16) == 0 || (view = this.f) == null) { return; } if ((i & 16) != 0) { this.d.addView(view); } else { this.d.removeView(view); } } } @Override // o.InterfaceC15489grq public final void m() { this.r = null; } @Override // o.InterfaceC15489grq public final void a(boolean z) { this.d.setCollapsible(z); } @Override // o.InterfaceC15489grq public final void e(View view) { View view2 = this.f; if (view2 != null && (this.h & 16) != 0) { this.d.removeView(view2); } this.f = view; if (view == null || (this.h & 16) == 0) { return; } this.d.addView(view); } @Override // o.InterfaceC15489grq public final ViewPropertyAnimatorCompat c(int i, long j) { return ViewCompat.b(this.d).b(i == 0 ? 1.0f : BitmapDescriptorFactory.HUE_RED).b(j).b(new PBh(this, i) { // from class: o.Rry.2 final int c; final C0926Rry d; private boolean e = false; { this.d = this; this.c = i; } @Override // o.PBh, o.InterfaceC15687hkl public final void e(View view) { this.d.d.setVisibility(0); } @Override // o.PBh, o.InterfaceC15687hkl public final void d(View view) { if (this.e) { return; } this.d.d.setVisibility(this.c); } @Override // o.PBh, o.InterfaceC15687hkl public final void b(View view) { this.e = true; } }); } @Override // o.InterfaceC15489grq public final void jZ_(Drawable drawable) { this.l = drawable; p(); } private void p() { if ((this.h & 4) != 0) { Toolbar toolbar = this.d; Drawable drawable = this.l; if (drawable == null) { drawable = this.j; } toolbar.setNavigationIcon(drawable); return; } this.d.setNavigationIcon((Drawable) null); } /* JADX WARN: Code restructure failed: missing block: B:14:0x0018, code lost: r5 = null; */ /* JADX WARN: Code restructure failed: missing block: B:15:0x0016, code lost: if (r5 == 0) goto L8; */ /* JADX WARN: Code restructure failed: missing block: B:4:0x0013, code lost: if (r5 == 0) goto L8; */ /* JADX WARN: Code restructure failed: missing block: B:5:0x001a, code lost: r5 = r4.d.getContext().getString(r5); */ /* JADX WARN: Code restructure failed: missing block: B:6:0x002a, code lost: if (r5.startsWith(",*,)") == false) goto L12; */ /* JADX WARN: Code restructure failed: missing block: B:7:0x002c, code lost: r1 = new java.lang.Object[1]; u(r5.substring(4), r1); r5 = ((java.lang.String) r1[0]).intern(); */ @Override // o.InterfaceC15489grq /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public final void c(int r5) { /* r4 = this; r0 = 2 int r1 = r0 % r0 int r1 = o.C0926Rry.s int r1 = r1 + 47 int r2 = r1 % 128 o.C0926Rry.q = r2 int r1 = r1 % r0 r2 = 0 r3 = 0 if (r1 != 0) goto L16 r1 = 56 int r1 = r1 / r2 if (r5 != 0) goto L1a goto L18 L16: if (r5 != 0) goto L1a L18: r5 = r3 goto L3f L1a: androidx.appcompat.widget.Toolbar r1 = r4.d android.content.Context r1 = r1.getContext() java.lang.String r5 = r1.getString(r5) java.lang.String r1 = ",*,)" boolean r1 = r5.startsWith(r1) if (r1 == 0) goto L3f r1 = 4 java.lang.String r5 = r5.substring(r1) r1 = 1 java.lang.Object[] r1 = new java.lang.Object[r1] r4.u(r5, r1) r5 = r1[r2] java.lang.String r5 = (java.lang.String) r5 java.lang.String r5 = r5.intern() L3f: r4.g = r5 r4.q() int r5 = o.C0926Rry.s int r5 = r5 + 71 int r1 = r5 % 128 o.C0926Rry.q = r1 int r5 = r5 % r0 if (r5 == 0) goto L50 return L50: r3.hashCode() throw r3 */ throw new UnsupportedOperationException("Method not decompiled: o.C0926Rry.c(int):void"); } private void q() { if ((this.h & 4) != 0) { if (TextUtils.isEmpty(this.g)) { this.d.setNavigationContentDescription(this.i); } else { this.d.setNavigationContentDescription(this.g); } } } @Override // o.InterfaceC15489grq public final void b(int i) { this.d.setVisibility(i); } @Override // o.InterfaceC15489grq public final void d(InterfaceC15933jjG.Sts sts, NoP.Sts sts2) { this.d.setMenuCallbacks(sts, sts2); } @Override // o.InterfaceC15489grq public final Menu jV_() { return this.d.jO_(); } @Override // o.InterfaceC15489grq public final boolean a() { ActionMenuView actionMenuView; Toolbar toolbar = this.d; return toolbar.getVisibility() == 0 && (actionMenuView = toolbar.f) != null && actionMenuView.e; } @Override // o.InterfaceC15489grq public final void ka_(Window.Callback callback) { this.a = callback; } @Override // o.InterfaceC15489grq public final void l() { this.c = true; } @Override // o.InterfaceC15489grq public final ViewGroup jW_() { return this.d; } @Override // o.InterfaceC15489grq public final int i() { return this.n; } @Override // o.InterfaceC15489grq public final int b() { return this.h; } }