package com.google.android.material.appbar;

import android.animation.ValueAnimator;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AnimationUtils;
import android.view.animation.Interpolator;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.ScrollView;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import androidx.core.view.accessibility.d;
import androidx.core.view.accessibility.g;
import androidx.core.view.j0;
import androidx.core.view.m;
import androidx.core.view.y;
import c1.h;
import java.lang.ref.WeakReference;
import java.util.Iterator;
import java.util.List;
import l0.k;

/* JADX INFO: loaded from: classes.dex */
public class AppBarLayout extends LinearLayout implements CoordinatorLayout.b {

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    private int f3498e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    private int f3499f;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    private int f3500g;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    private int f3501h;

    /* JADX INFO: renamed from: i, reason: collision with root package name */
    private boolean f3502i;

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    private int f3503j;

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    private j0 f3504k;

    /* JADX INFO: renamed from: l, reason: collision with root package name */
    private List<b> f3505l;

    /* JADX INFO: renamed from: m, reason: collision with root package name */
    private boolean f3506m;

    /* JADX INFO: renamed from: n, reason: collision with root package name */
    private boolean f3507n;

    /* JADX INFO: renamed from: o, reason: collision with root package name */
    private boolean f3508o;

    /* JADX INFO: renamed from: p, reason: collision with root package name */
    private boolean f3509p;

    /* JADX INFO: renamed from: q, reason: collision with root package name */
    private int f3510q;

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    private WeakReference<View> f3511r;

    /* JADX INFO: renamed from: s, reason: collision with root package name */
    private ValueAnimator f3512s;

    /* JADX INFO: renamed from: t, reason: collision with root package name */
    private final List<f> f3513t;

    /* JADX INFO: renamed from: u, reason: collision with root package name */
    private int[] f3514u;

    /* JADX INFO: renamed from: v, reason: collision with root package name */
    private Drawable f3515v;

    /* JADX INFO: renamed from: w, reason: collision with root package name */
    private Behavior f3516w;

    protected static class BaseBehavior<T extends AppBarLayout> extends com.google.android.material.appbar.a<T> {

        /* JADX INFO: renamed from: k, reason: collision with root package name */
        private int f3517k;

        /* JADX INFO: renamed from: l, reason: collision with root package name */
        private int f3518l;

        /* JADX INFO: renamed from: m, reason: collision with root package name */
        private ValueAnimator f3519m;

        /* JADX INFO: renamed from: n, reason: collision with root package name */
        private e f3520n;

        /* JADX INFO: renamed from: o, reason: collision with root package name */
        private WeakReference<View> f3521o;

        /* JADX INFO: renamed from: p, reason: collision with root package name */
        private boolean f3522p;

        class a implements ValueAnimator.AnimatorUpdateListener {

            /* JADX INFO: renamed from: a, reason: collision with root package name */
            final /* synthetic */ CoordinatorLayout f3523a;

            /* JADX INFO: renamed from: b, reason: collision with root package name */
            final /* synthetic */ AppBarLayout f3524b;

            a(CoordinatorLayout coordinatorLayout, AppBarLayout appBarLayout) {
                this.f3523a = coordinatorLayout;
                this.f3524b = appBarLayout;
            }

            @Override // android.animation.ValueAnimator.AnimatorUpdateListener
            public void onAnimationUpdate(ValueAnimator valueAnimator) {
                BaseBehavior.this.P(this.f3523a, this.f3524b, ((Integer) valueAnimator.getAnimatedValue()).intValue());
            }
        }

        class b extends androidx.core.view.a {
            b() {
            }

            @Override // androidx.core.view.a
            public void g(View view, androidx.core.view.accessibility.d dVar) {
                super.g(view, dVar);
                dVar.o0(BaseBehavior.this.f3522p);
                dVar.W(ScrollView.class.getName());
            }
        }

        class c implements g {

            /* JADX INFO: renamed from: a, reason: collision with root package name */
            final /* synthetic */ CoordinatorLayout f3527a;

            /* JADX INFO: renamed from: b, reason: collision with root package name */
            final /* synthetic */ AppBarLayout f3528b;

            /* JADX INFO: renamed from: c, reason: collision with root package name */
            final /* synthetic */ View f3529c;

            /* JADX INFO: renamed from: d, reason: collision with root package name */
            final /* synthetic */ int f3530d;

            c(CoordinatorLayout coordinatorLayout, AppBarLayout appBarLayout, View view, int i3) {
                this.f3527a = coordinatorLayout;
                this.f3528b = appBarLayout;
                this.f3529c = view;
                this.f3530d = i3;
            }

            /* JADX WARN: Multi-variable type inference failed */
            /* JADX WARN: Type inference fix 'apply assigned field type' failed
            java.lang.UnsupportedOperationException: ArgType.getObject(), call class: class jadx.core.dex.instructions.args.ArgType$PrimitiveArg
            	at jadx.core.dex.instructions.args.ArgType.getObject(ArgType.java:593)
            	at jadx.core.dex.attributes.nodes.ClassTypeVarsAttr.getTypeVarsMapFor(ClassTypeVarsAttr.java:35)
            	at jadx.core.dex.nodes.utils.TypeUtils.replaceClassGenerics(TypeUtils.java:177)
            	at jadx.core.dex.visitors.typeinference.FixTypesVisitor.insertExplicitUseCast(FixTypesVisitor.java:397)
            	at jadx.core.dex.visitors.typeinference.FixTypesVisitor.tryFieldTypeWithNewCasts(FixTypesVisitor.java:359)
            	at jadx.core.dex.visitors.typeinference.FixTypesVisitor.applyFieldType(FixTypesVisitor.java:309)
            	at jadx.core.dex.visitors.typeinference.FixTypesVisitor.visit(FixTypesVisitor.java:94)
             */
            @Override // androidx.core.view.accessibility.g
            public boolean a(View view, g.a aVar) {
                BaseBehavior.this.q(this.f3527a, this.f3528b, this.f3529c, 0, this.f3530d, new int[]{0, 0}, 1);
                return true;
            }
        }

        class d implements g {

            /* JADX INFO: renamed from: a, reason: collision with root package name */
            final /* synthetic */ AppBarLayout f3532a;

            /* JADX INFO: renamed from: b, reason: collision with root package name */
            final /* synthetic */ boolean f3533b;

            d(BaseBehavior baseBehavior, AppBarLayout appBarLayout, boolean z2) {
                this.f3532a = appBarLayout;
                this.f3533b = z2;
            }

            @Override // androidx.core.view.accessibility.g
            public boolean a(View view, g.a aVar) {
                this.f3532a.setExpanded(this.f3533b);
                return true;
            }
        }

