package androidx.appcompat.widget; 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.os.Build; 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.view.WindowInsets; import android.widget.OverScroller; import androidx.appcompat.view.menu.InterfaceC0112i; import p007c.C0485a; import p007c.C0490f; import p023h0.C0829h1; import p023h0.C0920q4; import p023h0.C0996z0; import p023h0.InterfaceC0974w0; import p023h0.InterfaceC0982x0; import p023h0.InterfaceC0989y0; import p028j.C1187q3; import p028j.InterfaceC1105g2; import p028j.InterfaceC1110h2; import p073z.C1877g; /* loaded from: classes.dex */ public class ActionBarOverlayLayout extends ViewGroup implements InterfaceC1105g2, InterfaceC0989y0, InterfaceC0974w0, InterfaceC0982x0 { /* renamed from: I */ public static final int[] f432I = {C0485a.actionBarSize, 16842841}; /* renamed from: A */ public C0920q4 f433A; /* renamed from: B */ public InterfaceC0125d f434B; /* renamed from: C */ public OverScroller f435C; /* renamed from: D */ public ViewPropertyAnimator f436D; /* renamed from: E */ public final AnimatorListenerAdapter f437E; /* renamed from: F */ public final Runnable f438F; /* renamed from: G */ public final Runnable f439G; /* renamed from: H */ public final C0996z0 f440H; /* renamed from: d */ public int f441d; /* renamed from: e */ public int f442e; /* renamed from: f */ public ContentFrameLayout f443f; /* renamed from: g */ public ActionBarContainer f444g; /* renamed from: h */ public InterfaceC1110h2 f445h; /* renamed from: i */ public Drawable f446i; /* renamed from: j */ public boolean f447j; /* renamed from: k */ public boolean f448k; /* renamed from: l */ public boolean f449l; /* renamed from: m */ public boolean f450m; /* renamed from: n */ public boolean f451n; /* renamed from: o */ public int f452o; /* renamed from: p */ public int f453p; /* renamed from: q */ public final Rect f454q; /* renamed from: r */ public final Rect f455r; /* renamed from: s */ public final Rect f456s; /* renamed from: t */ public final Rect f457t; /* renamed from: u */ public final Rect f458u; /* renamed from: v */ public final Rect f459v; /* renamed from: w */ public final Rect f460w; /* renamed from: x */ public C0920q4 f461x; /* renamed from: y */ public C0920q4 f462y; /* renamed from: z */ public C0920q4 f463z; /* renamed from: androidx.appcompat.widget.ActionBarOverlayLayout$a */ /* loaded from: classes.dex */ public class C0122a extends AnimatorListenerAdapter { public C0122a() { } @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener public void onAnimationCancel(Animator animator) { ActionBarOverlayLayout actionBarOverlayLayout = ActionBarOverlayLayout.this; actionBarOverlayLayout.f436D = null; actionBarOverlayLayout.f451n = false; } @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener public void onAnimationEnd(Animator animator) { ActionBarOverlayLayout actionBarOverlayLayout = ActionBarOverlayLayout.this; actionBarOverlayLayout.f436D = null; actionBarOverlayLayout.f451n = false; } } /* renamed from: androidx.appcompat.widget.ActionBarOverlayLayout$b */ /* loaded from: classes.dex */ public class RunnableC0123b implements Runnable { public RunnableC0123b() { } @Override // java.lang.Runnable public void run() { ActionBarOverlayLayout.this.m4793u(); ActionBarOverlayLayout actionBarOverlayLayout = ActionBarOverlayLayout.this; actionBarOverlayLayout.f436D = actionBarOverlayLayout.f444g.animate().translationY(0.0f).setListener(ActionBarOverlayLayout.this.f437E); } } /* renamed from: androidx.appcompat.widget.ActionBarOverlayLayout$c */ /* loaded from: classes.dex */ public class RunnableC0124c implements Runnable { public RunnableC0124c() { } @Override // java.lang.Runnable public void run() { ActionBarOverlayLayout.this.m4793u(); ActionBarOverlayLayout actionBarOverlayLayout = ActionBarOverlayLayout.this; actionBarOverlayLayout.f436D = actionBarOverlayLayout.f444g.animate().translationY(-ActionBarOverlayLayout.this.f444g.getHeight()).setListener(ActionBarOverlayLayout.this.f437E); } } /* renamed from: androidx.appcompat.widget.ActionBarOverlayLayout$d */ /* loaded from: classes.dex */ public interface InterfaceC0125d { /* renamed from: a */ void mo3356a(boolean z); /* renamed from: b */ void mo3355b(); /* renamed from: c */ void mo3354c(); /* renamed from: d */ void mo3353d(int i); /* renamed from: e */ void mo3352e(); /* renamed from: f */ void mo3351f(); } /* renamed from: androidx.appcompat.widget.ActionBarOverlayLayout$e */ /* loaded from: classes.dex */ public static class C0126e extends ViewGroup.MarginLayoutParams { public C0126e(int i, int i2) { super(i, i2); } public C0126e(Context context, AttributeSet attributeSet) { super(context, attributeSet); } public C0126e(ViewGroup.LayoutParams layoutParams) { super(layoutParams); } } public ActionBarOverlayLayout(Context context, AttributeSet attributeSet) { super(context, attributeSet); this.f442e = 0; this.f454q = new Rect(); this.f455r = new Rect(); this.f456s = new Rect(); this.f457t = new Rect(); this.f458u = new Rect(); this.f459v = new Rect(); this.f460w = new Rect(); C0920q4 c0920q4 = C0920q4.f2461b; this.f461x = c0920q4; this.f462y = c0920q4; this.f463z = c0920q4; this.f433A = c0920q4; this.f437E = new C0122a(); this.f438F = new RunnableC0123b(); this.f439G = new RunnableC0124c(); m4792v(context); this.f440H = new C0996z0(this); } /* renamed from: A */ public final void m4800A() { m4793u(); this.f438F.run(); } /* renamed from: B */ public final boolean m4799B(float f) { this.f435C.fling(0, 0, 0, (int) f, 0, 0, Integer.MIN_VALUE, Integer.MAX_VALUE); return this.f435C.getFinalY() > this.f444g.getHeight(); } @Override // p028j.InterfaceC1105g2 /* renamed from: a */ public void mo2189a(Menu menu, InterfaceC0112i.InterfaceC0113a interfaceC0113a) { m4788z(); this.f445h.mo2149a(menu, interfaceC0113a); } @Override // p028j.InterfaceC1105g2 /* renamed from: b */ public boolean mo2188b() { m4788z(); return this.f445h.mo2148b(); } @Override // p028j.InterfaceC1105g2 /* renamed from: c */ public boolean mo2187c() { m4788z(); return this.f445h.mo2147c(); } @Override // android.view.ViewGroup public boolean checkLayoutParams(ViewGroup.LayoutParams layoutParams) { return layoutParams instanceof C0126e; } @Override // p023h0.InterfaceC0974w0 /* renamed from: d */ public void mo729d(View view, View view2, int i, int i2) { if (i2 == 0) { onNestedScrollAccepted(view, view2, i); } } @Override // android.view.View public void draw(Canvas canvas) { super.draw(canvas); if (this.f446i == null || this.f447j) { return; } int bottom = this.f444g.getVisibility() == 0 ? (int) (this.f444g.getBottom() + this.f444g.getTranslationY() + 0.5f) : 0; this.f446i.setBounds(0, bottom, getWidth(), this.f446i.getIntrinsicHeight() + bottom); this.f446i.draw(canvas); } @Override // p028j.InterfaceC1105g2 /* renamed from: e */ public boolean mo2186e() { m4788z(); return this.f445h.mo2145e(); } @Override // p028j.InterfaceC1105g2 /* renamed from: f */ public boolean mo2185f() { m4788z(); return this.f445h.mo2144f(); } @Override // android.view.View public boolean fitSystemWindows(Rect rect) { if (Build.VERSION.SDK_INT >= 21) { return super.fitSystemWindows(rect); } m4788z(); boolean m4797q = m4797q(this.f444g, rect, true, true, false, true); this.f457t.set(rect); C1187q3.m1906a(this, this.f457t, this.f454q); if (!this.f458u.equals(this.f457t)) { this.f458u.set(this.f457t); m4797q = true; } if (!this.f455r.equals(this.f454q)) { this.f455r.set(this.f454q); m4797q = true; } if (m4797q) { requestLayout(); } return true; } @Override // p028j.InterfaceC1105g2 /* renamed from: g */ public void mo2184g() { m4788z(); this.f445h.mo2143g(); } @Override // android.view.ViewGroup public ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams layoutParams) { return new C0126e(layoutParams); } public int getActionBarHideOffset() { ActionBarContainer actionBarContainer = this.f444g; if (actionBarContainer != null) { return -((int) actionBarContainer.getTranslationY()); } return 0; } @Override // android.view.ViewGroup public int getNestedScrollAxes() { return this.f440H.m2431a(); } public CharSequence getTitle() { m4788z(); return this.f445h.getTitle(); } @Override // p028j.InterfaceC1105g2 /* renamed from: h */ public boolean mo2183h() { m4788z(); return this.f445h.mo2142h(); } @Override // p023h0.InterfaceC0974w0 /* renamed from: i */ public void mo728i(View view, int i) { if (i == 0) { onStopNestedScroll(view); } } @Override // p023h0.InterfaceC0974w0 /* renamed from: j */ public void mo727j(View view, int i, int i2, int[] iArr, int i3) { if (i3 == 0) { onNestedPreScroll(view, i, i2, iArr); } } @Override // p028j.InterfaceC1105g2 /* renamed from: k */ public void mo2182k(int i) { m4788z(); if (i == 2) { this.f445h.mo2133q(); } else if (i == 5) { this.f445h.mo2131s(); } else if (i != 109) { } else { setOverlayMode(true); } } @Override // p028j.InterfaceC1105g2 /* renamed from: l */ public void mo2181l() { m4788z(); this.f445h.mo2141i(); } @Override // p023h0.InterfaceC0982x0 /* renamed from: m */ public void mo726m(View view, int i, int i2, int i3, int i4, int i5, int[] iArr) { mo725n(view, i, i2, i3, i4, i5); } @Override // p023h0.InterfaceC0974w0 /* renamed from: n */ public void mo725n(View view, int i, int i2, int i3, int i4, int i5) { if (i5 == 0) { onNestedScroll(view, i, i2, i3, i4); } } @Override // p023h0.InterfaceC0974w0 /* renamed from: o */ public boolean mo724o(View view, View view2, int i, int i2) { return i2 == 0 && onStartNestedScroll(view, view2, i); } @Override // android.view.View public WindowInsets onApplyWindowInsets(WindowInsets windowInsets) { m4788z(); C0920q4 m2568v = C0920q4.m2568v(windowInsets, this); boolean m4797q = m4797q(this.f444g, new Rect(m2568v.m2581i(), m2568v.m2579k(), m2568v.m2580j(), m2568v.m2582h()), true, true, false, true); C0829h1.m2830d(this, m2568v, this.f454q); Rect rect = this.f454q; C0920q4 m2578l = m2568v.m2578l(rect.left, rect.top, rect.right, rect.bottom); this.f461x = m2578l; boolean z = true; if (!this.f462y.equals(m2578l)) { this.f462y = this.f461x; m4797q = true; } if (this.f455r.equals(this.f454q)) { z = m4797q; } else { this.f455r.set(this.f454q); } if (z) { requestLayout(); } return m2568v.m2589a().m2587c().m2588b().m2570t(); } @Override // android.view.View public void onConfigurationChanged(Configuration configuration) { super.onConfigurationChanged(configuration); m4792v(getContext()); C0829h1.m2851L(this); } @Override // android.view.ViewGroup, android.view.View public void onDetachedFromWindow() { super.onDetachedFromWindow(); m4793u(); } @Override // android.view.ViewGroup, android.view.View public 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) { C0126e c0126e = (C0126e) childAt.getLayoutParams(); int measuredWidth = childAt.getMeasuredWidth(); int measuredHeight = childAt.getMeasuredHeight(); int i6 = ((ViewGroup.MarginLayoutParams) c0126e).leftMargin + paddingLeft; int i7 = ((ViewGroup.MarginLayoutParams) c0126e).topMargin + paddingTop; childAt.layout(i6, i7, measuredWidth + i6, measuredHeight + i7); } } } @Override // android.view.View public void onMeasure(int i, int i2) { int measuredHeight; C0920q4 m2566a; m4788z(); measureChildWithMargins(this.f444g, i, 0, i2, 0); C0126e c0126e = (C0126e) this.f444g.getLayoutParams(); int max = Math.max(0, this.f444g.getMeasuredWidth() + ((ViewGroup.MarginLayoutParams) c0126e).leftMargin + ((ViewGroup.MarginLayoutParams) c0126e).rightMargin); int max2 = Math.max(0, this.f444g.getMeasuredHeight() + ((ViewGroup.MarginLayoutParams) c0126e).topMargin + ((ViewGroup.MarginLayoutParams) c0126e).bottomMargin); int combineMeasuredStates = View.combineMeasuredStates(0, this.f444g.getMeasuredState()); boolean z = (C0829h1.m2810x(this) & 256) != 0; if (z) { measuredHeight = this.f441d; if (this.f449l && this.f444g.getTabContainer() != null) { measuredHeight += this.f441d; } } else { measuredHeight = this.f444g.getVisibility() != 8 ? this.f444g.getMeasuredHeight() : 0; } this.f456s.set(this.f454q); int i3 = Build.VERSION.SDK_INT; if (i3 >= 21) { this.f463z = this.f461x; } else { this.f459v.set(this.f457t); } if (!this.f448k && !z) { Rect rect = this.f456s; rect.top += measuredHeight; rect.bottom += 0; if (i3 >= 21) { m2566a = this.f463z.m2578l(0, measuredHeight, 0, 0); this.f463z = m2566a; } } else if (i3 >= 21) { m2566a = new C0920q4.C0922b(this.f463z).m2564c(C1877g.m142b(this.f463z.m2581i(), this.f463z.m2579k() + measuredHeight, this.f463z.m2580j(), this.f463z.m2582h() + 0)).m2566a(); this.f463z = m2566a; } else { Rect rect2 = this.f459v; rect2.top += measuredHeight; rect2.bottom += 0; } m4797q(this.f443f, this.f456s, true, true, true, true); if (i3 >= 21 && !this.f433A.equals(this.f463z)) { C0920q4 c0920q4 = this.f463z; this.f433A = c0920q4; C0829h1.m2829e(this.f443f, c0920q4); } else if (i3 < 21 && !this.f460w.equals(this.f459v)) { this.f460w.set(this.f459v); this.f443f.m4764a(this.f459v); } measureChildWithMargins(this.f443f, i, 0, i2, 0); C0126e c0126e2 = (C0126e) this.f443f.getLayoutParams(); int max3 = Math.max(max, this.f443f.getMeasuredWidth() + ((ViewGroup.MarginLayoutParams) c0126e2).leftMargin + ((ViewGroup.MarginLayoutParams) c0126e2).rightMargin); int max4 = Math.max(max2, this.f443f.getMeasuredHeight() + ((ViewGroup.MarginLayoutParams) c0126e2).topMargin + ((ViewGroup.MarginLayoutParams) c0126e2).bottomMargin); int combineMeasuredStates2 = View.combineMeasuredStates(combineMeasuredStates, this.f443f.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.ViewParent, p023h0.InterfaceC0989y0 public boolean onNestedFling(View view, float f, float f2, boolean z) { if (this.f450m && z) { if (m4799B(f2)) { m4798p(); } else { m4800A(); } this.f451n = true; return true; } return false; } @Override // android.view.ViewGroup, android.view.ViewParent, p023h0.InterfaceC0989y0 public boolean onNestedPreFling(View view, float f, float f2) { return false; } @Override // android.view.ViewGroup, android.view.ViewParent, p023h0.InterfaceC0989y0 public void onNestedPreScroll(View view, int i, int i2, int[] iArr) { } @Override // android.view.ViewGroup, android.view.ViewParent, p023h0.InterfaceC0989y0 public void onNestedScroll(View view, int i, int i2, int i3, int i4) { int i5 = this.f452o + i2; this.f452o = i5; setActionBarHideOffset(i5); } @Override // android.view.ViewGroup, android.view.ViewParent, p023h0.InterfaceC0989y0 public void onNestedScrollAccepted(View view, View view2, int i) { this.f440H.m2430b(view, view2, i); this.f452o = getActionBarHideOffset(); m4793u(); InterfaceC0125d interfaceC0125d = this.f434B; if (interfaceC0125d != null) { interfaceC0125d.mo3354c(); } } @Override // android.view.ViewGroup, android.view.ViewParent, p023h0.InterfaceC0989y0 public boolean onStartNestedScroll(View view, View view2, int i) { if ((i & 2) == 0 || this.f444g.getVisibility() != 0) { return false; } return this.f450m; } @Override // android.view.ViewGroup, android.view.ViewParent, p023h0.InterfaceC0989y0 public void onStopNestedScroll(View view) { if (this.f450m && !this.f451n) { if (this.f452o <= this.f444g.getHeight()) { m4789y(); } else { m4790x(); } } InterfaceC0125d interfaceC0125d = this.f434B; if (interfaceC0125d != null) { interfaceC0125d.mo3351f(); } } @Override // android.view.View @Deprecated public void onWindowSystemUiVisibilityChanged(int i) { super.onWindowSystemUiVisibilityChanged(i); m4788z(); int i2 = this.f453p ^ i; this.f453p = i; boolean z = (i & 4) == 0; boolean z2 = (i & 256) != 0; InterfaceC0125d interfaceC0125d = this.f434B; if (interfaceC0125d != null) { interfaceC0125d.mo3356a(!z2); if (z || !z2) { this.f434B.mo3355b(); } else { this.f434B.mo3352e(); } } if ((i2 & 256) == 0 || this.f434B == null) { return; } C0829h1.m2851L(this); } @Override // android.view.View public void onWindowVisibilityChanged(int i) { super.onWindowVisibilityChanged(i); this.f442e = i; InterfaceC0125d interfaceC0125d = this.f434B; if (interfaceC0125d != null) { interfaceC0125d.mo3353d(i); } } /* renamed from: p */ public final void m4798p() { m4793u(); this.f439G.run(); } /* JADX WARN: Removed duplicated region for block: B:13:0x0021 */ /* JADX WARN: Removed duplicated region for block: B:17:0x002c */ /* JADX WARN: Removed duplicated region for block: B:9:0x0016 */ /* renamed from: q */ /* Code decompiled incorrectly, please refer to instructions dump. */ public final boolean m4797q(View view, Rect rect, boolean z, boolean z2, boolean z3, boolean z4) { boolean z5; C0126e c0126e = (C0126e) view.getLayoutParams(); if (z) { int i = ((ViewGroup.MarginLayoutParams) c0126e).leftMargin; int i2 = rect.left; if (i != i2) { ((ViewGroup.MarginLayoutParams) c0126e).leftMargin = i2; z5 = true; if (z2) { int i3 = ((ViewGroup.MarginLayoutParams) c0126e).topMargin; int i4 = rect.top; if (i3 != i4) { ((ViewGroup.MarginLayoutParams) c0126e).topMargin = i4; z5 = true; } } if (z4) { int i5 = ((ViewGroup.MarginLayoutParams) c0126e).rightMargin; int i6 = rect.right; if (i5 != i6) { ((ViewGroup.MarginLayoutParams) c0126e).rightMargin = i6; z5 = true; } } if (z3) { int i7 = ((ViewGroup.MarginLayoutParams) c0126e).bottomMargin; int i8 = rect.bottom; if (i7 != i8) { ((ViewGroup.MarginLayoutParams) c0126e).bottomMargin = i8; return true; } } return z5; } } z5 = false; if (z2) { } if (z4) { } if (z3) { } return z5; } @Override // android.view.ViewGroup /* renamed from: r */ public C0126e generateDefaultLayoutParams() { return new C0126e(-1, -1); } @Override // android.view.ViewGroup /* renamed from: s */ public C0126e generateLayoutParams(AttributeSet attributeSet) { return new C0126e(getContext(), attributeSet); } public void setActionBarHideOffset(int i) { m4793u(); this.f444g.setTranslationY(-Math.max(0, Math.min(i, this.f444g.getHeight()))); } public void setActionBarVisibilityCallback(InterfaceC0125d interfaceC0125d) { this.f434B = interfaceC0125d; if (getWindowToken() != null) { this.f434B.mo3353d(this.f442e); int i = this.f453p; if (i != 0) { onWindowSystemUiVisibilityChanged(i); C0829h1.m2851L(this); } } } public void setHasNonEmbeddedTabs(boolean z) { this.f449l = z; } public void setHideOnContentScrollEnabled(boolean z) { if (z != this.f450m) { this.f450m = z; if (z) { return; } m4793u(); setActionBarHideOffset(0); } } public void setIcon(int i) { m4788z(); this.f445h.setIcon(i); } public void setIcon(Drawable drawable) { m4788z(); this.f445h.setIcon(drawable); } public void setLogo(int i) { m4788z(); this.f445h.mo2138l(i); } public void setOverlayMode(boolean z) { this.f448k = z; this.f447j = z && getContext().getApplicationInfo().targetSdkVersion < 19; } public void setShowingForActionMode(boolean z) { } public void setUiOptions(int i) { } @Override // p028j.InterfaceC1105g2 public void setWindowCallback(Window.Callback callback) { m4788z(); this.f445h.setWindowCallback(callback); } @Override // p028j.InterfaceC1105g2 public void setWindowTitle(CharSequence charSequence) { m4788z(); this.f445h.setWindowTitle(charSequence); } @Override // android.view.ViewGroup public boolean shouldDelayChildPressedState() { return false; } /* renamed from: t */ public final InterfaceC1110h2 m4794t(View view) { if (view instanceof InterfaceC1110h2) { return (InterfaceC1110h2) view; } if (view instanceof Toolbar) { return ((Toolbar) view).getWrapper(); } throw new IllegalStateException("Can't make a decor toolbar out of " + view.getClass().getSimpleName()); } /* renamed from: u */ public void m4793u() { removeCallbacks(this.f438F); removeCallbacks(this.f439G); ViewPropertyAnimator viewPropertyAnimator = this.f436D; if (viewPropertyAnimator != null) { viewPropertyAnimator.cancel(); } } /* renamed from: v */ public final void m4792v(Context context) { TypedArray obtainStyledAttributes = getContext().getTheme().obtainStyledAttributes(f432I); this.f441d = obtainStyledAttributes.getDimensionPixelSize(0, 0); Drawable drawable = obtainStyledAttributes.getDrawable(1); this.f446i = drawable; setWillNotDraw(drawable == null); obtainStyledAttributes.recycle(); this.f447j = context.getApplicationInfo().targetSdkVersion < 19; this.f435C = new OverScroller(context); } /* renamed from: w */ public boolean m4791w() { return this.f448k; } /* renamed from: x */ public final void m4790x() { m4793u(); postDelayed(this.f439G, 600L); } /* renamed from: y */ public final void m4789y() { m4793u(); postDelayed(this.f438F, 600L); } /* renamed from: z */ public void m4788z() { if (this.f443f == null) { this.f443f = (ContentFrameLayout) findViewById(C0490f.action_bar_activity_content); this.f444g = (ActionBarContainer) findViewById(C0490f.action_bar_container); this.f445h = m4794t(findViewById(C0490f.action_bar)); } } }