package com.google.android.material.appbar;

import android.animation.ValueAnimator;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Rect;
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 androidx.coordinatorlayout.widget.CoordinatorLayout;
import c.f.l.b0;
import c.f.l.k;
import c.f.l.t;
import d.c.a.a.i;
import java.lang.ref.WeakReference;
import java.util.List;

/* JADX INFO: loaded from: classes.dex */
@CoordinatorLayout.d(Behavior.class)
public class AppBarLayout extends LinearLayout {

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

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

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

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

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

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

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    private List<a> f1690k;
    private boolean l;
    private boolean m;
    private boolean n;
    private boolean o;
    private int[] p;

    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 P(AppBarLayout appBarLayout) {
            CoordinatorLayout.c cVarF = ((CoordinatorLayout.f) appBarLayout.getLayoutParams()).f();
            if (cVarF instanceof BaseBehavior) {
                return ((BaseBehavior) cVarF).L();
            }
            return 0;
        }

        private void Q(View view, View view2) {
            CoordinatorLayout.c cVarF = ((CoordinatorLayout.f) view2.getLayoutParams()).f();
            if (cVarF instanceof BaseBehavior) {
                t.N(view, (((view2.getBottom() - view.getTop()) + ((BaseBehavior) cVarF).f1691k) + L()) - H(view2));
            }
        }

        private void R(View view, View view2) {
            if (view2 instanceof AppBarLayout) {
                AppBarLayout appBarLayout = (AppBarLayout) view2;
                if (appBarLayout.i()) {
                    appBarLayout.n(view.getScrollY() > 0);
                }
            }
        }

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

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

        /* JADX INFO: Access modifiers changed from: package-private */
        @Override // com.google.android.material.appbar.b
        /* JADX INFO: renamed from: O, reason: merged with bridge method [inline-methods] */
        public AppBarLayout G(List<View> list) {
            int size = list.size();
            for (int i2 = 0; i2 < size; i2++) {
                View view = list.get(i2);
                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) {
            Q(view, view2);
            R(view, view2);
            return false;
        }

        @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.c
        public boolean v(CoordinatorLayout coordinatorLayout, View view, Rect rect, boolean z) {
            AppBarLayout appBarLayoutG = G(coordinatorLayout.r(view));
            if (appBarLayoutG != null) {
                rect.offset(view.getLeft(), view.getTop());
                Rect rect2 = this.f1708d;
                rect2.set(0, 0, coordinatorLayout.getWidth(), coordinatorLayout.getHeight());
                if (!rect2.contains(rect)) {
                    appBarLayoutG.k(false, !z);
                    return true;
                }
            }
            return false;
        }

        public ScrollingViewBehavior(Context context, AttributeSet attributeSet) {
            super(context, attributeSet);
            TypedArray typedArrayObtainStyledAttributes = context.obtainStyledAttributes(attributeSet, i.ScrollingViewBehavior_Layout);
            N(typedArrayObtainStyledAttributes.getDimensionPixelSize(i.ScrollingViewBehavior_Layout_behavior_overlapTop, 0));
            typedArrayObtainStyledAttributes.recycle();
        }
    }

    public interface a<T extends AppBarLayout> {
        void a(T t, int i2);
    }

    private boolean f() {
        int childCount = getChildCount();
        for (int i2 = 0; i2 < childCount; i2++) {
            if (((b) getChildAt(i2).getLayoutParams()).c()) {
                return true;
            }
        }
        return false;
    }

    private void h() {
        this.f1684b = -1;
        this.f1685f = -1;
        this.f1686g = -1;
    }

    private void l(boolean z, boolean z2, boolean z3) {
        this.f1688i = (z ? 1 : 2) | (z2 ? 4 : 0) | (z3 ? 8 : 0);
        requestLayout();
    }

    private boolean m(boolean z) {
        if (this.m == z) {
            return false;
        }
        this.m = z;
        refreshDrawableState();
        return true;
    }