        public BaseBehavior() {
        }

        private boolean T(CoordinatorLayout coordinatorLayout, T t2, View view) {
            boolean z2 = false;
            if (M() != (-t2.getTotalScrollRange())) {
                U(coordinatorLayout, t2, d.a.f1850f, false);
                z2 = true;
            }
            if (M() != 0) {
                if (!view.canScrollVertically(-1)) {
                    U(coordinatorLayout, t2, d.a.f1851g, true);
                    return true;
                }
                int i3 = -t2.getDownNestedPreScrollRange();
                if (i3 != 0) {
                    y.n0(coordinatorLayout, d.a.f1851g, null, new c(coordinatorLayout, t2, view, i3));
                    return true;
                }
            }
            return z2;
        }

        private void U(CoordinatorLayout coordinatorLayout, T t2, d.a aVar, boolean z2) {
            y.n0(coordinatorLayout, aVar, null, new d(this, t2, z2));
        }

        private void V(CoordinatorLayout coordinatorLayout, T t2, int i3, float f3) {
            int iAbs = Math.abs(M() - i3);
            float fAbs = Math.abs(f3);
            W(coordinatorLayout, t2, i3, fAbs > 0.0f ? Math.round((iAbs / fAbs) * 1000.0f) * 3 : (int) (((iAbs / t2.getHeight()) + 1.0f) * 150.0f));
        }

        private void W(CoordinatorLayout coordinatorLayout, T t2, int i3, int i4) {
            int iM = M();
            if (iM == i3) {
                ValueAnimator valueAnimator = this.f3519m;
                if (valueAnimator == null || !valueAnimator.isRunning()) {
                    return;
                }
                this.f3519m.cancel();
                return;
            }
            ValueAnimator valueAnimator2 = this.f3519m;
            if (valueAnimator2 == null) {
                ValueAnimator valueAnimator3 = new ValueAnimator();
                this.f3519m = valueAnimator3;
                valueAnimator3.setInterpolator(m0.a.f5557e);
                this.f3519m.addUpdateListener(new a(coordinatorLayout, t2));
            } else {
                valueAnimator2.cancel();
            }
            this.f3519m.setDuration(Math.min(i4, 600));
            this.f3519m.setIntValues(iM, i3);
            this.f3519m.start();
        }

        private int X(int i3, int i4, int i5) {
            return i3 < (i4 + i5) / 2 ? i4 : i5;
        }

        private boolean Z(CoordinatorLayout coordinatorLayout, T t2, View view) {
            return t2.j() && coordinatorLayout.getHeight() - view.getHeight() <= t2.getHeight();
        }

        private static boolean a0(int i3, int i4) {
            return (i3 & i4) == i4;
        }

        private boolean b0(AppBarLayout appBarLayout) {
            int childCount = appBarLayout.getChildCount();
            for (int i3 = 0; i3 < childCount; i3++) {
                if (((e) appBarLayout.getChildAt(i3).getLayoutParams()).f3543a != 0) {
                    return true;
                }
            }
            return false;
        }

        private View c0(CoordinatorLayout coordinatorLayout) {
            int childCount = coordinatorLayout.getChildCount();
            for (int i3 = 0; i3 < childCount; i3++) {
                View childAt = coordinatorLayout.getChildAt(i3);
                if ((childAt instanceof m) || (childAt instanceof ListView) || (childAt instanceof ScrollView)) {
                    return childAt;
                }
            }
            return null;
        }

        private static View d0(AppBarLayout appBarLayout, int i3) {
            int iAbs = Math.abs(i3);
            int childCount = appBarLayout.getChildCount();
            for (int i4 = 0; i4 < childCount; i4++) {
                View childAt = appBarLayout.getChildAt(i4);
                if (iAbs >= childAt.getTop() && iAbs <= childAt.getBottom()) {
                    return childAt;
                }
            }
            return null;
        }

        private int e0(T t2, int i3) {
            int childCount = t2.getChildCount();
            for (int i4 = 0; i4 < childCount; i4++) {
                View childAt = t2.getChildAt(i4);
                int top = childAt.getTop();
                int bottom = childAt.getBottom();
                e eVar = (e) childAt.getLayoutParams();
                if (a0(eVar.c(), 32)) {
                    top -= ((LinearLayout.LayoutParams) eVar).topMargin;
                    bottom += ((LinearLayout.LayoutParams) eVar).bottomMargin;
                }
                int i5 = -i3;
                if (top <= i5 && bottom >= i5) {
                    return i4;
                }
            }
            return -1;
        }

        private View f0(CoordinatorLayout coordinatorLayout) {
            int childCount = coordinatorLayout.getChildCount();
            for (int i3 = 0; i3 < childCount; i3++) {
                View childAt = coordinatorLayout.getChildAt(i3);
                if (((CoordinatorLayout.f) childAt.getLayoutParams()).f() instanceof ScrollingViewBehavior) {
                    return childAt;
                }
            }
            return null;
        }

        private int i0(T t2, int i3) {
            int iAbs = Math.abs(i3);
            int childCount = t2.getChildCount();
            int topInset = 0;
            int i4 = 0;
            while (true) {
                if (i4 >= childCount) {
                    break;
                }
                View childAt = t2.getChildAt(i4);
                e eVar = (e) childAt.getLayoutParams();
                Interpolator interpolatorD = eVar.d();
                if (iAbs < childAt.getTop() || iAbs > childAt.getBottom()) {
                    i4++;
                } else if (interpolatorD != null) {
                    int iC = eVar.c();
                    if ((iC & 1) != 0) {
                        topInset = 0 + childAt.getHeight() + ((LinearLayout.LayoutParams) eVar).topMargin + ((LinearLayout.LayoutParams) eVar).bottomMargin;
                        if ((iC & 2) != 0) {
                            topInset -= y.F(childAt);
                        }
                    }
                    if (y.B(childAt)) {
                        topInset -= t2.getTopInset();
                    }
                    if (topInset > 0) {
                        float f3 = topInset;
                        return Integer.signum(i3) * (childAt.getTop() + Math.round(f3 * interpolatorD.getInterpolation((iAbs - childAt.getTop()) / f3)));
                    }
                }
            }
            return i3;
        }

        private boolean v0(CoordinatorLayout coordinatorLayout, T t2) {
            List<View> listS = coordinatorLayout.s(t2);
            int size = listS.size();
            for (int i3 = 0; i3 < size; i3++) {
                CoordinatorLayout.c cVarF = ((CoordinatorLayout.f) listS.get(i3).getLayoutParams()).f();
                if (cVarF instanceof ScrollingViewBehavior) {
                    return ((ScrollingViewBehavior) cVarF).K() != 0;
                }
            }
            return false;
        }

