package p010d; import android.app.Activity; import android.app.Dialog; import android.content.Context; import android.content.res.Configuration; import android.content.res.TypedArray; import android.util.TypedValue; import android.view.ContextThemeWrapper; import android.view.KeyCharacterMap; import android.view.KeyEvent; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.animation.AccelerateInterpolator; import android.view.animation.DecelerateInterpolator; import android.view.animation.Interpolator; import androidx.appcompat.view.menu.C0103e; import androidx.appcompat.widget.ActionBarContainer; import androidx.appcompat.widget.ActionBarContextView; import androidx.appcompat.widget.ActionBarOverlayLayout; import androidx.appcompat.widget.C0175d; import androidx.appcompat.widget.Toolbar; import java.lang.ref.WeakReference; import java.util.ArrayList; import p007c.C0485a; import p007c.C0490f; import p007c.C0494j; import p010d.AbstractC0521a; import p022h.AbstractC0743b; import p022h.C0742a; import p022h.C0751g; import p022h.C0754h; import p023h0.C0829h1; import p023h0.C0875k4; import p023h0.C0898n4; import p023h0.InterfaceC0891m4; import p023h0.InterfaceC0905o4; import p028j.InterfaceC1110h2; /* renamed from: d.i0 */ /* loaded from: classes.dex */ public class C0575i0 extends AbstractC0521a implements ActionBarOverlayLayout.InterfaceC0125d { /* renamed from: E */ public static final Interpolator f2077E = new AccelerateInterpolator(); /* renamed from: F */ public static final Interpolator f2078F = new DecelerateInterpolator(); /* renamed from: A */ public boolean f2079A; /* renamed from: a */ public Context f2083a; /* renamed from: b */ public Context f2084b; /* renamed from: c */ public Activity f2085c; /* renamed from: d */ public ActionBarOverlayLayout f2086d; /* renamed from: e */ public ActionBarContainer f2087e; /* renamed from: f */ public InterfaceC1110h2 f2088f; /* renamed from: g */ public ActionBarContextView f2089g; /* renamed from: h */ public View f2090h; /* renamed from: i */ public C0175d f2091i; /* renamed from: l */ public boolean f2094l; /* renamed from: m */ public C0579d f2095m; /* renamed from: n */ public AbstractC0743b f2096n; /* renamed from: o */ public AbstractC0743b.InterfaceC0744a f2097o; /* renamed from: p */ public boolean f2098p; /* renamed from: r */ public boolean f2100r; /* renamed from: u */ public boolean f2103u; /* renamed from: v */ public boolean f2104v; /* renamed from: w */ public boolean f2105w; /* renamed from: y */ public C0754h f2107y; /* renamed from: z */ public boolean f2108z; /* renamed from: j */ public ArrayList f2092j = new ArrayList<>(); /* renamed from: k */ public int f2093k = -1; /* renamed from: q */ public ArrayList f2099q = new ArrayList<>(); /* renamed from: s */ public int f2101s = 0; /* renamed from: t */ public boolean f2102t = true; /* renamed from: x */ public boolean f2106x = true; /* renamed from: B */ public final InterfaceC0891m4 f2080B = new C0576a(); /* renamed from: C */ public final InterfaceC0891m4 f2081C = new C0577b(); /* renamed from: D */ public final InterfaceC0905o4 f2082D = new C0578c(); /* renamed from: d.i0$a */ /* loaded from: classes.dex */ public class C0576a extends C0898n4 { public C0576a() { } @Override // p023h0.InterfaceC0891m4 /* renamed from: a */ public void mo2293a(View view) { View view2; C0575i0 c0575i0 = C0575i0.this; if (c0575i0.f2102t && (view2 = c0575i0.f2090h) != null) { view2.setTranslationY(0.0f); C0575i0.this.f2087e.setTranslationY(0.0f); } C0575i0.this.f2087e.setVisibility(8); C0575i0.this.f2087e.setTransitioning(false); C0575i0 c0575i02 = C0575i0.this; c0575i02.f2107y = null; c0575i02.m3338x(); ActionBarOverlayLayout actionBarOverlayLayout = C0575i0.this.f2086d; if (actionBarOverlayLayout != null) { C0829h1.m2851L(actionBarOverlayLayout); } } } /* renamed from: d.i0$b */ /* loaded from: classes.dex */ public class C0577b extends C0898n4 { public C0577b() { } @Override // p023h0.InterfaceC0891m4 /* renamed from: a */ public void mo2293a(View view) { C0575i0 c0575i0 = C0575i0.this; c0575i0.f2107y = null; c0575i0.f2087e.requestLayout(); } } /* renamed from: d.i0$c */ /* loaded from: classes.dex */ public class C0578c implements InterfaceC0905o4 { public C0578c() { } @Override // p023h0.InterfaceC0905o4 /* renamed from: a */ public void mo2613a(View view) { ((View) C0575i0.this.f2087e.getParent()).invalidate(); } } /* renamed from: d.i0$d */ /* loaded from: classes.dex */ public class C0579d extends AbstractC0743b implements C0103e.InterfaceC0104a { /* renamed from: f */ public final Context f2112f; /* renamed from: g */ public final C0103e f2113g; /* renamed from: h */ public AbstractC0743b.InterfaceC0744a f2114h; /* renamed from: i */ public WeakReference f2115i; public C0579d(Context context, AbstractC0743b.InterfaceC0744a interfaceC0744a) { this.f2112f = context; this.f2114h = interfaceC0744a; C0103e m4899S = new C0103e(context).m4899S(1); this.f2113g = m4899S; m4899S.mo4815R(this); } @Override // androidx.appcompat.view.menu.C0103e.InterfaceC0104a /* renamed from: a */ public boolean mo3009a(C0103e c0103e, MenuItem menuItem) { AbstractC0743b.InterfaceC0744a interfaceC0744a = this.f2114h; if (interfaceC0744a != null) { return interfaceC0744a.mo2993a(this, menuItem); } return false; } @Override // androidx.appcompat.view.menu.C0103e.InterfaceC0104a /* renamed from: b */ public void mo3008b(C0103e c0103e) { if (this.f2114h == null) { return; } mo3001k(); C0575i0.this.f2089g.m4801l(); } @Override // p022h.AbstractC0743b /* renamed from: c */ public void mo3007c() { C0575i0 c0575i0 = C0575i0.this; if (c0575i0.f2095m != this) { return; } if (C0575i0.m3339w(c0575i0.f2103u, c0575i0.f2104v, false)) { this.f2114h.mo2990d(this); } else { C0575i0 c0575i02 = C0575i0.this; c0575i02.f2096n = this; c0575i02.f2097o = this.f2114h; } this.f2114h = null; C0575i0.this.m3340v(false); C0575i0.this.f2089g.m4806g(); C0575i0 c0575i03 = C0575i0.this; c0575i03.f2086d.setHideOnContentScrollEnabled(c0575i03.f2079A); C0575i0.this.f2095m = null; } @Override // p022h.AbstractC0743b /* renamed from: d */ public View mo3006d() { WeakReference weakReference = this.f2115i; if (weakReference != null) { return weakReference.get(); } return null; } @Override // p022h.AbstractC0743b /* renamed from: e */ public Menu mo3005e() { return this.f2113g; } @Override // p022h.AbstractC0743b /* renamed from: f */ public MenuInflater mo3004f() { return new C0751g(this.f2112f); } @Override // p022h.AbstractC0743b /* renamed from: g */ public CharSequence mo3003g() { return C0575i0.this.f2089g.getSubtitle(); } @Override // p022h.AbstractC0743b /* renamed from: i */ public CharSequence mo3002i() { return C0575i0.this.f2089g.getTitle(); } @Override // p022h.AbstractC0743b /* renamed from: k */ public void mo3001k() { if (C0575i0.this.f2095m != this) { return; } this.f2113g.m4884d0(); try { this.f2114h.mo2991c(this, this.f2113g); } finally { this.f2113g.m4886c0(); } } @Override // p022h.AbstractC0743b /* renamed from: l */ public boolean mo3000l() { return C0575i0.this.f2089g.m4803j(); } @Override // p022h.AbstractC0743b /* renamed from: m */ public void mo2999m(View view) { C0575i0.this.f2089g.setCustomView(view); this.f2115i = new WeakReference<>(view); } @Override // p022h.AbstractC0743b /* renamed from: n */ public void mo2998n(int i) { mo2997o(C0575i0.this.f2083a.getResources().getString(i)); } @Override // p022h.AbstractC0743b /* renamed from: o */ public void mo2997o(CharSequence charSequence) { C0575i0.this.f2089g.setSubtitle(charSequence); } @Override // p022h.AbstractC0743b /* renamed from: q */ public void mo2996q(int i) { mo2995r(C0575i0.this.f2083a.getResources().getString(i)); } @Override // p022h.AbstractC0743b /* renamed from: r */ public void mo2995r(CharSequence charSequence) { C0575i0.this.f2089g.setTitle(charSequence); } @Override // p022h.AbstractC0743b /* renamed from: s */ public void mo2994s(boolean z) { super.mo2994s(z); C0575i0.this.f2089g.setTitleOptional(z); } /* renamed from: t */ public boolean m3335t() { this.f2113g.m4884d0(); try { return this.f2114h.mo2992b(this, this.f2113g); } finally { this.f2113g.m4886c0(); } } } public C0575i0(Activity activity, boolean z) { this.f2085c = activity; View decorView = activity.getWindow().getDecorView(); m3366D(decorView); if (z) { return; } this.f2090h = decorView.findViewById(16908290); } public C0575i0(Dialog dialog) { m3366D(dialog.getWindow().getDecorView()); } /* renamed from: w */ public static boolean m3339w(boolean z, boolean z2, boolean z3) { if (z3) { return true; } return (z || z2) ? false : true; } /* renamed from: A */ public final InterfaceC1110h2 m3369A(View view) { if (view instanceof InterfaceC1110h2) { return (InterfaceC1110h2) view; } if (view instanceof Toolbar) { return ((Toolbar) view).getWrapper(); } StringBuilder sb = new StringBuilder(); sb.append("Can't make a decor toolbar out of "); sb.append(view != null ? view.getClass().getSimpleName() : "null"); throw new IllegalStateException(sb.toString()); } /* renamed from: B */ public int m3368B() { return this.f2088f.mo2135o(); } /* renamed from: C */ public final void m3367C() { if (this.f2105w) { this.f2105w = false; ActionBarOverlayLayout actionBarOverlayLayout = this.f2086d; if (actionBarOverlayLayout != null) { actionBarOverlayLayout.setShowingForActionMode(false); } m3357M(false); } } /* renamed from: D */ public final void m3366D(View view) { ActionBarOverlayLayout actionBarOverlayLayout = (ActionBarOverlayLayout) view.findViewById(C0490f.decor_content_parent); this.f2086d = actionBarOverlayLayout; if (actionBarOverlayLayout != null) { actionBarOverlayLayout.setActionBarVisibilityCallback(this); } this.f2088f = m3369A(view.findViewById(C0490f.action_bar)); this.f2089g = (ActionBarContextView) view.findViewById(C0490f.action_context_bar); ActionBarContainer actionBarContainer = (ActionBarContainer) view.findViewById(C0490f.action_bar_container); this.f2087e = actionBarContainer; InterfaceC1110h2 interfaceC1110h2 = this.f2088f; if (interfaceC1110h2 == null || this.f2089g == null || actionBarContainer == null) { throw new IllegalStateException(getClass().getSimpleName() + " can only be used with a compatible window decor layout"); } this.f2083a = interfaceC1110h2.mo2146d(); boolean z = (this.f2088f.mo2140j() & 4) != 0; if (z) { this.f2094l = true; } C0742a m3026b = C0742a.m3026b(this.f2083a); m3360J(m3026b.m3027a() || z); m3362H(m3026b.m3021g()); TypedArray obtainStyledAttributes = this.f2083a.obtainStyledAttributes(null, C0494j.f1801a, C0485a.actionBarStyle, 0); if (obtainStyledAttributes.getBoolean(C0494j.f1851k, false)) { m3361I(true); } int dimensionPixelSize = obtainStyledAttributes.getDimensionPixelSize(C0494j.f1841i, 0); if (dimensionPixelSize != 0) { m3363G(dimensionPixelSize); } obtainStyledAttributes.recycle(); } /* renamed from: E */ public void m3365E(boolean z) { m3364F(z ? 4 : 0, 4); } /* renamed from: F */ public void m3364F(int i, int i2) { int mo2140j = this.f2088f.mo2140j(); if ((i2 & 4) != 0) { this.f2094l = true; } this.f2088f.mo2129u((i & i2) | ((i2 ^ (-1)) & mo2140j)); } /* renamed from: G */ public void m3363G(float f) { C0829h1.m2842U(this.f2087e, f); } /* renamed from: H */ public final void m3362H(boolean z) { this.f2100r = z; if (z) { this.f2087e.setTabContainer(null); this.f2088f.mo2137m(this.f2091i); } else { this.f2088f.mo2137m(null); this.f2087e.setTabContainer(this.f2091i); } boolean z2 = true; boolean z3 = m3368B() == 2; C0175d c0175d = this.f2091i; if (c0175d != null) { if (z3) { c0175d.setVisibility(0); ActionBarOverlayLayout actionBarOverlayLayout = this.f2086d; if (actionBarOverlayLayout != null) { C0829h1.m2851L(actionBarOverlayLayout); } } else { c0175d.setVisibility(8); } } this.f2088f.mo2130t(!this.f2100r && z3); this.f2086d.setHasNonEmbeddedTabs((this.f2100r || !z3) ? false : false); } /* renamed from: I */ public void m3361I(boolean z) { if (z && !this.f2086d.m4791w()) { throw new IllegalStateException("Action bar must be in overlay mode (Window.FEATURE_OVERLAY_ACTION_BAR) to enable hide on content scroll"); } this.f2079A = z; this.f2086d.setHideOnContentScrollEnabled(z); } /* renamed from: J */ public void m3360J(boolean z) { this.f2088f.mo2136n(z); } /* renamed from: K */ public final boolean m3359K() { return C0829h1.m2861B(this.f2087e); } /* renamed from: L */ public final void m3358L() { if (this.f2105w) { return; } this.f2105w = true; ActionBarOverlayLayout actionBarOverlayLayout = this.f2086d; if (actionBarOverlayLayout != null) { actionBarOverlayLayout.setShowingForActionMode(true); } m3357M(false); } /* renamed from: M */ public final void m3357M(boolean z) { if (m3339w(this.f2103u, this.f2104v, this.f2105w)) { if (this.f2106x) { return; } this.f2106x = true; m3336z(z); } else if (this.f2106x) { this.f2106x = false; m3337y(z); } } @Override // androidx.appcompat.widget.ActionBarOverlayLayout.InterfaceC0125d /* renamed from: a */ public void mo3356a(boolean z) { this.f2102t = z; } @Override // androidx.appcompat.widget.ActionBarOverlayLayout.InterfaceC0125d /* renamed from: b */ public void mo3355b() { if (this.f2104v) { this.f2104v = false; m3357M(true); } } @Override // androidx.appcompat.widget.ActionBarOverlayLayout.InterfaceC0125d /* renamed from: c */ public void mo3354c() { C0754h c0754h = this.f2107y; if (c0754h != null) { c0754h.m2975a(); this.f2107y = null; } } @Override // androidx.appcompat.widget.ActionBarOverlayLayout.InterfaceC0125d /* renamed from: d */ public void mo3353d(int i) { this.f2101s = i; } @Override // androidx.appcompat.widget.ActionBarOverlayLayout.InterfaceC0125d /* renamed from: e */ public void mo3352e() { if (this.f2104v) { return; } this.f2104v = true; m3357M(true); } @Override // androidx.appcompat.widget.ActionBarOverlayLayout.InterfaceC0125d /* renamed from: f */ public void mo3351f() { } @Override // p010d.AbstractC0521a /* renamed from: h */ public boolean mo3350h() { InterfaceC1110h2 interfaceC1110h2 = this.f2088f; if (interfaceC1110h2 == null || !interfaceC1110h2.mo2132r()) { return false; } this.f2088f.collapseActionView(); return true; } @Override // p010d.AbstractC0521a /* renamed from: i */ public void mo3349i(boolean z) { if (z == this.f2098p) { return; } this.f2098p = z; int size = this.f2099q.size(); for (int i = 0; i < size; i++) { this.f2099q.get(i).onMenuVisibilityChanged(z); } } @Override // p010d.AbstractC0521a /* renamed from: j */ public int mo3348j() { return this.f2088f.mo2140j(); } @Override // p010d.AbstractC0521a /* renamed from: k */ public Context mo3347k() { if (this.f2084b == null) { TypedValue typedValue = new TypedValue(); this.f2083a.getTheme().resolveAttribute(C0485a.actionBarWidgetTheme, typedValue, true); int i = typedValue.resourceId; if (i != 0) { this.f2084b = new ContextThemeWrapper(this.f2083a, i); } else { this.f2084b = this.f2083a; } } return this.f2084b; } @Override // p010d.AbstractC0521a /* renamed from: m */ public void mo3346m(Configuration configuration) { m3362H(C0742a.m3026b(this.f2083a).m3021g()); } @Override // p010d.AbstractC0521a /* renamed from: o */ public boolean mo3345o(int i, KeyEvent keyEvent) { Menu mo3005e; C0579d c0579d = this.f2095m; if (c0579d == null || (mo3005e = c0579d.mo3005e()) == null) { return false; } mo3005e.setQwertyMode(KeyCharacterMap.load(keyEvent != null ? keyEvent.getDeviceId() : -1).getKeyboardType() != 1); return mo3005e.performShortcut(i, keyEvent, 0); } @Override // p010d.AbstractC0521a /* renamed from: r */ public void mo3344r(boolean z) { if (this.f2094l) { return; } m3365E(z); } @Override // p010d.AbstractC0521a /* renamed from: s */ public void mo3343s(boolean z) { C0754h c0754h; this.f2108z = z; if (z || (c0754h = this.f2107y) == null) { return; } c0754h.m2975a(); } @Override // p010d.AbstractC0521a /* renamed from: t */ public void mo3342t(CharSequence charSequence) { this.f2088f.setWindowTitle(charSequence); } @Override // p010d.AbstractC0521a /* renamed from: u */ public AbstractC0743b mo3341u(AbstractC0743b.InterfaceC0744a interfaceC0744a) { C0579d c0579d = this.f2095m; if (c0579d != null) { c0579d.mo3007c(); } this.f2086d.setHideOnContentScrollEnabled(false); this.f2089g.m4802k(); C0579d c0579d2 = new C0579d(this.f2089g.getContext(), interfaceC0744a); if (c0579d2.m3335t()) { this.f2095m = c0579d2; c0579d2.mo3001k(); this.f2089g.m4805h(c0579d2); m3340v(true); return c0579d2; } return null; } /* renamed from: v */ public void m3340v(boolean z) { C0875k4 mo2134p; C0875k4 mo2294f; if (z) { m3358L(); } else { m3367C(); } if (!m3359K()) { if (z) { this.f2088f.mo2139k(4); this.f2089g.setVisibility(0); return; } this.f2088f.mo2139k(0); this.f2089g.setVisibility(8); return; } if (z) { mo2294f = this.f2088f.mo2134p(4, 100L); mo2134p = this.f2089g.mo2294f(0, 200L); } else { mo2134p = this.f2088f.mo2134p(0, 200L); mo2294f = this.f2089g.mo2294f(8, 100L); } C0754h c0754h = new C0754h(); c0754h.m2972d(mo2294f, mo2134p); c0754h.m2968h(); } /* renamed from: x */ public void m3338x() { AbstractC0743b.InterfaceC0744a interfaceC0744a = this.f2097o; if (interfaceC0744a != null) { interfaceC0744a.mo2990d(this.f2096n); this.f2096n = null; this.f2097o = null; } } /* renamed from: y */ public void m3337y(boolean z) { View view; int[] iArr; C0754h c0754h = this.f2107y; if (c0754h != null) { c0754h.m2975a(); } if (this.f2101s != 0 || (!this.f2108z && !z)) { this.f2080B.mo2293a(null); return; } this.f2087e.setAlpha(1.0f); this.f2087e.setTransitioning(true); C0754h c0754h2 = new C0754h(); float f = -this.f2087e.getHeight(); if (z) { this.f2087e.getLocationInWindow(new int[]{0, 0}); f -= iArr[1]; } C0875k4 m2640m = C0829h1.m2832c(this.f2087e).m2640m(f); m2640m.m2642k(this.f2082D); c0754h2.m2973c(m2640m); if (this.f2102t && (view = this.f2090h) != null) { c0754h2.m2973c(C0829h1.m2832c(view).m2640m(f)); } c0754h2.m2970f(f2077E); c0754h2.m2971e(250L); c0754h2.m2969g(this.f2080B); this.f2107y = c0754h2; c0754h2.m2968h(); } /* renamed from: z */ public void m3336z(boolean z) { View view; View view2; int[] iArr; C0754h c0754h = this.f2107y; if (c0754h != null) { c0754h.m2975a(); } this.f2087e.setVisibility(0); if (this.f2101s == 0 && (this.f2108z || z)) { this.f2087e.setTranslationY(0.0f); float f = -this.f2087e.getHeight(); if (z) { this.f2087e.getLocationInWindow(new int[]{0, 0}); f -= iArr[1]; } this.f2087e.setTranslationY(f); C0754h c0754h2 = new C0754h(); C0875k4 m2640m = C0829h1.m2832c(this.f2087e).m2640m(0.0f); m2640m.m2642k(this.f2082D); c0754h2.m2973c(m2640m); if (this.f2102t && (view2 = this.f2090h) != null) { view2.setTranslationY(f); c0754h2.m2973c(C0829h1.m2832c(this.f2090h).m2640m(0.0f)); } c0754h2.m2970f(f2078F); c0754h2.m2971e(250L); c0754h2.m2969g(this.f2081C); this.f2107y = c0754h2; c0754h2.m2968h(); } else { this.f2087e.setAlpha(1.0f); this.f2087e.setTranslationY(0.0f); if (this.f2102t && (view = this.f2090h) != null) { view.setTranslationY(0.0f); } this.f2081C.mo2293a(null); } ActionBarOverlayLayout actionBarOverlayLayout = this.f2086d; if (actionBarOverlayLayout != null) { C0829h1.m2851L(actionBarOverlayLayout); } } }