    void a(int i2) {
        List<a> list = this.f1690k;
        if (list != null) {
            int size = list.size();
            for (int i3 = 0; i3 < size; i3++) {
                a aVar = this.f1690k.get(i3);
                if (aVar != null) {
                    aVar.a(this, i2);
                }
            }
        }
    }

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

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

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

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

    boolean e() {
        return this.f1687h;
    }

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

    int getDownNestedPreScrollRange() {
        int i2 = this.f1685f;
        if (i2 != -1) {
            return i2;
        }
        int iV = 0;
        for (int childCount = getChildCount() - 1; childCount >= 0; childCount--) {
            View childAt = getChildAt(childCount);
            b bVar = (b) childAt.getLayoutParams();
            int measuredHeight = childAt.getMeasuredHeight();
            int i3 = bVar.a;
            if ((i3 & 5) != 5) {
                if (iV > 0) {
                    break;
                }
            } else {
                int i4 = iV + ((LinearLayout.LayoutParams) bVar).topMargin + ((LinearLayout.LayoutParams) bVar).bottomMargin;
                iV = (i3 & 8) != 0 ? i4 + t.v(childAt) : i4 + (measuredHeight - ((i3 & 2) != 0 ? t.v(childAt) : getTopInset()));
            }
        }
        int iMax = Math.max(0, iV);
        this.f1685f = iMax;
        return iMax;
    }

    int getDownNestedScrollRange() {
        int i2 = this.f1686g;
        if (i2 != -1) {
            return i2;
        }
        int childCount = getChildCount();
        int i3 = 0;
        int iV = 0;
        while (true) {
            if (i3 >= childCount) {
                break;
            }
            View childAt = getChildAt(i3);
            b bVar = (b) childAt.getLayoutParams();
            int measuredHeight = childAt.getMeasuredHeight() + ((LinearLayout.LayoutParams) bVar).topMargin + ((LinearLayout.LayoutParams) bVar).bottomMargin;
            int i4 = bVar.a;
            if ((i4 & 1) == 0) {
                break;
            }
            iV += measuredHeight;
            if ((i4 & 2) != 0) {
                iV -= t.v(childAt) + getTopInset();
                break;
            }
            i3++;
        }
        int iMax = Math.max(0, iV);
        this.f1686g = iMax;
        return iMax;
    }

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

    int getPendingAction() {
        return this.f1688i;
    }

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

    final int getTopInset() {
        b0 b0Var = this.f1689j;
        if (b0Var != null) {
            return b0Var.g();
        }
        return 0;
    }

    public final int getTotalScrollRange() {
        int i2 = this.f1684b;
        if (i2 != -1) {
            return i2;
        }
        int childCount = getChildCount();
        int i3 = 0;
        int iV = 0;
        while (true) {
            if (i3 >= childCount) {
                break;
            }
            View childAt = getChildAt(i3);
            b bVar = (b) childAt.getLayoutParams();
            int measuredHeight = childAt.getMeasuredHeight();
            int i4 = bVar.a;
            if ((i4 & 1) == 0) {
                break;
            }
            iV += measuredHeight + ((LinearLayout.LayoutParams) bVar).topMargin + ((LinearLayout.LayoutParams) bVar).bottomMargin;
            if ((i4 & 2) != 0) {
                iV -= t.v(childAt);
                break;
            }
            i3++;
        }
        int iMax = Math.max(0, iV - getTopInset());
        this.f1684b = iMax;
        return iMax;
    }

    int getUpNestedPreScrollRange() {
        return getTotalScrollRange();
    }

    public boolean i() {
        return this.o;
    }

    void j() {
        this.f1688i = 0;
    }

    public void k(boolean z, boolean z2) {
        l(z, z2, true);
    }

    boolean n(boolean z) {
        if (this.n == z) {
            return false;
        }
        this.n = z;
        refreshDrawableState();
        return true;
    }