        private void w0(CoordinatorLayout coordinatorLayout, T t2) {
            int topInset = t2.getTopInset() + t2.getPaddingTop();
            int iM = M() - topInset;
            int iE0 = e0(t2, iM);
            if (iE0 >= 0) {
                View childAt = t2.getChildAt(iE0);
                e eVar = (e) childAt.getLayoutParams();
                int iC = eVar.c();
                if ((iC & 17) == 17) {
                    int topInset2 = -childAt.getTop();
                    int iF = -childAt.getBottom();
                    if (iE0 == 0 && y.B(t2) && y.B(childAt)) {
                        topInset2 -= t2.getTopInset();
                    }
                    if (a0(iC, 2)) {
                        iF += y.F(childAt);
                    } else if (a0(iC, 5)) {
                        int iF2 = y.F(childAt) + iF;
                        if (iM < iF2) {
                            topInset2 = iF2;
                        } else {
                            iF = iF2;
                        }
                    }
                    if (a0(iC, 32)) {
                        topInset2 += ((LinearLayout.LayoutParams) eVar).topMargin;
                        iF -= ((LinearLayout.LayoutParams) eVar).bottomMargin;
                    }
                    V(coordinatorLayout, t2, t.a.b(X(iM, iF, topInset2) + topInset, -t2.getTotalScrollRange(), 0), 0.0f);
                }
            }
        }

        private void x0(CoordinatorLayout coordinatorLayout, T t2) {
            View viewF0;
            y.l0(coordinatorLayout, d.a.f1850f.b());
            y.l0(coordinatorLayout, d.a.f1851g.b());
            if (t2.getTotalScrollRange() == 0 || (viewF0 = f0(coordinatorLayout)) == null || !b0(t2)) {
                return;
            }
            if (!y.P(coordinatorLayout)) {
                y.r0(coordinatorLayout, new b());
            }
            this.f3522p = T(coordinatorLayout, t2, viewF0);
        }

        private void y0(CoordinatorLayout coordinatorLayout, T t2, int i3, int i4, boolean z2) {
            View viewD0 = d0(t2, i3);
            boolean zU = false;
            if (viewD0 != null) {
                int iC = ((e) viewD0.getLayoutParams()).c();
                if ((iC & 1) != 0) {
                    int iF = y.F(viewD0);
                    if (i4 <= 0 || (iC & 12) == 0 ? !((iC & 2) == 0 || (-i3) < (viewD0.getBottom() - iF) - t2.getTopInset()) : (-i3) >= (viewD0.getBottom() - iF) - t2.getTopInset()) {
                        zU = true;
                    }
                }
            }
            if (t2.l()) {
                zU = t2.u(c0(coordinatorLayout));
            }
            boolean zR = t2.r(zU);
            if (z2 || (zR && v0(coordinatorLayout, t2))) {
                t2.jumpDrawablesToCurrentState();
            }
        }

        @Override // com.google.android.material.appbar.a
        int M() {
            return E() + this.f3517k;
        }

        /* JADX INFO: Access modifiers changed from: package-private */
        @Override // com.google.android.material.appbar.a
        /* JADX INFO: renamed from: Y, reason: merged with bridge method [inline-methods] */
        public boolean H(T t2) {
            WeakReference<View> weakReference = this.f3521o;
            if (weakReference == null) {
                return true;
            }
            View view = weakReference.get();
            return (view == null || !view.isShown() || view.canScrollVertically(-1)) ? false : true;
        }

        /* JADX INFO: Access modifiers changed from: package-private */
        @Override // com.google.android.material.appbar.a
        /* JADX INFO: renamed from: g0, reason: merged with bridge method [inline-methods] */
        public int K(T t2) {
            return -t2.getDownNestedScrollRange();
        }

        /* JADX INFO: Access modifiers changed from: package-private */
        @Override // com.google.android.material.appbar.a
        /* JADX INFO: renamed from: h0, reason: merged with bridge method [inline-methods] */
        public int L(T t2) {
            return t2.getTotalScrollRange();
        }

        /* JADX INFO: Access modifiers changed from: package-private */
        @Override // com.google.android.material.appbar.a
        /* JADX INFO: renamed from: j0, reason: merged with bridge method [inline-methods] */
        public void N(CoordinatorLayout coordinatorLayout, T t2) {
            w0(coordinatorLayout, t2);
            if (t2.l()) {
                t2.r(t2.u(c0(coordinatorLayout)));
            }
        }

        @Override // com.google.android.material.appbar.c, androidx.coordinatorlayout.widget.CoordinatorLayout.c
        /* JADX INFO: renamed from: k0, reason: merged with bridge method [inline-methods] */
        public boolean l(CoordinatorLayout coordinatorLayout, T t2, int i3) {
            boolean zL = super.l(coordinatorLayout, t2, i3);
            int pendingAction = t2.getPendingAction();
            e eVar = this.f3520n;
            if (eVar == null || (pendingAction & 8) != 0) {
                if (pendingAction != 0) {
                    boolean z2 = (pendingAction & 4) != 0;
                    if ((pendingAction & 2) != 0) {
                        int i4 = -t2.getUpNestedPreScrollRange();
                        if (z2) {
                            V(coordinatorLayout, t2, i4, 0.0f);
                        } else {
                            P(coordinatorLayout, t2, i4);
                        }
                    } else if ((pendingAction & 1) != 0) {
                        if (z2) {
                            V(coordinatorLayout, t2, 0, 0.0f);
                        } else {
                            P(coordinatorLayout, t2, 0);
                        }
                    }
                }
            } else if (eVar.f3534g) {
                P(coordinatorLayout, t2, -t2.getTotalScrollRange());
            } else if (eVar.f3535h) {
                P(coordinatorLayout, t2, 0);
            } else {
                View childAt = t2.getChildAt(eVar.f3536i);
                P(coordinatorLayout, t2, (-childAt.getBottom()) + (this.f3520n.f3538k ? y.F(childAt) + t2.getTopInset() : Math.round(childAt.getHeight() * this.f3520n.f3537j)));
            }
            t2.n();
            this.f3520n = null;
            G(t.a.b(E(), -t2.getTotalScrollRange(), 0));
            y0(coordinatorLayout, t2, E(), 0, true);
            t2.m(E());
            x0(coordinatorLayout, t2);
            return zL;
        }

        @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.c
        /* JADX INFO: renamed from: l0, reason: merged with bridge method [inline-methods] */
        public boolean m(CoordinatorLayout coordinatorLayout, T t2, int i3, int i4, int i5, int i6) {
            if (((ViewGroup.MarginLayoutParams) ((CoordinatorLayout.f) t2.getLayoutParams())).height != -2) {
                return super.m(coordinatorLayout, t2, i3, i4, i5, i6);
            }
            coordinatorLayout.J(t2, i3, i4, View.MeasureSpec.makeMeasureSpec(0, 0), i6);
            return true;
        }

