package androidx.appcompat.widget; import android.R; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.content.Context; import android.content.res.Configuration; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.view.Menu; import android.view.View; import android.view.ViewGroup; import android.view.ViewPropertyAnimator; import android.view.Window; import android.widget.OverScroller; import androidx.core.view.ViewCompat; import androidx.core.view.WindowInsetsCompat; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import o.C0926Rry; import o.InterfaceC15489grq; import o.InterfaceC15933jjG; import o.JXX; import o.Rmc; import o.SYO; import o.htg; import o.jdi; import org.bouncycastle.asn1.cmp.PKIFailureInfo; /* loaded from: classes.dex */ public class ActionBarOverlayLayout extends ViewGroup implements jdi, htg { private static int[] j = {SYO.IeS.actionBarSize, R.attr.windowContentOverlay}; private final JXX A; private int B; private final Rect C; private WindowInsetsCompat D; private Drawable G; private int I; ActionBarContainer a; final AnimatorListenerAdapter b; public boolean c; boolean d; ViewPropertyAnimator e; private HBt f; private final Rect g; private int h; private final Runnable i; private ContentFrameLayout k; private final Rect l; private WindowInsetsCompat m; private InterfaceC15489grq n; /* renamed from: o, reason: collision with root package name */ private final Rect f6372o; private boolean p; private boolean q; private boolean r; private int s; private OverScroller t; private final Rect u; private WindowInsetsCompat v; private final Rect w; private final Rect x; private WindowInsetsCompat y; private final Runnable z; /* loaded from: classes.dex */ public interface HBt { void a(int i); void f(boolean z); void l(); void m(); void p(); } @Override // android.view.ViewGroup, android.view.ViewParent public boolean onNestedPreFling(View view, float f, float f2) { return false; } @Override // android.view.ViewGroup, android.view.ViewParent public void onNestedPreScroll(View view, int i, int i2, int[] iArr) { } public void setShowingForActionMode(boolean z) { } public void setUiOptions(int i) { } @Override // android.view.ViewGroup public boolean shouldDelayChildPressedState() { return false; } public ActionBarOverlayLayout(Context context) { this(context, null); } public ActionBarOverlayLayout(Context context, AttributeSet attributeSet) { super(context, attributeSet); this.I = 0; this.g = new Rect(); this.w = new Rect(); this.l = new Rect(); this.f6372o = new Rect(); this.u = new Rect(); this.x = new Rect(); this.C = new Rect(); this.m = WindowInsetsCompat.d; this.v = WindowInsetsCompat.d; this.y = WindowInsetsCompat.d; this.D = WindowInsetsCompat.d; this.b = new AnimatorListenerAdapter(this) { // from class: androidx.appcompat.widget.ActionBarOverlayLayout.5 final ActionBarOverlayLayout e; { this.e = this; } @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener public final void onAnimationEnd(Animator animator) { this.e.e = null; this.e.d = false; } @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener public final void onAnimationCancel(Animator animator) { this.e.e = null; this.e.d = false; } }; this.z = new Runnable(this) { // from class: androidx.appcompat.widget.ActionBarOverlayLayout.1 final ActionBarOverlayLayout e; { this.e = this; } @Override // java.lang.Runnable public final void run() { this.e.e(); ActionBarOverlayLayout actionBarOverlayLayout = this.e; actionBarOverlayLayout.e = actionBarOverlayLayout.a.animate().translationY(BitmapDescriptorFactory.HUE_RED).setListener(this.e.b); } }; this.i = new Runnable(this) { // from class: androidx.appcompat.widget.ActionBarOverlayLayout.2 final ActionBarOverlayLayout e; { this.e = this; } @Override // java.lang.Runnable public final void run() { this.e.e(); ActionBarOverlayLayout actionBarOverlayLayout = this.e; actionBarOverlayLayout.e = actionBarOverlayLayout.a.animate().translationY(-this.e.a.getHeight()).setListener(this.e.b); } }; e(context); this.A = new JXX(); } private void e(Context context) { TypedArray obtainStyledAttributes = getContext().getTheme().obtainStyledAttributes(j); this.h = obtainStyledAttributes.getDimensionPixelSize(0, 0); Drawable drawable = obtainStyledAttributes.getDrawable(1); this.G = drawable; setWillNotDraw(drawable == null); obtainStyledAttributes.recycle(); this.r = context.getApplicationInfo().targetSdkVersion < 19; this.t = new OverScroller(context); } @Override // android.view.ViewGroup, android.view.View protected void onDetachedFromWindow() { super.onDetachedFromWindow(); e(); } public void setActionBarVisibilityCallback(HBt hBt) { this.f = hBt; if (getWindowToken() != null) { this.f.a(this.I); int i = this.B; if (i != 0) { onWindowSystemUiVisibilityChanged(i); ViewCompat.J(this); } } } public void setOverlayMode(boolean z) { this.c = z; this.r = z && getContext().getApplicationInfo().targetSdkVersion < 19; } @Override // android.view.View protected void onConfigurationChanged(Configuration configuration) { super.onConfigurationChanged(configuration); e(getContext()); ViewCompat.J(this); } @Override // android.view.View @Deprecated public void onWindowSystemUiVisibilityChanged(int i) { super.onWindowSystemUiVisibilityChanged(i); i(); int i2 = this.B; this.B = i; boolean z = (i & 4) == 0; boolean z2 = (i & 256) != 0; HBt hBt = this.f; if (hBt != null) { hBt.f(!z2); if (z || !z2) { this.f.p(); } else { this.f.l(); } } if (((i ^ i2) & 256) == 0 || this.f == null) { return; } ViewCompat.J(this); } @Override // android.view.View protected void onWindowVisibilityChanged(int i) { super.onWindowVisibilityChanged(i); this.I = i; HBt hBt = this.f; if (hBt != null) { hBt.a(i); } } private static boolean fg_(View view, Rect rect, boolean z) { boolean z2; RVV rvv = (RVV) view.getLayoutParams(); if (((ViewGroup.MarginLayoutParams) rvv).leftMargin != rect.left) { ((ViewGroup.MarginLayoutParams) rvv).leftMargin = rect.left; z2 = true; } else { z2 = false; } if (((ViewGroup.MarginLayoutParams) rvv).topMargin != rect.top) { ((ViewGroup.MarginLayoutParams) rvv).topMargin = rect.top; z2 = true; } if (((ViewGroup.MarginLayoutParams) rvv).rightMargin != rect.right) { ((ViewGroup.MarginLayoutParams) rvv).rightMargin = rect.right; z2 = true; } if (!z || ((ViewGroup.MarginLayoutParams) rvv).bottomMargin == rect.bottom) { return z2; } ((ViewGroup.MarginLayoutParams) rvv).bottomMargin = rect.bottom; return true; } @Override // android.view.View protected boolean fitSystemWindows(Rect rect) { return super.fitSystemWindows(rect); } /* JADX WARN: Code restructure failed: missing block: B:11:0x005d, code lost: if (r0 != false) goto L9; */ @Override // android.view.View /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public android.view.WindowInsets onApplyWindowInsets(android.view.WindowInsets r6) { /* r5 = this; r5.i() androidx.core.view.WindowInsetsCompat r6 = androidx.core.view.WindowInsetsCompat.tH_(r6, r5) int r0 = r6.g() int r1 = r6.i() int r2 = r6.j() android.graphics.Rect r3 = new android.graphics.Rect int r4 = r6.f() r3.(r0, r1, r2, r4) androidx.appcompat.widget.ActionBarContainer r0 = r5.a r1 = 0 boolean r0 = fg_(r0, r3, r1) android.graphics.Rect r1 = r5.g androidx.core.view.ViewCompat.sc_(r5, r6, r1) android.graphics.Rect r1 = r5.g int r1 = r1.left android.graphics.Rect r2 = r5.g int r2 = r2.top android.graphics.Rect r3 = r5.g int r3 = r3.right android.graphics.Rect r4 = r5.g int r4 = r4.bottom androidx.core.view.WindowInsetsCompat r1 = r6.c(r1, r2, r3, r4) r5.m = r1 androidx.core.view.WindowInsetsCompat r2 = r5.v boolean r1 = r2.equals(r1) if (r1 != 0) goto L4b androidx.core.view.WindowInsetsCompat r0 = r5.m r5.v = r0 r0 = 1 L4b: android.graphics.Rect r1 = r5.w android.graphics.Rect r2 = r5.g boolean r1 = r1.equals(r2) if (r1 != 0) goto L5d android.graphics.Rect r0 = r5.w android.graphics.Rect r1 = r5.g r0.set(r1) goto L5f L5d: if (r0 == 0) goto L62 L5f: r5.requestLayout() L62: androidx.core.view.WindowInsetsCompat r6 = r6.a() androidx.core.view.WindowInsetsCompat r6 = r6.c() androidx.core.view.WindowInsetsCompat r6 = r6.b() android.view.WindowInsets r6 = r6.tI_() return r6 */ throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.ActionBarOverlayLayout.onApplyWindowInsets(android.view.WindowInsets):android.view.WindowInsets"); } @Override // android.view.ViewGroup protected ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams layoutParams) { return new RVV(layoutParams); } @Override // android.view.ViewGroup protected boolean checkLayoutParams(ViewGroup.LayoutParams layoutParams) { return layoutParams instanceof RVV; } @Override // android.view.View protected void onMeasure(int i, int i2) { int measuredHeight; i(); measureChildWithMargins(this.a, i, 0, i2, 0); RVV rvv = (RVV) this.a.getLayoutParams(); int max = Math.max(0, this.a.getMeasuredWidth() + ((ViewGroup.MarginLayoutParams) rvv).leftMargin + ((ViewGroup.MarginLayoutParams) rvv).rightMargin); int max2 = Math.max(0, this.a.getMeasuredHeight() + ((ViewGroup.MarginLayoutParams) rvv).topMargin + ((ViewGroup.MarginLayoutParams) rvv).bottomMargin); int combineMeasuredStates = View.combineMeasuredStates(0, this.a.getMeasuredState()); boolean z = (ViewCompat.w(this) & 256) != 0; if (!z) { measuredHeight = this.a.getVisibility() != 8 ? this.a.getMeasuredHeight() : 0; } else { measuredHeight = this.h; if (this.p && this.a.i != null) { measuredHeight += this.h; } } this.l.set(this.g); WindowInsetsCompat windowInsetsCompat = this.m; this.y = windowInsetsCompat; if (!this.c && !z) { this.l.top += measuredHeight; Rect rect = this.l; rect.bottom = rect.bottom; this.y = this.y.c(0, measuredHeight, 0, 0); } else { this.y = new WindowInsetsCompat.Sts(this.y).c(Rmc.e(windowInsetsCompat.g(), this.y.i() + measuredHeight, this.y.j(), this.y.f())).a(); } fg_(this.k, this.l, true); if (!this.D.equals(this.y)) { WindowInsetsCompat windowInsetsCompat2 = this.y; this.D = windowInsetsCompat2; ViewCompat.b(this.k, windowInsetsCompat2); } measureChildWithMargins(this.k, i, 0, i2, 0); RVV rvv2 = (RVV) this.k.getLayoutParams(); int max3 = Math.max(max, this.k.getMeasuredWidth() + ((ViewGroup.MarginLayoutParams) rvv2).leftMargin + ((ViewGroup.MarginLayoutParams) rvv2).rightMargin); int max4 = Math.max(max2, this.k.getMeasuredHeight() + ((ViewGroup.MarginLayoutParams) rvv2).topMargin + ((ViewGroup.MarginLayoutParams) rvv2).bottomMargin); int combineMeasuredStates2 = View.combineMeasuredStates(combineMeasuredStates, this.k.getMeasuredState()); setMeasuredDimension(View.resolveSizeAndState(Math.max(max3 + getPaddingLeft() + getPaddingRight(), getSuggestedMinimumWidth()), i, combineMeasuredStates2), View.resolveSizeAndState(Math.max(max4 + getPaddingTop() + getPaddingBottom(), getSuggestedMinimumHeight()), i2, combineMeasuredStates2 << 16)); } @Override // android.view.ViewGroup, android.view.View protected void onLayout(boolean z, int i, int i2, int i3, int i4) { int childCount = getChildCount(); int paddingLeft = getPaddingLeft(); int paddingTop = getPaddingTop(); for (int i5 = 0; i5 < childCount; i5++) { View childAt = getChildAt(i5); if (childAt.getVisibility() != 8) { RVV rvv = (RVV) childAt.getLayoutParams(); int measuredWidth = childAt.getMeasuredWidth(); int measuredHeight = childAt.getMeasuredHeight(); int i6 = ((ViewGroup.MarginLayoutParams) rvv).leftMargin + paddingLeft; int i7 = ((ViewGroup.MarginLayoutParams) rvv).topMargin + paddingTop; childAt.layout(i6, i7, measuredWidth + i6, measuredHeight + i7); } } } @Override // android.view.View public void draw(Canvas canvas) { super.draw(canvas); if (this.G == null || this.r) { return; } int bottom = this.a.getVisibility() == 0 ? (int) (this.a.getBottom() + this.a.getTranslationY() + 0.5f) : 0; this.G.setBounds(0, bottom, getWidth(), this.G.getIntrinsicHeight() + bottom); this.G.draw(canvas); } @Override // o.FEJ public final boolean c(View view, View view2, int i, int i2) { return i2 == 0 && onStartNestedScroll(view, view2, i); } @Override // o.FEJ public final void e(View view, View view2, int i, int i2) { if (i2 == 0) { onNestedScrollAccepted(view, view2, i); } } @Override // o.FEJ public final void a(View view, int i) { if (i == 0) { onStopNestedScroll(view); } } @Override // o.FEJ public final void c(View view, int i, int i2, int i3, int i4, int i5) { if (i5 == 0) { onNestedScroll(view, i, i2, i3, i4); } } @Override // o.FEJ public final void a(View view, int i, int i2, int[] iArr, int i3) { if (i3 == 0) { onNestedPreScroll(view, i, i2, iArr); } } @Override // android.view.ViewGroup, android.view.ViewParent public boolean onStartNestedScroll(View view, View view2, int i) { if ((i & 2) == 0 || this.a.getVisibility() != 0) { return false; } return this.q; } @Override // android.view.ViewGroup, android.view.ViewParent public void onNestedScroll(View view, int i, int i2, int i3, int i4) { int i5 = this.s + i2; this.s = i5; setActionBarHideOffset(i5); } @Override // android.view.ViewGroup, android.view.ViewParent public void onStopNestedScroll(View view) { if (!this.q || this.d) { return; } if (this.s <= this.a.getHeight()) { e(); postDelayed(this.z, 600L); } else { e(); postDelayed(this.i, 600L); } } @Override // android.view.ViewGroup, android.view.ViewParent public boolean onNestedFling(View view, float f, float f2, boolean z) { if (!this.q || !z) { return false; } this.t.fling(0, 0, 0, (int) f2, 0, 0, PKIFailureInfo.systemUnavail, Integer.MAX_VALUE); if (this.t.getFinalY() > this.a.getHeight()) { e(); this.i.run(); } else { e(); this.z.run(); } this.d = true; return true; } private void i() { if (this.k == null) { this.k = (ContentFrameLayout) findViewById(SYO.saX.action_bar_activity_content); this.a = (ActionBarContainer) findViewById(SYO.saX.action_bar_container); this.n = d(findViewById(SYO.saX.action_bar)); } } /* JADX WARN: Multi-variable type inference failed */ private static InterfaceC15489grq d(View view) { if (view instanceof InterfaceC15489grq) { return (InterfaceC15489grq) view; } if (view instanceof Toolbar) { Toolbar toolbar = (Toolbar) view; if (toolbar.t == null) { toolbar.t = new C0926Rry(toolbar, true); } return toolbar.t; } StringBuilder sb = new StringBuilder("Can't make a decor toolbar out of "); sb.append(view.getClass().getSimpleName()); throw new IllegalStateException(sb.toString()); } public void setHideOnContentScrollEnabled(boolean z) { if (z != this.q) { this.q = z; if (z) { return; } e(); setActionBarHideOffset(0); } } public void setActionBarHideOffset(int i) { e(); this.a.setTranslationY(-Math.max(0, Math.min(i, this.a.getHeight()))); } final void e() { removeCallbacks(this.z); removeCallbacks(this.i); ViewPropertyAnimator viewPropertyAnimator = this.e; if (viewPropertyAnimator != null) { viewPropertyAnimator.cancel(); } } @Override // o.jdi public void setWindowCallback(Window.Callback callback) { i(); this.n.ka_(callback); } @Override // o.jdi public void setWindowTitle(CharSequence charSequence) { i(); this.n.c(charSequence); } @Override // o.jdi public final void e(int i) { i(); if (i == 2 || i == 5 || i != 109) { return; } setOverlayMode(true); } public void setIcon(int i) { i(); this.n.a(i); } public void setIcon(Drawable drawable) { i(); this.n.jX_(drawable); } public void setLogo(int i) { i(); this.n.d(i); } @Override // o.jdi public final boolean b() { i(); return this.n.a(); } @Override // o.jdi public final boolean h() { i(); return this.n.k(); } @Override // o.jdi public final boolean d() { i(); return this.n.o(); } @Override // o.jdi public final boolean f() { i(); return this.n.n(); } @Override // o.jdi public final boolean a() { i(); return this.n.h(); } @Override // o.jdi public void setMenuPrepared() { i(); this.n.l(); } @Override // o.jdi public void setMenu(Menu menu, InterfaceC15933jjG.Sts sts) { i(); this.n.jY_(menu, sts); } @Override // o.jdi public final void c() { i(); this.n.e(); } /* loaded from: classes.dex */ public static class RVV extends ViewGroup.MarginLayoutParams { public RVV(Context context, AttributeSet attributeSet) { super(context, attributeSet); } public RVV() { super(-1, -1); } public RVV(ViewGroup.LayoutParams layoutParams) { super(layoutParams); } } @Override // android.view.ViewGroup protected /* synthetic */ ViewGroup.LayoutParams generateDefaultLayoutParams() { return new RVV(); } @Override // android.view.ViewGroup public /* synthetic */ ViewGroup.LayoutParams generateLayoutParams(AttributeSet attributeSet) { return new RVV(getContext(), attributeSet); } @Override // android.view.ViewGroup public int getNestedScrollAxes() { JXX jxx = this.A; return jxx.d | jxx.c; } @Override // o.htg public final void a(View view, int i, int i2, int i3, int i4, int i5, int[] iArr) { if (i5 == 0) { onNestedScroll(view, i, i2, i3, i4); } } @Override // android.view.ViewGroup, android.view.ViewParent public void onNestedScrollAccepted(View view, View view2, int i) { this.A.c = i; ActionBarContainer actionBarContainer = this.a; this.s = actionBarContainer != null ? -((int) actionBarContainer.getTranslationY()) : 0; e(); HBt hBt = this.f; if (hBt != null) { hBt.m(); } } public void setHasNonEmbeddedTabs(boolean z) { this.p = z; } }