    @Override // android.view.ViewGroup, android.view.View
    protected int[] onCreateDrawableState(int i2) {
        if (this.p == null) {
            this.p = new int[4];
        }
        int[] iArr = this.p;
        int[] iArrOnCreateDrawableState = super.onCreateDrawableState(i2 + iArr.length);
        iArr[0] = this.m ? d.c.a.a.b.state_liftable : -d.c.a.a.b.state_liftable;
        iArr[1] = (this.m && this.n) ? d.c.a.a.b.state_lifted : -d.c.a.a.b.state_lifted;
        iArr[2] = this.m ? d.c.a.a.b.state_collapsible : -d.c.a.a.b.state_collapsible;
        iArr[3] = (this.m && this.n) ? d.c.a.a.b.state_collapsed : -d.c.a.a.b.state_collapsed;
        return LinearLayout.mergeDrawableStates(iArrOnCreateDrawableState, iArr);
    }

    @Override // android.widget.LinearLayout, android.view.ViewGroup, android.view.View
    protected void onLayout(boolean z, int i2, int i3, int i4, int i5) {
        super.onLayout(z, i2, i3, i4, i5);
        h();
        this.f1687h = false;
        int childCount = getChildCount();
        int i6 = 0;
        while (true) {
            if (i6 >= childCount) {
                break;
            }
            if (((b) getChildAt(i6).getLayoutParams()).b() != null) {
                this.f1687h = true;
                break;
            }
            i6++;
        }
        if (this.l) {
            return;
        }
        m(this.o || f());
    }

    @Override // android.widget.LinearLayout, android.view.View
    protected void onMeasure(int i2, int i3) {
        super.onMeasure(i2, i3);
        h();
    }

    public void setExpanded(boolean z) {
        k(z, t.H(this));
    }

    public void setLiftOnScroll(boolean z) {
        this.o = z;
    }

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

    @Deprecated
    public void setTargetElevation(float f2) {
        if (Build.VERSION.SDK_INT >= 21) {
            e.a(this, f2);
        }
    }

    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 f1691k;
        private int l;
        private ValueAnimator m;
        private int n;
        private boolean o;
        private float p;
        private WeakReference<View> q;
        private b r;

        class a implements ValueAnimator.AnimatorUpdateListener {
            final /* synthetic */ CoordinatorLayout a;

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

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

            @Override // android.animation.ValueAnimator.AnimatorUpdateListener
            public void onAnimationUpdate(ValueAnimator valueAnimator) {
                BaseBehavior.this.O(this.a, this.f1692b, ((Integer) valueAnimator.getAnimatedValue()).intValue());
            }
        }

        public static abstract class b<T extends AppBarLayout> {
            public abstract boolean a(T t);
        }

        public BaseBehavior() {
            this.n = -1;
        }

        private void R(CoordinatorLayout coordinatorLayout, T t, int i2, float f2) {
            int iAbs = Math.abs(L() - i2);
            float fAbs = Math.abs(f2);
            S(coordinatorLayout, t, i2, fAbs > 0.0f ? Math.round((iAbs / fAbs) * 1000.0f) * 3 : (int) (((iAbs / t.getHeight()) + 1.0f) * 150.0f));
        }

        private void S(CoordinatorLayout coordinatorLayout, T t, int i2, int i3) {
            int iL = L();
            if (iL == i2) {
                ValueAnimator valueAnimator = this.m;
                if (valueAnimator == null || !valueAnimator.isRunning()) {
                    return;
                }
                this.m.cancel();
                return;
            }
            ValueAnimator valueAnimator2 = this.m;
            if (valueAnimator2 == null) {
                ValueAnimator valueAnimator3 = new ValueAnimator();
                this.m = valueAnimator3;
                valueAnimator3.setInterpolator(d.c.a.a.j.a.f3321d);
                this.m.addUpdateListener(new a(coordinatorLayout, t));
            } else {
                valueAnimator2.cancel();
            }
            this.m.setDuration(Math.min(i3, 600));
            this.m.setIntValues(iL, i2);
            this.m.start();
        }