        @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.c
        /* JADX INFO: renamed from: m0, reason: merged with bridge method [inline-methods] */
        public void q(CoordinatorLayout coordinatorLayout, T t2, View view, int i3, int i4, int[] iArr, int i5) {
            int i6;
            int downNestedPreScrollRange;
            if (i4 != 0) {
                if (i4 < 0) {
                    i6 = -t2.getTotalScrollRange();
                    downNestedPreScrollRange = t2.getDownNestedPreScrollRange() + i6;
                } else {
                    i6 = -t2.getUpNestedPreScrollRange();
                    downNestedPreScrollRange = 0;
                }
                int i7 = i6;
                int i8 = downNestedPreScrollRange;
                if (i7 != i8) {
                    iArr[1] = O(coordinatorLayout, t2, i4, i7, i8);
                }
            }
            if (t2.l()) {
                t2.r(t2.u(view));
            }
        }

        @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.c
        /* JADX INFO: renamed from: n0, reason: merged with bridge method [inline-methods] */
        public void t(CoordinatorLayout coordinatorLayout, T t2, View view, int i3, int i4, int i5, int i6, int i7, int[] iArr) {
            if (i6 < 0) {
                iArr[1] = O(coordinatorLayout, t2, i6, -t2.getDownNestedScrollRange(), 0);
            }
            if (i6 == 0) {
                x0(coordinatorLayout, t2);
            }
        }

        @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.c
        /* JADX INFO: renamed from: o0, reason: merged with bridge method [inline-methods] */
        public void x(CoordinatorLayout coordinatorLayout, T t2, Parcelable parcelable) {
            if (parcelable instanceof e) {
                s0((e) parcelable, true);
                super.x(coordinatorLayout, t2, this.f3520n.j());
            } else {
                super.x(coordinatorLayout, t2, parcelable);
                this.f3520n = null;
            }
        }

        @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.c
        /* JADX INFO: renamed from: p0, reason: merged with bridge method [inline-methods] */
        public Parcelable y(CoordinatorLayout coordinatorLayout, T t2) {
            Parcelable parcelableY = super.y(coordinatorLayout, t2);
            e eVarT0 = t0(parcelableY, t2);
            return eVarT0 == null ? parcelableY : eVarT0;
        }

        @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.c
        /* JADX INFO: renamed from: q0, reason: merged with bridge method [inline-methods] */
        public boolean A(CoordinatorLayout coordinatorLayout, T t2, View view, View view2, int i3, int i4) {
            ValueAnimator valueAnimator;
            boolean z2 = (i3 & 2) != 0 && (t2.l() || Z(coordinatorLayout, t2, view));
            if (z2 && (valueAnimator = this.f3519m) != null) {
                valueAnimator.cancel();
            }
            this.f3521o = null;
            this.f3518l = i4;
            return z2;
        }

        @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.c
        /* JADX INFO: renamed from: r0, reason: merged with bridge method [inline-methods] */
        public void C(CoordinatorLayout coordinatorLayout, T t2, View view, int i3) {
            if (this.f3518l == 0 || i3 == 1) {
                w0(coordinatorLayout, t2);
                if (t2.l()) {
                    t2.r(t2.u(view));
                }
            }
            this.f3521o = new WeakReference<>(view);
        }

        void s0(e eVar, boolean z2) {
            if (this.f3520n == null || z2) {
                this.f3520n = eVar;
            }
        }

        e t0(Parcelable parcelable, T t2) {
            int iE = E();
            int childCount = t2.getChildCount();
            for (int i3 = 0; i3 < childCount; i3++) {
                View childAt = t2.getChildAt(i3);
                int bottom = childAt.getBottom() + iE;
                if (childAt.getTop() + iE <= 0 && bottom >= 0) {
                    if (parcelable == null) {
                        parcelable = w.a.f5875f;
                    }
                    e eVar = new e(parcelable);
                    boolean z2 = iE == 0;
                    eVar.f3535h = z2;
                    eVar.f3534g = !z2 && (-iE) >= t2.getTotalScrollRange();
                    eVar.f3536i = i3;
                    eVar.f3538k = bottom == y.F(childAt) + t2.getTopInset();
                    eVar.f3537j = bottom / childAt.getHeight();
                    return eVar;
                }
            }
            return null;
        }

        /* JADX INFO: Access modifiers changed from: package-private */
        @Override // com.google.android.material.appbar.a
        /* JADX INFO: renamed from: u0, reason: merged with bridge method [inline-methods] */
        public int Q(CoordinatorLayout coordinatorLayout, T t2, int i3, int i4, int i5) {
            int iM = M();
            int i6 = 0;
            if (i4 == 0 || iM < i4 || iM > i5) {
                this.f3517k = 0;
            } else {
                int iB = t.a.b(i3, i4, i5);
                if (iM != iB) {
                    int iI0 = t2.h() ? i0(t2, iB) : iB;
                    boolean zG = G(iI0);
                    int i7 = iM - iB;
                    this.f3517k = iB - iI0;
                    if (zG) {
                        while (i6 < t2.getChildCount()) {
                            e eVar = (e) t2.getChildAt(i6).getLayoutParams();
                            c cVarB = eVar.b();
                            if (cVarB != null && (eVar.c() & 1) != 0) {
                                cVarB.a(t2, t2.getChildAt(i6), E());
                            }
                            i6++;
                        }
                    }
                    if (!zG && t2.h()) {
                        coordinatorLayout.g(t2);
                    }
                    t2.m(E());
                    y0(coordinatorLayout, t2, iB, iB < iM ? -1 : 1, false);
                    i6 = i7;
                }
            }
            x0(coordinatorLayout, t2);
            return i6;
        }

        public BaseBehavior(Context context, AttributeSet attributeSet) {
            super(context, attributeSet);
        }

        protected static class e extends w.a {
            public static final Parcelable.Creator<e> CREATOR = new a();

            /* JADX INFO: renamed from: g, reason: collision with root package name */
            boolean f3534g;

            /* JADX INFO: renamed from: h, reason: collision with root package name */
            boolean f3535h;

            /* JADX INFO: renamed from: i, reason: collision with root package name */
            int f3536i;

            /* JADX INFO: renamed from: j, reason: collision with root package name */
            float f3537j;

            /* JADX INFO: renamed from: k, reason: collision with root package name */
            boolean f3538k;