        private boolean U(CoordinatorLayout coordinatorLayout, T t, View view) {
            return t.g() && coordinatorLayout.getHeight() - view.getHeight() <= t.getHeight();
        }

        private static boolean V(int i2, int i3) {
            return (i2 & i3) == i3;
        }

        private View W(CoordinatorLayout coordinatorLayout) {
            int childCount = coordinatorLayout.getChildCount();
            for (int i2 = 0; i2 < childCount; i2++) {
                View childAt = coordinatorLayout.getChildAt(i2);
                if (childAt instanceof k) {
                    return childAt;
                }
            }
            return null;
        }

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

        private int Y(T t, int i2) {
            int childCount = t.getChildCount();
            for (int i3 = 0; i3 < childCount; i3++) {
                View childAt = t.getChildAt(i3);
                int top = childAt.getTop();
                int bottom = childAt.getBottom();
                b bVar = (b) childAt.getLayoutParams();
                if (V(bVar.a(), 32)) {
                    top -= ((LinearLayout.LayoutParams) bVar).topMargin;
                    bottom += ((LinearLayout.LayoutParams) bVar).bottomMargin;
                }
                int i4 = -i2;
                if (top <= i4 && bottom >= i4) {
                    return i3;
                }
            }
            return -1;
        }

        private int b0(T t, int i2) {
            int iAbs = Math.abs(i2);
            int childCount = t.getChildCount();
            int topInset = 0;
            int i3 = 0;
            while (true) {
                if (i3 >= childCount) {
                    break;
                }
                View childAt = t.getChildAt(i3);
                b bVar = (b) childAt.getLayoutParams();
                Interpolator interpolatorB = bVar.b();
                if (iAbs < childAt.getTop() || iAbs > childAt.getBottom()) {
                    i3++;
                } else if (interpolatorB != null) {
                    int iA = bVar.a();
                    if ((iA & 1) != 0) {
                        topInset = 0 + childAt.getHeight() + ((LinearLayout.LayoutParams) bVar).topMargin + ((LinearLayout.LayoutParams) bVar).bottomMargin;
                        if ((iA & 2) != 0) {
                            topInset -= t.v(childAt);
                        }
                    }
                    if (t.r(childAt)) {
                        topInset -= t.getTopInset();
                    }
                    if (topInset > 0) {
                        float f2 = topInset;
                        return Integer.signum(i2) * (childAt.getTop() + Math.round(f2 * interpolatorB.getInterpolation((iAbs - childAt.getTop()) / f2)));
                    }
                }
            }
            return i2;
        }

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

        private void n0(CoordinatorLayout coordinatorLayout, T t) {
            int iL = L();
            int iY = Y(t, iL);
            if (iY >= 0) {
                View childAt = t.getChildAt(iY);
                b bVar = (b) childAt.getLayoutParams();
                int iA = bVar.a();
                if ((iA & 17) == 17) {
                    int i2 = -childAt.getTop();
                    int iV = -childAt.getBottom();
                    if (iY == t.getChildCount() - 1) {
                        iV += t.getTopInset();
                    }
                    if (V(iA, 2)) {
                        iV += t.v(childAt);
                    } else if (V(iA, 5)) {
                        int iV2 = t.v(childAt) + iV;
                        if (iL < iV2) {
                            i2 = iV2;
                        } else {
                            iV = iV2;
                        }
                    }
                    if (V(iA, 32)) {
                        i2 += ((LinearLayout.LayoutParams) bVar).topMargin;
                        iV -= ((LinearLayout.LayoutParams) bVar).bottomMargin;
                    }
                    if (iL < (iV + i2) / 2) {
                        i2 = iV;
                    }
                    R(coordinatorLayout, t, c.f.g.a.a(i2, -t.getTotalScrollRange(), 0), 0.0f);
                }
            }
        }