            class a implements Parcelable.ClassLoaderCreator<e> {
                a() {
                }

                @Override // android.os.Parcelable.Creator
                /* JADX INFO: renamed from: a, reason: merged with bridge method [inline-methods] */
                public e createFromParcel(Parcel parcel) {
                    return new e(parcel, null);
                }

                @Override // android.os.Parcelable.ClassLoaderCreator
                /* JADX INFO: renamed from: b, reason: merged with bridge method [inline-methods] */
                public e createFromParcel(Parcel parcel, ClassLoader classLoader) {
                    return new e(parcel, classLoader);
                }

                @Override // android.os.Parcelable.Creator
                /* JADX INFO: renamed from: c, reason: merged with bridge method [inline-methods] */
                public e[] newArray(int i3) {
                    return new e[i3];
                }
            }

            public e(Parcel parcel, ClassLoader classLoader) {
                super(parcel, classLoader);
                this.f3534g = parcel.readByte() != 0;
                this.f3535h = parcel.readByte() != 0;
                this.f3536i = parcel.readInt();
                this.f3537j = parcel.readFloat();
                this.f3538k = parcel.readByte() != 0;
            }

            @Override // w.a, android.os.Parcelable
            public void writeToParcel(Parcel parcel, int i3) {
                super.writeToParcel(parcel, i3);
                parcel.writeByte(this.f3534g ? (byte) 1 : (byte) 0);
                parcel.writeByte(this.f3535h ? (byte) 1 : (byte) 0);
                parcel.writeInt(this.f3536i);
                parcel.writeFloat(this.f3537j);
                parcel.writeByte(this.f3538k ? (byte) 1 : (byte) 0);
            }

            public e(Parcelable parcelable) {
                super(parcelable);
            }
        }
    }

    public static class Behavior extends BaseBehavior<AppBarLayout> {
        public Behavior() {
        }

        public Behavior(Context context, AttributeSet attributeSet) {
            super(context, attributeSet);
        }
    }

    public static class ScrollingViewBehavior extends com.google.android.material.appbar.b {
        public ScrollingViewBehavior() {
        }

        private static int R(AppBarLayout appBarLayout) {
            CoordinatorLayout.c cVarF = ((CoordinatorLayout.f) appBarLayout.getLayoutParams()).f();
            if (cVarF instanceof BaseBehavior) {
                return ((BaseBehavior) cVarF).M();
            }
            return 0;
        }

        private void S(View view, View view2) {
            CoordinatorLayout.c cVarF = ((CoordinatorLayout.f) view2.getLayoutParams()).f();
            if (cVarF instanceof BaseBehavior) {
                y.c0(view, (((view2.getBottom() - view.getTop()) + ((BaseBehavior) cVarF).f3517k) + M()) - I(view2));
            }
        }

        private void T(View view, View view2) {
            if (view2 instanceof AppBarLayout) {
                AppBarLayout appBarLayout = (AppBarLayout) view2;
                if (appBarLayout.l()) {
                    appBarLayout.r(appBarLayout.u(view));
                }
            }
        }

        @Override // com.google.android.material.appbar.b
        float J(View view) {
            int i3;
            if (view instanceof AppBarLayout) {
                AppBarLayout appBarLayout = (AppBarLayout) view;
                int totalScrollRange = appBarLayout.getTotalScrollRange();
                int downNestedPreScrollRange = appBarLayout.getDownNestedPreScrollRange();
                int iR = R(appBarLayout);
                if ((downNestedPreScrollRange == 0 || totalScrollRange + iR > downNestedPreScrollRange) && (i3 = totalScrollRange - downNestedPreScrollRange) != 0) {
                    return (iR / i3) + 1.0f;
                }
            }
            return 0.0f;
        }

        @Override // com.google.android.material.appbar.b
        int L(View view) {
            return view instanceof AppBarLayout ? ((AppBarLayout) view).getTotalScrollRange() : super.L(view);
        }

        /* JADX INFO: Access modifiers changed from: package-private */
        @Override // com.google.android.material.appbar.b
        /* JADX INFO: renamed from: Q, reason: merged with bridge method [inline-methods] */
        public AppBarLayout H(List<View> list) {
            int size = list.size();
            for (int i3 = 0; i3 < size; i3++) {
                View view = list.get(i3);
                if (view instanceof AppBarLayout) {
                    return (AppBarLayout) view;
                }
            }
            return null;
        }

        @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.c
        public boolean e(CoordinatorLayout coordinatorLayout, View view, View view2) {
            return view2 instanceof AppBarLayout;
        }

        @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.c
        public boolean h(CoordinatorLayout coordinatorLayout, View view, View view2) {
            S(view, view2);
            T(view, view2);
            return false;
        }

        @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.c
        public void i(CoordinatorLayout coordinatorLayout, View view, View view2) {
            if (view2 instanceof AppBarLayout) {
                y.l0(coordinatorLayout, d.a.f1850f.b());
                y.l0(coordinatorLayout, d.a.f1851g.b());
                y.r0(coordinatorLayout, null);
            }
        }

        @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.c
        public boolean w(CoordinatorLayout coordinatorLayout, View view, Rect rect, boolean z2) {
            AppBarLayout appBarLayoutH = H(coordinatorLayout.r(view));
            if (appBarLayoutH != null) {
                rect.offset(view.getLeft(), view.getTop());
                Rect rect2 = this.f3561d;
                rect2.set(0, 0, coordinatorLayout.getWidth(), coordinatorLayout.getHeight());
                if (!rect2.contains(rect)) {
                    appBarLayoutH.o(false, !z2);
                    return true;
                }
            }
            return false;
        }

        public ScrollingViewBehavior(Context context, AttributeSet attributeSet) {
            super(context, attributeSet);
            TypedArray typedArrayObtainStyledAttributes = context.obtainStyledAttributes(attributeSet, k.n2);
            O(typedArrayObtainStyledAttributes.getDimensionPixelSize(k.o2, 0));
            typedArrayObtainStyledAttributes.recycle();
        }
    }

    class a implements ValueAnimator.AnimatorUpdateListener {

        /* JADX INFO: renamed from: a, reason: collision with root package name */
        final /* synthetic */ c1.g f3539a;

        a(c1.g gVar) {
            this.f3539a = gVar;
        }

        @Override // android.animation.ValueAnimator.AnimatorUpdateListener
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            float fFloatValue = ((Float) valueAnimator.getAnimatedValue()).floatValue();
            this.f3539a.W(fFloatValue);
            if (AppBarLayout.this.f3515v instanceof c1.g) {
                ((c1.g) AppBarLayout.this.f3515v).W(fFloatValue);
            }
            Iterator it = AppBarLayout.this.f3513t.iterator();
            while (it.hasNext()) {
                ((f) it.next()).a(fFloatValue, this.f3539a.z());
            }
        }
    }

    public interface b<T extends AppBarLayout> {
        void a(T t2, int i3);
    }

    public static abstract class c {
        public abstract void a(AppBarLayout appBarLayout, View view, float f3);
    }

    public static class d extends c {

        /* JADX INFO: renamed from: a, reason: collision with root package name */
        private final Rect f3541a = new Rect();

        /* JADX INFO: renamed from: b, reason: collision with root package name */
        private final Rect f3542b = new Rect();

        private static void b(Rect rect, AppBarLayout appBarLayout, View view) {
            view.getDrawingRect(rect);
            appBarLayout.offsetDescendantRectToMyCoords(view, rect);
            rect.offset(0, -appBarLayout.getTopInset());
        }

        @Override // com.google.android.material.appbar.AppBarLayout.c
        public void a(AppBarLayout appBarLayout, View view, float f3) {
            b(this.f3541a, appBarLayout, view);
            float fAbs = this.f3541a.top - Math.abs(f3);
            if (fAbs > 0.0f) {
                y.y0(view, null);
                view.setTranslationY(0.0f);
                return;
            }
            float fA = 1.0f - t.a.a(Math.abs(fAbs / this.f3541a.height()), 0.0f, 1.0f);
            float fHeight = (-fAbs) - ((this.f3541a.height() * 0.3f) * (1.0f - (fA * fA)));
            view.setTranslationY(fHeight);
            view.getDrawingRect(this.f3542b);
            this.f3542b.offset(0, (int) (-fHeight));
            y.y0(view, this.f3542b);
        }
    }

    public interface f {
        void a(float f3, int i3);
    }

    private void c() {
        WeakReference<View> weakReference = this.f3511r;
        if (weakReference != null) {
            weakReference.clear();
        }
        this.f3511r = null;
    }

    private View d(View view) {
        int i3;
        if (this.f3511r == null && (i3 = this.f3510q) != -1) {
            View viewFindViewById = view != null ? view.findViewById(i3) : null;
            if (viewFindViewById == null && (getParent() instanceof ViewGroup)) {
                viewFindViewById = ((ViewGroup) getParent()).findViewById(this.f3510q);
            }
            if (viewFindViewById != null) {
                this.f3511r = new WeakReference<>(viewFindViewById);
            }
        }
        WeakReference<View> weakReference = this.f3511r;
        if (weakReference != null) {
            return weakReference.get();
        }
        return null;
    }

    private boolean i() {
        int childCount = getChildCount();
        for (int i3 = 0; i3 < childCount; i3++) {
            if (((e) getChildAt(i3).getLayoutParams()).e()) {
                return true;
            }
        }
        return false;
    }

    private void k() {
        Behavior behavior = this.f3516w;
        BaseBehavior.e eVarT0 = (behavior == null || this.f3499f == -1 || this.f3503j != 0) ? null : behavior.t0(w.a.f5875f, this);
        this.f3499f = -1;
        this.f3500g = -1;
        this.f3501h = -1;
        if (eVarT0 != null) {
            this.f3516w.s0(eVarT0, false);
        }
    }

    private void p(boolean z2, boolean z3, boolean z4) {
        this.f3503j = (z2 ? 1 : 2) | (z3 ? 4 : 0) | (z4 ? 8 : 0);
        requestLayout();
    }

    private boolean q(boolean z2) {
        if (this.f3507n == z2) {
            return false;
        }
        this.f3507n = z2;
        refreshDrawableState();
        return true;
    }

    private boolean t() {
        return this.f3515v != null && getTopInset() > 0;
    }

    private boolean v() {
        if (getChildCount() <= 0) {
            return false;
        }
        View childAt = getChildAt(0);
        return (childAt.getVisibility() == 8 || y.B(childAt)) ? false : true;
    }

    private void w(c1.g gVar, boolean z2) {
        float dimension = getResources().getDimension(l0.d.f5350a);
        float f3 = z2 ? 0.0f : dimension;
        if (!z2) {
            dimension = 0.0f;
        }
        ValueAnimator valueAnimator = this.f3512s;
        if (valueAnimator != null) {
            valueAnimator.cancel();
        }
        ValueAnimator valueAnimatorOfFloat = ValueAnimator.ofFloat(f3, dimension);
        this.f3512s = valueAnimatorOfFloat;
        valueAnimatorOfFloat.setDuration(getResources().getInteger(l0.g.f5409a));
        this.f3512s.setInterpolator(m0.a.f5553a);
        this.f3512s.addUpdateListener(new a(gVar));
        this.f3512s.start();
    }

    private void x() {
        setWillNotDraw(!t());
    }

    @Override // android.widget.LinearLayout, android.view.ViewGroup
    protected boolean checkLayoutParams(ViewGroup.LayoutParams layoutParams) {
        return layoutParams instanceof e;
    }

    @Override // android.view.View
    public void draw(Canvas canvas) {
        super.draw(canvas);
        if (t()) {
            int iSave = canvas.save();
            canvas.translate(0.0f, -this.f3498e);
            this.f3515v.draw(canvas);
            canvas.restoreToCount(iSave);
        }
    }

    @Override // android.view.ViewGroup, android.view.View
    protected void drawableStateChanged() {
        super.drawableStateChanged();
        int[] drawableState = getDrawableState();
        Drawable drawable = this.f3515v;
        if (drawable != null && drawable.isStateful() && drawable.setState(drawableState)) {
            invalidateDrawable(drawable);
        }
    }

    /* JADX INFO: Access modifiers changed from: protected */
    @Override // android.widget.LinearLayout, android.view.ViewGroup
    /* JADX INFO: renamed from: e, reason: merged with bridge method [inline-methods] */
    public e generateDefaultLayoutParams() {
        return new e(-1, -2);
    }

    @Override // android.widget.LinearLayout, android.view.ViewGroup
    /* JADX INFO: renamed from: f, reason: merged with bridge method [inline-methods] */
    public e generateLayoutParams(AttributeSet attributeSet) {
        return new e(getContext(), attributeSet);
    }

    /* JADX INFO: Access modifiers changed from: protected */
    @Override // android.widget.LinearLayout, android.view.ViewGroup
    /* JADX INFO: renamed from: g, reason: merged with bridge method [inline-methods] */
    public e generateLayoutParams(ViewGroup.LayoutParams layoutParams) {
        return (Build.VERSION.SDK_INT < 19 || !(layoutParams instanceof LinearLayout.LayoutParams)) ? layoutParams instanceof ViewGroup.MarginLayoutParams ? new e((ViewGroup.MarginLayoutParams) layoutParams) : new e(layoutParams) : new e((LinearLayout.LayoutParams) layoutParams);
    }

    @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.b
    public CoordinatorLayout.c<AppBarLayout> getBehavior() {
        Behavior behavior = new Behavior();
        this.f3516w = behavior;
        return behavior;
    }

    int getDownNestedPreScrollRange() {
        int iMin;
        int iF;
        int i3 = this.f3500g;
        if (i3 != -1) {
            return i3;
        }
        int i4 = 0;
        for (int childCount = getChildCount() - 1; childCount >= 0; childCount--) {
            View childAt = getChildAt(childCount);
            e eVar = (e) childAt.getLayoutParams();
            int measuredHeight = childAt.getMeasuredHeight();
            int i5 = eVar.f3543a;
            if ((i5 & 5) != 5) {
                if (i4 > 0) {
                    break;
                }
            } else {
                int i6 = ((LinearLayout.LayoutParams) eVar).topMargin + ((LinearLayout.LayoutParams) eVar).bottomMargin;
                if ((i5 & 8) != 0) {
                    iF = y.F(childAt);
                } else if ((i5 & 2) != 0) {
                    iF = measuredHeight - y.F(childAt);
                } else {
                    iMin = i6 + measuredHeight;
                    if (childCount == 0 && y.B(childAt)) {
                        iMin = Math.min(iMin, measuredHeight - getTopInset());
                    }
                    i4 += iMin;
                }
                iMin = i6 + iF;
                if (childCount == 0) {
                    iMin = Math.min(iMin, measuredHeight - getTopInset());
                }
                i4 += iMin;
            }
        }
        int iMax = Math.max(0, i4);
        this.f3500g = iMax;
        return iMax;
    }

    int getDownNestedScrollRange() {
        int i3 = this.f3501h;
        if (i3 != -1) {
            return i3;
        }
        int childCount = getChildCount();
        int i4 = 0;
        int iF = 0;
        while (true) {
            if (i4 >= childCount) {
                break;
            }
            View childAt = getChildAt(i4);
            e eVar = (e) childAt.getLayoutParams();
            int measuredHeight = childAt.getMeasuredHeight() + ((LinearLayout.LayoutParams) eVar).topMargin + ((LinearLayout.LayoutParams) eVar).bottomMargin;
            int i5 = eVar.f3543a;
            if ((i5 & 1) == 0) {
                break;
            }
            iF += measuredHeight;
            if ((i5 & 2) != 0) {
                iF -= y.F(childAt);
                break;
            }
            i4++;
        }
        int iMax = Math.max(0, iF);
        this.f3501h = iMax;
        return iMax;
    }

    public int getLiftOnScrollTargetViewId() {
        return this.f3510q;
    }

    public final int getMinimumHeightForVisibleOverlappingContent() {
        int topInset = getTopInset();
        int iF = y.F(this);
        if (iF == 0) {
            int childCount = getChildCount();
            iF = childCount >= 1 ? y.F(getChildAt(childCount - 1)) : 0;
            if (iF == 0) {
                return getHeight() / 3;
            }
        }
        return (iF * 2) + topInset;
    }

    int getPendingAction() {
        return this.f3503j;
    }

    public Drawable getStatusBarForeground() {
        return this.f3515v;
    }

    @Deprecated
    public float getTargetElevation() {
        return 0.0f;
    }

    final int getTopInset() {
        j0 j0Var = this.f3504k;
        if (j0Var != null) {
            return j0Var.k();
        }
        return 0;
    }

    public final int getTotalScrollRange() {
        int i3 = this.f3499f;
        if (i3 != -1) {
            return i3;
        }
        int childCount = getChildCount();
        int i4 = 0;
        int iF = 0;
        while (true) {
            if (i4 >= childCount) {
                break;
            }
            View childAt = getChildAt(i4);
            e eVar = (e) childAt.getLayoutParams();
            int measuredHeight = childAt.getMeasuredHeight();
            int i5 = eVar.f3543a;
            if ((i5 & 1) == 0) {
                break;
            }
            iF += measuredHeight + ((LinearLayout.LayoutParams) eVar).topMargin + ((LinearLayout.LayoutParams) eVar).bottomMargin;
            if (i4 == 0 && y.B(childAt)) {
                iF -= getTopInset();
            }
            if ((i5 & 2) != 0) {
                iF -= y.F(childAt);
                break;
            }
            i4++;
        }
        int iMax = Math.max(0, iF);
        this.f3499f = iMax;
        return iMax;
    }

    int getUpNestedPreScrollRange() {
        return getTotalScrollRange();
    }

    boolean h() {
        return this.f3502i;
    }

    boolean j() {
        return getTotalScrollRange() != 0;
    }

    public boolean l() {
        return this.f3509p;
    }

    void m(int i3) {
        this.f3498e = i3;
        if (!willNotDraw()) {
            y.i0(this);
        }
        List<b> list = this.f3505l;
        if (list != null) {
            int size = list.size();
            for (int i4 = 0; i4 < size; i4++) {
                b bVar = this.f3505l.get(i4);
                if (bVar != null) {
                    bVar.a(this, i3);
                }
            }
        }
    }

    void n() {
        this.f3503j = 0;
    }

    public void o(boolean z2, boolean z3) {
        p(z2, z3, true);
    }

    @Override // android.view.ViewGroup, android.view.View
    protected void onAttachedToWindow() {
        super.onAttachedToWindow();
        h.e(this);
    }

    @Override // android.view.ViewGroup, android.view.View
    protected int[] onCreateDrawableState(int i3) {
        if (this.f3514u == null) {
            this.f3514u = new int[4];
        }
        int[] iArr = this.f3514u;
        int[] iArrOnCreateDrawableState = super.onCreateDrawableState(i3 + iArr.length);
        boolean z2 = this.f3507n;
        int i4 = l0.b.C;
        if (!z2) {
            i4 = -i4;
        }
        iArr[0] = i4;
        iArr[1] = (z2 && this.f3508o) ? l0.b.D : -l0.b.D;
        int i5 = l0.b.A;
        if (!z2) {
            i5 = -i5;
        }
        iArr[2] = i5;
        iArr[3] = (z2 && this.f3508o) ? l0.b.f5343z : -l0.b.f5343z;
        return LinearLayout.mergeDrawableStates(iArrOnCreateDrawableState, iArr);
    }

    @Override // android.view.ViewGroup, android.view.View
    protected void onDetachedFromWindow() {
        super.onDetachedFromWindow();
        c();
    }

    @Override // android.widget.LinearLayout, android.view.ViewGroup, android.view.View
    protected void onLayout(boolean z2, int i3, int i4, int i5, int i6) {
        super.onLayout(z2, i3, i4, i5, i6);
        boolean z3 = true;
        if (y.B(this) && v()) {
            int topInset = getTopInset();
            for (int childCount = getChildCount() - 1; childCount >= 0; childCount--) {
                y.c0(getChildAt(childCount), topInset);
            }
        }
        k();
        this.f3502i = false;
        int childCount2 = getChildCount();
        int i7 = 0;
        while (true) {
            if (i7 >= childCount2) {
                break;
            }
            if (((e) getChildAt(i7).getLayoutParams()).d() != null) {
                this.f3502i = true;
                break;
            }
            i7++;
        }
        Drawable drawable = this.f3515v;
        if (drawable != null) {
            drawable.setBounds(0, 0, getWidth(), getTopInset());
        }
        if (this.f3506m) {
            return;
        }
        if (!this.f3509p && !i()) {
            z3 = false;
        }
        q(z3);
    }

    @Override // android.widget.LinearLayout, android.view.View
    protected void onMeasure(int i3, int i4) {
        super.onMeasure(i3, i4);
        int mode = View.MeasureSpec.getMode(i4);
        if (mode != 1073741824 && y.B(this) && v()) {
            int measuredHeight = getMeasuredHeight();
            if (mode == Integer.MIN_VALUE) {
                measuredHeight = t.a.b(getMeasuredHeight() + getTopInset(), 0, View.MeasureSpec.getSize(i4));
            } else if (mode == 0) {
                measuredHeight += getTopInset();
            }
            setMeasuredDimension(getMeasuredWidth(), measuredHeight);
        }
        k();
    }

    boolean r(boolean z2) {
        return s(z2, !this.f3506m);
    }

    boolean s(boolean z2, boolean z3) {
        if (!z3 || this.f3508o == z2) {
            return false;
        }
        this.f3508o = z2;
        refreshDrawableState();
        if (!this.f3509p || !(getBackground() instanceof c1.g)) {
            return true;
        }
        w((c1.g) getBackground(), z2);
        return true;
    }

    @Override // android.view.View
    public void setElevation(float f3) {
        super.setElevation(f3);
        h.d(this, f3);
    }

    public void setExpanded(boolean z2) {
        o(z2, y.V(this));
    }

    public void setLiftOnScroll(boolean z2) {
        this.f3509p = z2;
    }

    public void setLiftOnScrollTargetViewId(int i3) {
        this.f3510q = i3;
        c();
    }

    public void setLiftableOverrideEnabled(boolean z2) {
        this.f3506m = z2;
    }

    @Override // android.widget.LinearLayout
    public void setOrientation(int i3) {
        if (i3 != 1) {
            throw new IllegalArgumentException("AppBarLayout is always vertical and does not support horizontal orientation");
        }
        super.setOrientation(i3);
    }

    public void setStatusBarForeground(Drawable drawable) {
        Drawable drawable2 = this.f3515v;
        if (drawable2 != drawable) {
            if (drawable2 != null) {
                drawable2.setCallback(null);
            }
            Drawable drawableMutate = drawable != null ? drawable.mutate() : null;
            this.f3515v = drawableMutate;
            if (drawableMutate != null) {
                if (drawableMutate.isStateful()) {
                    this.f3515v.setState(getDrawableState());
                }
                androidx.core.graphics.drawable.a.m(this.f3515v, y.E(this));
                this.f3515v.setVisible(getVisibility() == 0, false);
                this.f3515v.setCallback(this);
            }
            x();
            y.i0(this);
        }
    }

    public void setStatusBarForegroundColor(int i3) {
        setStatusBarForeground(new ColorDrawable(i3));
    }

    public void setStatusBarForegroundResource(int i3) {
        setStatusBarForeground(d.a.b(getContext(), i3));
    }

    @Deprecated
    public void setTargetElevation(float f3) {
        if (Build.VERSION.SDK_INT >= 21) {
            com.google.android.material.appbar.e.a(this, f3);
        }
    }

    @Override // android.view.View
    public void setVisibility(int i3) {
        super.setVisibility(i3);
        boolean z2 = i3 == 0;
        Drawable drawable = this.f3515v;
        if (drawable != null) {
            drawable.setVisible(z2, false);
        }
    }

    boolean u(View view) {
        View viewD = d(view);
        if (viewD != null) {
            view = viewD;
        }
        return view != null && (view.canScrollVertically(-1) || view.getScrollY() > 0);
    }

    @Override // android.view.View
    protected boolean verifyDrawable(Drawable drawable) {
        return super.verifyDrawable(drawable) || drawable == this.f3515v;
    }

    public static class e extends LinearLayout.LayoutParams {

        /* JADX INFO: renamed from: a, reason: collision with root package name */
        int f3543a;

        /* JADX INFO: renamed from: b, reason: collision with root package name */
        private c f3544b;

        /* JADX INFO: renamed from: c, reason: collision with root package name */
        Interpolator f3545c;

        public e(Context context, AttributeSet attributeSet) {
            super(context, attributeSet);
            this.f3543a = 1;
            TypedArray typedArrayObtainStyledAttributes = context.obtainStyledAttributes(attributeSet, k.f5460a);
            this.f3543a = typedArrayObtainStyledAttributes.getInt(k.f5468c, 0);
            f(a(typedArrayObtainStyledAttributes.getInt(k.f5464b, 0)));
            int i3 = k.f5472d;
            if (typedArrayObtainStyledAttributes.hasValue(i3)) {
                this.f3545c = AnimationUtils.loadInterpolator(context, typedArrayObtainStyledAttributes.getResourceId(i3, 0));
            }
            typedArrayObtainStyledAttributes.recycle();
        }

        private c a(int i3) {
            if (i3 != 1) {
                return null;
            }
            return new d();
        }

        public c b() {
            return this.f3544b;
        }

        public int c() {
            return this.f3543a;
        }

        public Interpolator d() {
            return this.f3545c;
        }

        boolean e() {
            int i3 = this.f3543a;
            return (i3 & 1) == 1 && (i3 & 10) != 0;
        }

        public void f(c cVar) {
            this.f3544b = cVar;
        }

        public e(int i3, int i4) {
            super(i3, i4);
            this.f3543a = 1;
        }

        public e(ViewGroup.LayoutParams layoutParams) {
            super(layoutParams);
            this.f3543a = 1;
        }

        public e(ViewGroup.MarginLayoutParams marginLayoutParams) {
            super(marginLayoutParams);
            this.f3543a = 1;
        }

        public e(LinearLayout.LayoutParams layoutParams) {
            super(layoutParams);
            this.f3543a = 1;
        }
    }
}