        private void o0(int i2, T t, View view, int i3) {
            if (i3 == 1) {
                int iL = L();
                if ((i2 >= 0 || iL != 0) && (i2 <= 0 || iL != (-t.getDownNestedScrollRange()))) {
                    return;
                }
                t.l0(view, 1);
            }
        }

        /* JADX WARN: Removed duplicated region for block: B:18:0x0041  */
        /*
            Code decompiled incorrectly, please refer to instructions dump.
            To view partially-correct add '--show-bad-code' argument
        */
        private void p0(androidx.coordinatorlayout.widget.CoordinatorLayout r6, T r7, int r8, int r9, boolean r10) {
            /*
                r5 = this;
                android.view.View r0 = X(r7, r8)
                if (r0 == 0) goto L6e
                android.view.ViewGroup$LayoutParams r1 = r0.getLayoutParams()
                com.google.android.material.appbar.AppBarLayout$b r1 = (com.google.android.material.appbar.AppBarLayout.b) r1
                int r1 = r1.a()
                r2 = r1 & 1
                r3 = 1
                r4 = 0
                if (r2 == 0) goto L41
                int r2 = c.f.l.t.v(r0)
                if (r9 <= 0) goto L2f
                r9 = r1 & 12
                if (r9 == 0) goto L2f
                int r8 = -r8
                int r9 = r0.getBottom()
                int r9 = r9 - r2
                int r0 = r7.getTopInset()
                int r9 = r9 - r0
                if (r8 < r9) goto L41
            L2d:
                r8 = r3
                goto L42
            L2f:
                r9 = r1 & 2
                if (r9 == 0) goto L41
                int r8 = -r8
                int r9 = r0.getBottom()
                int r9 = r9 - r2
                int r0 = r7.getTopInset()
                int r9 = r9 - r0
                if (r8 < r9) goto L41
                goto L2d
            L41:
                r8 = r4
            L42:
                boolean r9 = r7.i()
                if (r9 == 0) goto L57
                android.view.View r9 = r5.W(r6)
                if (r9 == 0) goto L57
                int r8 = r9.getScrollY()
                if (r8 <= 0) goto L55
                goto L56
            L55:
                r3 = r4
            L56:
                r8 = r3
            L57:
                boolean r8 = r7.n(r8)
                int r9 = android.os.Build.VERSION.SDK_INT
                r0 = 11
                if (r9 < r0) goto L6e
                if (r10 != 0) goto L6b
                if (r8 == 0) goto L6e
                boolean r6 = r5.m0(r6, r7)
                if (r6 == 0) goto L6e
            L6b:
                r7.jumpDrawablesToCurrentState()
            L6e:
                return
            */
            throw new UnsupportedOperationException("Method not decompiled: com.google.android.material.appbar.AppBarLayout.BaseBehavior.p0(androidx.coordinatorlayout.widget.CoordinatorLayout, com.google.android.material.appbar.AppBarLayout, int, int, boolean):void");
        }

        @Override // com.google.android.material.appbar.a
        int L() {
            return D() + this.f1691k;
        }

        /* JADX INFO: Access modifiers changed from: package-private */
        @Override // com.google.android.material.appbar.a
        /* JADX INFO: renamed from: T, reason: merged with bridge method [inline-methods] */
        public boolean G(T t) {
            b bVar = this.r;
            if (bVar != null) {
                return bVar.a(t);
            }
            WeakReference<View> weakReference = this.q;
            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: Z, reason: merged with bridge method [inline-methods] */
        public int J(T t) {
            return -t.getDownNestedScrollRange();
        }

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

        /* JADX INFO: Access modifiers changed from: package-private */
        @Override // com.google.android.material.appbar.a
        /* JADX INFO: renamed from: c0, reason: merged with bridge method [inline-methods] */
        public void M(CoordinatorLayout coordinatorLayout, T t) {
            n0(coordinatorLayout, t);
        }

        @Override // com.google.android.material.appbar.c, androidx.coordinatorlayout.widget.CoordinatorLayout.c
        /* JADX INFO: renamed from: d0, reason: merged with bridge method [inline-methods] */
        public boolean l(CoordinatorLayout coordinatorLayout, T t, int i2) {
            boolean zL = super.l(coordinatorLayout, t, i2);
            int pendingAction = t.getPendingAction();
            int i3 = this.n;
            if (i3 >= 0 && (pendingAction & 8) == 0) {
                View childAt = t.getChildAt(i3);
                O(coordinatorLayout, t, (-childAt.getBottom()) + (this.o ? t.v(childAt) + t.getTopInset() : Math.round(childAt.getHeight() * this.p)));
            } else if (pendingAction != 0) {
                boolean z = (pendingAction & 4) != 0;
                if ((pendingAction & 2) != 0) {
                    int i4 = -t.getUpNestedPreScrollRange();
                    if (z) {
                        R(coordinatorLayout, t, i4, 0.0f);
                    } else {
                        O(coordinatorLayout, t, i4);
                    }
                } else if ((pendingAction & 1) != 0) {
                    if (z) {
                        R(coordinatorLayout, t, 0, 0.0f);
                    } else {
                        O(coordinatorLayout, t, 0);
                    }
                }
            }
            t.j();
            this.n = -1;
            F(c.f.g.a.a(D(), -t.getTotalScrollRange(), 0));
            p0(coordinatorLayout, t, D(), 0, true);
            t.a(D());
            return zL;
        }

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

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

        @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.c
        /* JADX INFO: renamed from: g0, reason: merged with bridge method [inline-methods] */
        public void s(CoordinatorLayout coordinatorLayout, T t, View view, int i2, int i3, int i4, int i5, int i6) {
            if (i5 < 0) {
                N(coordinatorLayout, t, i5, -t.getDownNestedScrollRange(), 0);
                o0(i5, t, view, i6);
            }
            if (t.i()) {
                t.n(view.getScrollY() > 0);
            }
        }

        @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.c
        /* JADX INFO: renamed from: h0, reason: merged with bridge method [inline-methods] */
        public void w(CoordinatorLayout coordinatorLayout, T t, Parcelable parcelable) {
            if (!(parcelable instanceof c)) {
                super.w(coordinatorLayout, t, parcelable);
                this.n = -1;
                return;
            }
            c cVar = (c) parcelable;
            super.w(coordinatorLayout, t, cVar.a());
            this.n = cVar.f1694g;
            this.p = cVar.f1695h;
            this.o = cVar.f1696i;
        }

        @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.c
        /* JADX INFO: renamed from: i0, reason: merged with bridge method [inline-methods] */
        public Parcelable x(CoordinatorLayout coordinatorLayout, T t) {
            Parcelable parcelableX = super.x(coordinatorLayout, t);
            int iD = D();
            int childCount = t.getChildCount();
            for (int i2 = 0; i2 < childCount; i2++) {
                View childAt = t.getChildAt(i2);
                int bottom = childAt.getBottom() + iD;
                if (childAt.getTop() + iD <= 0 && bottom >= 0) {
                    c cVar = new c(parcelableX);
                    cVar.f1694g = i2;
                    cVar.f1696i = bottom == t.v(childAt) + t.getTopInset();
                    cVar.f1695h = bottom / childAt.getHeight();
                    return cVar;
                }
            }
            return parcelableX;
        }

        @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.c
        /* JADX INFO: renamed from: j0, reason: merged with bridge method [inline-methods] */
        public boolean z(CoordinatorLayout coordinatorLayout, T t, View view, View view2, int i2, int i3) {
            ValueAnimator valueAnimator;
            boolean z = (i2 & 2) != 0 && (t.i() || U(coordinatorLayout, t, view));
            if (z && (valueAnimator = this.m) != null) {
                valueAnimator.cancel();
            }
            this.q = null;
            this.l = i3;
            return z;
        }

        @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.c
        /* JADX INFO: renamed from: k0, reason: merged with bridge method [inline-methods] */
        public void B(CoordinatorLayout coordinatorLayout, T t, View view, int i2) {
            if (this.l == 0 || i2 == 1) {
                n0(coordinatorLayout, t);
            }
            this.q = new WeakReference<>(view);
        }

        /* JADX INFO: Access modifiers changed from: package-private */
        @Override // com.google.android.material.appbar.a
        /* JADX INFO: renamed from: l0, reason: merged with bridge method [inline-methods] */
        public int P(CoordinatorLayout coordinatorLayout, T t, int i2, int i3, int i4) {
            int iL = L();
            int i5 = 0;
            if (i3 == 0 || iL < i3 || iL > i4) {
                this.f1691k = 0;
            } else {
                int iA = c.f.g.a.a(i2, i3, i4);
                if (iL != iA) {
                    int iB0 = t.e() ? b0(t, iA) : iA;
                    boolean zF = F(iB0);
                    i5 = iL - iA;
                    this.f1691k = iA - iB0;
                    if (!zF && t.e()) {
                        coordinatorLayout.f(t);
                    }
                    t.a(D());
                    p0(coordinatorLayout, t, iA, iA < iL ? -1 : 1, false);
                }
            }
            return i5;
        }

        public BaseBehavior(Context context, AttributeSet attributeSet) {
            super(context, attributeSet);
            this.n = -1;
        }

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

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

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

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

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

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

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

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

            public c(Parcel parcel, ClassLoader classLoader) {
                super(parcel, classLoader);
                this.f1694g = parcel.readInt();
                this.f1695h = parcel.readFloat();
                this.f1696i = parcel.readByte() != 0;
            }

            @Override // c.h.a.a, android.os.Parcelable
            public void writeToParcel(Parcel parcel, int i2) {
                super.writeToParcel(parcel, i2);
                parcel.writeInt(this.f1694g);
                parcel.writeFloat(this.f1695h);
                parcel.writeByte(this.f1696i ? (byte) 1 : (byte) 0);
            }

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

    public static class b extends LinearLayout.LayoutParams {
        int a;

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

        public b(Context context, AttributeSet attributeSet) {
            super(context, attributeSet);
            this.a = 1;
            TypedArray typedArrayObtainStyledAttributes = context.obtainStyledAttributes(attributeSet, i.AppBarLayout_Layout);
            this.a = typedArrayObtainStyledAttributes.getInt(i.AppBarLayout_Layout_layout_scrollFlags, 0);
            if (typedArrayObtainStyledAttributes.hasValue(i.AppBarLayout_Layout_layout_scrollInterpolator)) {
                this.f1697b = AnimationUtils.loadInterpolator(context, typedArrayObtainStyledAttributes.getResourceId(i.AppBarLayout_Layout_layout_scrollInterpolator, 0));
            }
            typedArrayObtainStyledAttributes.recycle();
        }

        public int a() {
            return this.a;
        }

        public Interpolator b() {
            return this.f1697b;
        }

        boolean c() {
            int i2 = this.a;
            return (i2 & 1) == 1 && (i2 & 10) != 0;
        }

        public b(int i2, int i3) {
            super(i2, i3);
            this.a = 1;
        }

        public b(ViewGroup.LayoutParams layoutParams) {
            super(layoutParams);
            this.a = 1;
        }

        public b(ViewGroup.MarginLayoutParams marginLayoutParams) {
            super(marginLayoutParams);
            this.a = 1;
        }

        public b(LinearLayout.LayoutParams layoutParams) {
            super(layoutParams);
            this.a = 1;
        }
    }
}
