package androidx.swiperefreshlayout.widget;

import X6FRs_4.IMuAHx_6.EuDEkJe_12.KNBe_11;
import X6FRs_4.IMuAHx_6.EuDEkJe_12.LGe8pk_15;
import X6FRs_4.IMuAHx_6.EuDEkJe_12.Nm6q_10;
import X6FRs_4.IMuAHx_6.EuDEkJe_12.YghfZG_14;
import X6FRs_4.IMuAHx_6.EuDEkJe_12.ZzDuCHW_20;
import android.content.Context;
import android.content.res.TypedArray;
import android.os.Build;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.Transformation;
import android.widget.AbsListView;
import android.widget.ListView;
import com.google.android.material.shadow.ShadowDrawableWrapper;
/* loaded from: classes.dex */
public class SwipeRefreshLayout extends ViewGroup implements YghfZG_14, Nm6q_10 {
    public static final String KQgRr5e_0 = SwipeRefreshLayout.class.getSimpleName();
    public static final int[] PGPF6hQ_2 = {16842766};

    /* renamed from: FSaI4_7  reason: collision with root package name */
    public int f3569FSaI4_7;

    /* renamed from: FSaI4_7  reason: collision with other field name */
    public boolean f2534FSaI4_7;

    /* renamed from: IFxWkV_5  reason: collision with root package name */
    public int f3570IFxWkV_5;

    /* renamed from: IFxWkV_5  reason: collision with other field name */
    public final Animation f2535IFxWkV_5;

    /* renamed from: IFxWkV_5  reason: collision with other field name */
    public boolean f2536IFxWkV_5;

    /* renamed from: IMuAHx_6  reason: collision with root package name */
    public int f3571IMuAHx_6;

    /* renamed from: IMuAHx_6  reason: collision with other field name */
    public final Animation f2537IMuAHx_6;

    /* renamed from: IMuAHx_6  reason: collision with other field name */
    public boolean f2538IMuAHx_6;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public float f2539KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public int f2540KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public final KNBe_11 f2541KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public final LGe8pk_15 f2542KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public X6FRs_4.LGe8pk_15.KQgRr5e_0.KQgRr5e_0 f2543KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public X6FRs_4.LGe8pk_15.KQgRr5e_0.QxJ9d_1 f2544KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public View f2545KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public Animation.AnimationListener f2546KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public Animation f2547KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public final DecelerateInterpolator f2548KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public Xgtqvk_8 f2549KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public XnFJ5_9 f2550KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public final int[] f2551KQgRr5e_0;

    /* renamed from: Mqv2r_3  reason: collision with root package name */
    public float f3572Mqv2r_3;

    /* renamed from: Mqv2r_3  reason: collision with other field name */
    public int f2552Mqv2r_3;

    /* renamed from: Mqv2r_3  reason: collision with other field name */
    public Animation f2553Mqv2r_3;

    /* renamed from: Mqv2r_3  reason: collision with other field name */
    public boolean f2554Mqv2r_3;

    /* renamed from: PGPF6hQ_2  reason: collision with other field name */
    public float f2555PGPF6hQ_2;

    /* renamed from: PGPF6hQ_2  reason: collision with other field name */
    public int f2556PGPF6hQ_2;

    /* renamed from: PGPF6hQ_2  reason: collision with other field name */
    public Animation f2557PGPF6hQ_2;

    /* renamed from: PGPF6hQ_2  reason: collision with other field name */
    public boolean f2558PGPF6hQ_2;
    public float QxJ9d_1;

    /* renamed from: QxJ9d_1  reason: collision with other field name */
    public int f2559QxJ9d_1;

    /* renamed from: QxJ9d_1  reason: collision with other field name */
    public Animation f2560QxJ9d_1;

    /* renamed from: QxJ9d_1  reason: collision with other field name */
    public boolean f2561QxJ9d_1;

    /* renamed from: QxJ9d_1  reason: collision with other field name */
    public final int[] f2562QxJ9d_1;

    /* renamed from: X6FRs_4  reason: collision with root package name */
    public float f3573X6FRs_4;

    /* renamed from: X6FRs_4  reason: collision with other field name */
    public int f2563X6FRs_4;

    /* renamed from: X6FRs_4  reason: collision with other field name */
    public Animation f2564X6FRs_4;

    /* renamed from: X6FRs_4  reason: collision with other field name */
    public boolean f2565X6FRs_4;

    /* renamed from: Xgtqvk_8  reason: collision with root package name */
    public int f3574Xgtqvk_8;

    /* renamed from: XnFJ5_9  reason: collision with root package name */
    public int f3575XnFJ5_9;

    /* loaded from: classes.dex */
    public class FSaI4_7 extends Animation {
        public FSaI4_7() {
        }

        @Override // android.view.animation.Animation
        public void applyTransformation(float f, Transformation transformation) {
            SwipeRefreshLayout swipeRefreshLayout = SwipeRefreshLayout.this;
            float f2 = swipeRefreshLayout.f3573X6FRs_4;
            swipeRefreshLayout.setAnimationProgress(f2 + ((-f2) * f));
            SwipeRefreshLayout.this.PGPF6hQ_2(f);
        }
    }

    /* loaded from: classes.dex */
    public class IFxWkV_5 extends Animation {
        public IFxWkV_5() {
        }

        @Override // android.view.animation.Animation
        public void applyTransformation(float f, Transformation transformation) {
            int i;
            SwipeRefreshLayout swipeRefreshLayout = SwipeRefreshLayout.this;
            if (!swipeRefreshLayout.f2534FSaI4_7) {
                i = swipeRefreshLayout.f3569FSaI4_7 - Math.abs(swipeRefreshLayout.f3571IMuAHx_6);
            } else {
                i = swipeRefreshLayout.f3569FSaI4_7;
            }
            SwipeRefreshLayout swipeRefreshLayout2 = SwipeRefreshLayout.this;
            int i2 = swipeRefreshLayout2.f3570IFxWkV_5;
            SwipeRefreshLayout.this.setTargetOffsetTopAndBottom((i2 + ((int) ((i - i2) * f))) - swipeRefreshLayout2.f2543KQgRr5e_0.getTop());
            SwipeRefreshLayout.this.f2544KQgRr5e_0.KQgRr5e_0(1.0f - f);
        }
    }

    /* loaded from: classes.dex */
    public class IMuAHx_6 extends Animation {
        public IMuAHx_6() {
        }

        @Override // android.view.animation.Animation
        public void applyTransformation(float f, Transformation transformation) {
            SwipeRefreshLayout.this.PGPF6hQ_2(f);
        }
    }

    /* loaded from: classes.dex */
    public class KQgRr5e_0 implements Animation.AnimationListener {
        public KQgRr5e_0() {
        }

        @Override // android.view.animation.Animation.AnimationListener
        public void onAnimationEnd(Animation animation) {
            XnFJ5_9 xnFJ5_9;
            SwipeRefreshLayout swipeRefreshLayout = SwipeRefreshLayout.this;
            if (swipeRefreshLayout.f2561QxJ9d_1) {
                swipeRefreshLayout.f2544KQgRr5e_0.setAlpha(255);
                SwipeRefreshLayout.this.f2544KQgRr5e_0.start();
                SwipeRefreshLayout swipeRefreshLayout2 = SwipeRefreshLayout.this;
                if (swipeRefreshLayout2.f2538IMuAHx_6 && (xnFJ5_9 = swipeRefreshLayout2.f2550KQgRr5e_0) != null) {
                    xnFJ5_9.KQgRr5e_0();
                }
                SwipeRefreshLayout swipeRefreshLayout3 = SwipeRefreshLayout.this;
                swipeRefreshLayout3.f2556PGPF6hQ_2 = swipeRefreshLayout3.f2543KQgRr5e_0.getTop();
                return;
            }
            swipeRefreshLayout.PGPF6hQ_2();
        }

        @Override // android.view.animation.Animation.AnimationListener
        public void onAnimationRepeat(Animation animation) {
        }

        @Override // android.view.animation.Animation.AnimationListener
        public void onAnimationStart(Animation animation) {
        }
    }

    /* loaded from: classes.dex */
    public class Mqv2r_3 extends Animation {
        public final /* synthetic */ int KQgRr5e_0;
        public final /* synthetic */ int QxJ9d_1;

        public Mqv2r_3(int i, int i2) {
            this.KQgRr5e_0 = i;
            this.QxJ9d_1 = i2;
        }

        @Override // android.view.animation.Animation
        public void applyTransformation(float f, Transformation transformation) {
            X6FRs_4.LGe8pk_15.KQgRr5e_0.QxJ9d_1 qxJ9d_1 = SwipeRefreshLayout.this.f2544KQgRr5e_0;
            int i = this.KQgRr5e_0;
            qxJ9d_1.setAlpha((int) (i + ((this.QxJ9d_1 - i) * f)));
        }
    }

    /* loaded from: classes.dex */
    public class PGPF6hQ_2 extends Animation {
        public PGPF6hQ_2() {
        }

        @Override // android.view.animation.Animation
        public void applyTransformation(float f, Transformation transformation) {
            SwipeRefreshLayout.this.setAnimationProgress(1.0f - f);
        }
    }

    /* loaded from: classes.dex */
    public class QxJ9d_1 extends Animation {
        public QxJ9d_1() {
        }

        @Override // android.view.animation.Animation
        public void applyTransformation(float f, Transformation transformation) {
            SwipeRefreshLayout.this.setAnimationProgress(f);
        }
    }

    /* loaded from: classes.dex */
    public class X6FRs_4 implements Animation.AnimationListener {
        public X6FRs_4() {
        }

        @Override // android.view.animation.Animation.AnimationListener
        public void onAnimationEnd(Animation animation) {
            SwipeRefreshLayout swipeRefreshLayout = SwipeRefreshLayout.this;
            if (swipeRefreshLayout.f2565X6FRs_4) {
                return;
            }
            swipeRefreshLayout.KQgRr5e_0((Animation.AnimationListener) null);
        }

        @Override // android.view.animation.Animation.AnimationListener
        public void onAnimationRepeat(Animation animation) {
        }

        @Override // android.view.animation.Animation.AnimationListener
        public void onAnimationStart(Animation animation) {
        }
    }

    /* loaded from: classes.dex */
    public interface Xgtqvk_8 {
        boolean KQgRr5e_0(SwipeRefreshLayout swipeRefreshLayout, View view);
    }

    /* loaded from: classes.dex */
    public interface XnFJ5_9 {
        void KQgRr5e_0();
    }

    public SwipeRefreshLayout(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
        this.f2561QxJ9d_1 = false;
        this.f2539KQgRr5e_0 = -1.0f;
        this.f2551KQgRr5e_0 = new int[2];
        this.f2562QxJ9d_1 = new int[2];
        this.f2552Mqv2r_3 = -1;
        this.f2563X6FRs_4 = -1;
        this.f2546KQgRr5e_0 = new KQgRr5e_0();
        this.f2535IFxWkV_5 = new IFxWkV_5();
        this.f2537IMuAHx_6 = new IMuAHx_6();
        this.f2540KQgRr5e_0 = ViewConfiguration.get(context).getScaledTouchSlop();
        this.f2559QxJ9d_1 = getResources().getInteger(17694721);
        setWillNotDraw(false);
        this.f2548KQgRr5e_0 = new DecelerateInterpolator(2.0f);
        DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
        this.f3575XnFJ5_9 = (int) (displayMetrics.density * 40.0f);
        KQgRr5e_0();
        setChildrenDrawingOrderEnabled(true);
        int i = (int) (displayMetrics.density * 64.0f);
        this.f3569FSaI4_7 = i;
        this.f2539KQgRr5e_0 = i;
        this.f2542KQgRr5e_0 = new LGe8pk_15(this);
        this.f2541KQgRr5e_0 = new KNBe_11(this);
        setNestedScrollingEnabled(true);
        int i2 = -this.f3575XnFJ5_9;
        this.f2556PGPF6hQ_2 = i2;
        this.f3571IMuAHx_6 = i2;
        PGPF6hQ_2(1.0f);
        TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, PGPF6hQ_2);
        setEnabled(obtainStyledAttributes.getBoolean(0, true));
        obtainStyledAttributes.recycle();
    }

    private void setColorViewAlpha(int i) {
        this.f2543KQgRr5e_0.getBackground().setAlpha(i);
        this.f2544KQgRr5e_0.setAlpha(i);
    }

    public final void KQgRr5e_0() {
        this.f2543KQgRr5e_0 = new X6FRs_4.LGe8pk_15.KQgRr5e_0.KQgRr5e_0(getContext(), -328966);
        X6FRs_4.LGe8pk_15.KQgRr5e_0.QxJ9d_1 qxJ9d_1 = new X6FRs_4.LGe8pk_15.KQgRr5e_0.QxJ9d_1(getContext());
        this.f2544KQgRr5e_0 = qxJ9d_1;
        qxJ9d_1.KQgRr5e_0(1);
        this.f2543KQgRr5e_0.setImageDrawable(this.f2544KQgRr5e_0);
        this.f2543KQgRr5e_0.setVisibility(8);
        addView(this.f2543KQgRr5e_0);
    }

    public final void Mqv2r_3() {
        this.f2553Mqv2r_3 = KQgRr5e_0(this.f2544KQgRr5e_0.getAlpha(), 255);
    }

    public void PGPF6hQ_2() {
        this.f2543KQgRr5e_0.clearAnimation();
        this.f2544KQgRr5e_0.stop();
        this.f2543KQgRr5e_0.setVisibility(8);
        setColorViewAlpha(255);
        if (this.f2565X6FRs_4) {
            setAnimationProgress(0.0f);
        } else {
            setTargetOffsetTopAndBottom(this.f3571IMuAHx_6 - this.f2556PGPF6hQ_2);
        }
        this.f2556PGPF6hQ_2 = this.f2543KQgRr5e_0.getTop();
    }

    public final void QxJ9d_1(Animation.AnimationListener animationListener) {
        this.f2543KQgRr5e_0.setVisibility(0);
        this.f2544KQgRr5e_0.setAlpha(255);
        QxJ9d_1 qxJ9d_1 = new QxJ9d_1();
        this.f2547KQgRr5e_0 = qxJ9d_1;
        qxJ9d_1.setDuration(this.f2559QxJ9d_1);
        if (animationListener != null) {
            this.f2543KQgRr5e_0.KQgRr5e_0(animationListener);
        }
        this.f2543KQgRr5e_0.clearAnimation();
        this.f2543KQgRr5e_0.startAnimation(this.f2547KQgRr5e_0);
    }

    public final void X6FRs_4() {
        this.f2557PGPF6hQ_2 = KQgRr5e_0(this.f2544KQgRr5e_0.getAlpha(), 76);
    }

    @Override // android.view.View
    public boolean dispatchNestedFling(float f, float f2, boolean z) {
        return this.f2541KQgRr5e_0.KQgRr5e_0(f, f2, z);
    }

    @Override // android.view.View
    public boolean dispatchNestedPreFling(float f, float f2) {
        return this.f2541KQgRr5e_0.KQgRr5e_0(f, f2);
    }

    @Override // android.view.View
    public boolean dispatchNestedPreScroll(int i, int i2, int[] iArr, int[] iArr2) {
        return this.f2541KQgRr5e_0.KQgRr5e_0(i, i2, iArr, iArr2);
    }

    @Override // android.view.View
    public boolean dispatchNestedScroll(int i, int i2, int i3, int i4, int[] iArr) {
        return this.f2541KQgRr5e_0.KQgRr5e_0(i, i2, i3, i4, iArr);
    }

    @Override // android.view.ViewGroup
    public int getChildDrawingOrder(int i, int i2) {
        int i3 = this.f2563X6FRs_4;
        return i3 < 0 ? i2 : i2 == i + (-1) ? i3 : i2 >= i3 ? i2 + 1 : i2;
    }

    @Override // android.view.ViewGroup
    public int getNestedScrollAxes() {
        return this.f2542KQgRr5e_0.KQgRr5e_0();
    }

    public int getProgressCircleDiameter() {
        return this.f3575XnFJ5_9;
    }

    public int getProgressViewEndOffset() {
        return this.f3569FSaI4_7;
    }

    public int getProgressViewStartOffset() {
        return this.f3571IMuAHx_6;
    }

    @Override // android.view.View
    public boolean hasNestedScrollingParent() {
        return this.f2541KQgRr5e_0.m218KQgRr5e_0();
    }

    @Override // android.view.View, X6FRs_4.IMuAHx_6.EuDEkJe_12.Nm6q_10
    public boolean isNestedScrollingEnabled() {
        return this.f2541KQgRr5e_0.QxJ9d_1();
    }

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

    @Override // android.view.ViewGroup
    public boolean onInterceptTouchEvent(MotionEvent motionEvent) {
        QxJ9d_1();
        int actionMasked = motionEvent.getActionMasked();
        if (this.f2536IFxWkV_5 && actionMasked == 0) {
            this.f2536IFxWkV_5 = false;
        }
        if (!isEnabled() || this.f2536IFxWkV_5 || m984KQgRr5e_0() || this.f2561QxJ9d_1 || this.f2558PGPF6hQ_2) {
            return false;
        }
        if (actionMasked != 0) {
            if (actionMasked != 1) {
                if (actionMasked == 2) {
                    int i = this.f2552Mqv2r_3;
                    if (i == -1) {
                        Log.e(KQgRr5e_0, "Got ACTION_MOVE event but don't have an active pointer id.");
                        return false;
                    }
                    int findPointerIndex = motionEvent.findPointerIndex(i);
                    if (findPointerIndex < 0) {
                        return false;
                    }
                    Mqv2r_3(motionEvent.getY(findPointerIndex));
                } else if (actionMasked != 3) {
                    if (actionMasked == 6) {
                        KQgRr5e_0(motionEvent);
                    }
                }
            }
            this.f2554Mqv2r_3 = false;
            this.f2552Mqv2r_3 = -1;
        } else {
            setTargetOffsetTopAndBottom(this.f3571IMuAHx_6 - this.f2543KQgRr5e_0.getTop());
            int pointerId = motionEvent.getPointerId(0);
            this.f2552Mqv2r_3 = pointerId;
            this.f2554Mqv2r_3 = false;
            int findPointerIndex2 = motionEvent.findPointerIndex(pointerId);
            if (findPointerIndex2 < 0) {
                return false;
            }
            this.f3572Mqv2r_3 = motionEvent.getY(findPointerIndex2);
        }
        return this.f2554Mqv2r_3;
    }

    @Override // android.view.ViewGroup, android.view.View
    public void onLayout(boolean z, int i, int i2, int i3, int i4) {
        int measuredWidth = getMeasuredWidth();
        int measuredHeight = getMeasuredHeight();
        if (getChildCount() == 0) {
            return;
        }
        if (this.f2545KQgRr5e_0 == null) {
            QxJ9d_1();
        }
        View view = this.f2545KQgRr5e_0;
        if (view == null) {
            return;
        }
        int paddingLeft = getPaddingLeft();
        int paddingTop = getPaddingTop();
        view.layout(paddingLeft, paddingTop, ((measuredWidth - getPaddingLeft()) - getPaddingRight()) + paddingLeft, ((measuredHeight - getPaddingTop()) - getPaddingBottom()) + paddingTop);
        int measuredWidth2 = this.f2543KQgRr5e_0.getMeasuredWidth();
        int measuredHeight2 = this.f2543KQgRr5e_0.getMeasuredHeight();
        int i5 = measuredWidth / 2;
        int i6 = measuredWidth2 / 2;
        int i7 = this.f2556PGPF6hQ_2;
        this.f2543KQgRr5e_0.layout(i5 - i6, i7, i5 + i6, measuredHeight2 + i7);
    }

    @Override // android.view.View
    public void onMeasure(int i, int i2) {
        super.onMeasure(i, i2);
        if (this.f2545KQgRr5e_0 == null) {
            QxJ9d_1();
        }
        View view = this.f2545KQgRr5e_0;
        if (view == null) {
            return;
        }
        view.measure(View.MeasureSpec.makeMeasureSpec((getMeasuredWidth() - getPaddingLeft()) - getPaddingRight(), 1073741824), View.MeasureSpec.makeMeasureSpec((getMeasuredHeight() - getPaddingTop()) - getPaddingBottom(), 1073741824));
        this.f2543KQgRr5e_0.measure(View.MeasureSpec.makeMeasureSpec(this.f3575XnFJ5_9, 1073741824), View.MeasureSpec.makeMeasureSpec(this.f3575XnFJ5_9, 1073741824));
        this.f2563X6FRs_4 = -1;
        for (int i3 = 0; i3 < getChildCount(); i3++) {
            if (getChildAt(i3) == this.f2543KQgRr5e_0) {
                this.f2563X6FRs_4 = i3;
                return;
            }
        }
    }

    @Override // android.view.ViewGroup, android.view.ViewParent, X6FRs_4.IMuAHx_6.EuDEkJe_12.YghfZG_14
    public boolean onNestedFling(View view, float f, float f2, boolean z) {
        return dispatchNestedFling(f, f2, z);
    }

    @Override // android.view.ViewGroup, android.view.ViewParent, X6FRs_4.IMuAHx_6.EuDEkJe_12.YghfZG_14
    public boolean onNestedPreFling(View view, float f, float f2) {
        return dispatchNestedPreFling(f, f2);
    }

    @Override // android.view.ViewGroup, android.view.ViewParent, X6FRs_4.IMuAHx_6.EuDEkJe_12.YghfZG_14
    public void onNestedPreScroll(View view, int i, int i2, int[] iArr) {
        if (i2 > 0) {
            float f = this.QxJ9d_1;
            if (f > 0.0f) {
                float f2 = i2;
                if (f2 > f) {
                    iArr[1] = i2 - ((int) f);
                    this.QxJ9d_1 = 0.0f;
                } else {
                    this.QxJ9d_1 = f - f2;
                    iArr[1] = i2;
                }
                QxJ9d_1(this.QxJ9d_1);
            }
        }
        if (this.f2534FSaI4_7 && i2 > 0 && this.QxJ9d_1 == 0.0f && Math.abs(i2 - iArr[1]) > 0) {
            this.f2543KQgRr5e_0.setVisibility(8);
        }
        int[] iArr2 = this.f2551KQgRr5e_0;
        if (dispatchNestedPreScroll(i - iArr[0], i2 - iArr[1], iArr2, null)) {
            iArr[0] = iArr[0] + iArr2[0];
            iArr[1] = iArr[1] + iArr2[1];
        }
    }

    @Override // android.view.ViewGroup, android.view.ViewParent, X6FRs_4.IMuAHx_6.EuDEkJe_12.YghfZG_14
    public void onNestedScroll(View view, int i, int i2, int i3, int i4) {
        dispatchNestedScroll(i, i2, i3, i4, this.f2562QxJ9d_1);
        int i5 = i4 + this.f2562QxJ9d_1[1];
        if (i5 >= 0 || m984KQgRr5e_0()) {
            return;
        }
        float abs = this.QxJ9d_1 + Math.abs(i5);
        this.QxJ9d_1 = abs;
        QxJ9d_1(abs);
    }

    @Override // android.view.ViewGroup, android.view.ViewParent, X6FRs_4.IMuAHx_6.EuDEkJe_12.YghfZG_14
    public void onNestedScrollAccepted(View view, View view2, int i) {
        this.f2542KQgRr5e_0.KQgRr5e_0(view, view2, i);
        startNestedScroll(i & 2);
        this.QxJ9d_1 = 0.0f;
        this.f2558PGPF6hQ_2 = true;
    }

    @Override // android.view.ViewGroup, android.view.ViewParent, X6FRs_4.IMuAHx_6.EuDEkJe_12.YghfZG_14
    public boolean onStartNestedScroll(View view, View view2, int i) {
        return (!isEnabled() || this.f2536IFxWkV_5 || this.f2561QxJ9d_1 || (i & 2) == 0) ? false : true;
    }

    @Override // android.view.ViewGroup, android.view.ViewParent, X6FRs_4.IMuAHx_6.EuDEkJe_12.YghfZG_14
    public void onStopNestedScroll(View view) {
        this.f2542KQgRr5e_0.KQgRr5e_0(view);
        this.f2558PGPF6hQ_2 = false;
        float f = this.QxJ9d_1;
        if (f > 0.0f) {
            KQgRr5e_0(f);
            this.QxJ9d_1 = 0.0f;
        }
        stopNestedScroll();
    }

    @Override // android.view.View
    public boolean onTouchEvent(MotionEvent motionEvent) {
        int actionMasked = motionEvent.getActionMasked();
        if (this.f2536IFxWkV_5 && actionMasked == 0) {
            this.f2536IFxWkV_5 = false;
        }
        if (!isEnabled() || this.f2536IFxWkV_5 || m984KQgRr5e_0() || this.f2561QxJ9d_1 || this.f2558PGPF6hQ_2) {
            return false;
        }
        if (actionMasked == 0) {
            this.f2552Mqv2r_3 = motionEvent.getPointerId(0);
            this.f2554Mqv2r_3 = false;
        } else if (actionMasked == 1) {
            int findPointerIndex = motionEvent.findPointerIndex(this.f2552Mqv2r_3);
            if (findPointerIndex < 0) {
                Log.e(KQgRr5e_0, "Got ACTION_UP event but don't have an active pointer id.");
                return false;
            }
            if (this.f2554Mqv2r_3) {
                this.f2554Mqv2r_3 = false;
                KQgRr5e_0((motionEvent.getY(findPointerIndex) - this.f2555PGPF6hQ_2) * 0.5f);
            }
            this.f2552Mqv2r_3 = -1;
            return false;
        } else if (actionMasked == 2) {
            int findPointerIndex2 = motionEvent.findPointerIndex(this.f2552Mqv2r_3);
            if (findPointerIndex2 < 0) {
                Log.e(KQgRr5e_0, "Got ACTION_MOVE event but have an invalid active pointer id.");
                return false;
            }
            float y = motionEvent.getY(findPointerIndex2);
            Mqv2r_3(y);
            if (this.f2554Mqv2r_3) {
                float f = (y - this.f2555PGPF6hQ_2) * 0.5f;
                if (f <= 0.0f) {
                    return false;
                }
                QxJ9d_1(f);
            }
        } else if (actionMasked == 3) {
            return false;
        } else {
            if (actionMasked == 5) {
                int actionIndex = motionEvent.getActionIndex();
                if (actionIndex < 0) {
                    Log.e(KQgRr5e_0, "Got ACTION_POINTER_DOWN event but have an invalid action index.");
                    return false;
                }
                this.f2552Mqv2r_3 = motionEvent.getPointerId(actionIndex);
            } else if (actionMasked == 6) {
                KQgRr5e_0(motionEvent);
            }
        }
        return true;
    }

    @Override // android.view.ViewGroup, android.view.ViewParent
    public void requestDisallowInterceptTouchEvent(boolean z) {
        if (Build.VERSION.SDK_INT >= 21 || !(this.f2545KQgRr5e_0 instanceof AbsListView)) {
            View view = this.f2545KQgRr5e_0;
            if (view == null || ZzDuCHW_20.m273Xgtqvk_8(view)) {
                super.requestDisallowInterceptTouchEvent(z);
            }
        }
    }

    public void setAnimationProgress(float f) {
        this.f2543KQgRr5e_0.setScaleX(f);
        this.f2543KQgRr5e_0.setScaleY(f);
    }

    @Deprecated
    public void setColorScheme(int... iArr) {
        setColorSchemeResources(iArr);
    }

    public void setColorSchemeColors(int... iArr) {
        QxJ9d_1();
        this.f2544KQgRr5e_0.KQgRr5e_0(iArr);
    }

    public void setColorSchemeResources(int... iArr) {
        Context context = getContext();
        int[] iArr2 = new int[iArr.length];
        for (int i = 0; i < iArr.length; i++) {
            iArr2[i] = X6FRs_4.IMuAHx_6.X6FRs_4.KQgRr5e_0.KQgRr5e_0(context, iArr[i]);
        }
        setColorSchemeColors(iArr2);
    }

    public void setDistanceToTriggerSync(int i) {
        this.f2539KQgRr5e_0 = i;
    }

    @Override // android.view.View
    public void setEnabled(boolean z) {
        super.setEnabled(z);
        if (z) {
            return;
        }
        PGPF6hQ_2();
    }

    @Override // android.view.View
    public void setNestedScrollingEnabled(boolean z) {
        this.f2541KQgRr5e_0.KQgRr5e_0(z);
    }

    public void setOnChildScrollUpCallback(Xgtqvk_8 xgtqvk_8) {
        this.f2549KQgRr5e_0 = xgtqvk_8;
    }

    public void setOnRefreshListener(XnFJ5_9 xnFJ5_9) {
        this.f2550KQgRr5e_0 = xnFJ5_9;
    }

    @Deprecated
    public void setProgressBackgroundColor(int i) {
        setProgressBackgroundColorSchemeResource(i);
    }

    public void setProgressBackgroundColorSchemeColor(int i) {
        this.f2543KQgRr5e_0.setBackgroundColor(i);
    }

    public void setProgressBackgroundColorSchemeResource(int i) {
        setProgressBackgroundColorSchemeColor(X6FRs_4.IMuAHx_6.X6FRs_4.KQgRr5e_0.KQgRr5e_0(getContext(), i));
    }

    public void setRefreshing(boolean z) {
        int i;
        if (z && this.f2561QxJ9d_1 != z) {
            this.f2561QxJ9d_1 = z;
            if (!this.f2534FSaI4_7) {
                i = this.f3569FSaI4_7 + this.f3571IMuAHx_6;
            } else {
                i = this.f3569FSaI4_7;
            }
            setTargetOffsetTopAndBottom(i - this.f2556PGPF6hQ_2);
            this.f2538IMuAHx_6 = false;
            QxJ9d_1(this.f2546KQgRr5e_0);
            return;
        }
        KQgRr5e_0(z, false);
    }

    public void setSize(int i) {
        if (i == 0 || i == 1) {
            DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
            if (i == 0) {
                this.f3575XnFJ5_9 = (int) (displayMetrics.density * 56.0f);
            } else {
                this.f3575XnFJ5_9 = (int) (displayMetrics.density * 40.0f);
            }
            this.f2543KQgRr5e_0.setImageDrawable(null);
            this.f2544KQgRr5e_0.KQgRr5e_0(i);
            this.f2543KQgRr5e_0.setImageDrawable(this.f2544KQgRr5e_0);
        }
    }

    public void setSlingshotDistance(int i) {
        this.f3574Xgtqvk_8 = i;
    }

    public void setTargetOffsetTopAndBottom(int i) {
        this.f2543KQgRr5e_0.bringToFront();
        ZzDuCHW_20.X6FRs_4(this.f2543KQgRr5e_0, i);
        this.f2556PGPF6hQ_2 = this.f2543KQgRr5e_0.getTop();
    }

    @Override // android.view.View
    public boolean startNestedScroll(int i) {
        return this.f2541KQgRr5e_0.QxJ9d_1(i);
    }

    @Override // android.view.View, X6FRs_4.IMuAHx_6.EuDEkJe_12.Nm6q_10
    public void stopNestedScroll() {
        this.f2541KQgRr5e_0.KQgRr5e_0();
    }

    public final void Mqv2r_3(float f) {
        float f2 = this.f3572Mqv2r_3;
        int i = this.f2540KQgRr5e_0;
        if (f - f2 <= i || this.f2554Mqv2r_3) {
            return;
        }
        this.f2555PGPF6hQ_2 = f2 + i;
        this.f2554Mqv2r_3 = true;
        this.f2544KQgRr5e_0.setAlpha(76);
    }

    public final void KQgRr5e_0(boolean z, boolean z2) {
        if (this.f2561QxJ9d_1 != z) {
            this.f2538IMuAHx_6 = z2;
            QxJ9d_1();
            this.f2561QxJ9d_1 = z;
            if (z) {
                KQgRr5e_0(this.f2556PGPF6hQ_2, this.f2546KQgRr5e_0);
            } else {
                KQgRr5e_0(this.f2546KQgRr5e_0);
            }
        }
    }

    public final void QxJ9d_1() {
        if (this.f2545KQgRr5e_0 == null) {
            for (int i = 0; i < getChildCount(); i++) {
                View childAt = getChildAt(i);
                if (!childAt.equals(this.f2543KQgRr5e_0)) {
                    this.f2545KQgRr5e_0 = childAt;
                    return;
                }
            }
        }
    }

    public void PGPF6hQ_2(float f) {
        int i = this.f3570IFxWkV_5;
        setTargetOffsetTopAndBottom((i + ((int) ((this.f3571IMuAHx_6 - i) * f))) - this.f2543KQgRr5e_0.getTop());
    }

    public final void PGPF6hQ_2(int i, Animation.AnimationListener animationListener) {
        this.f3570IFxWkV_5 = i;
        this.f3573X6FRs_4 = this.f2543KQgRr5e_0.getScaleX();
        FSaI4_7 fSaI4_7 = new FSaI4_7();
        this.f2564X6FRs_4 = fSaI4_7;
        fSaI4_7.setDuration(150L);
        if (animationListener != null) {
            this.f2543KQgRr5e_0.KQgRr5e_0(animationListener);
        }
        this.f2543KQgRr5e_0.clearAnimation();
        this.f2543KQgRr5e_0.startAnimation(this.f2564X6FRs_4);
    }

    public void KQgRr5e_0(Animation.AnimationListener animationListener) {
        PGPF6hQ_2 pGPF6hQ_2 = new PGPF6hQ_2();
        this.f2560QxJ9d_1 = pGPF6hQ_2;
        pGPF6hQ_2.setDuration(150L);
        this.f2543KQgRr5e_0.KQgRr5e_0(animationListener);
        this.f2543KQgRr5e_0.clearAnimation();
        this.f2543KQgRr5e_0.startAnimation(this.f2560QxJ9d_1);
    }

    public final void QxJ9d_1(float f) {
        this.f2544KQgRr5e_0.KQgRr5e_0(true);
        float min = Math.min(1.0f, Math.abs(f / this.f2539KQgRr5e_0));
        double d = min;
        Double.isNaN(d);
        float max = (((float) Math.max(d - 0.4d, (double) ShadowDrawableWrapper.COS_45)) * 5.0f) / 3.0f;
        float abs = Math.abs(f) - this.f2539KQgRr5e_0;
        int i = this.f3574Xgtqvk_8;
        if (i <= 0) {
            i = this.f2534FSaI4_7 ? this.f3569FSaI4_7 - this.f3571IMuAHx_6 : this.f3569FSaI4_7;
        }
        float f2 = i;
        double max2 = Math.max(0.0f, Math.min(abs, f2 * 2.0f) / f2) / 4.0f;
        double pow = Math.pow(max2, 2.0d);
        Double.isNaN(max2);
        float f3 = ((float) (max2 - pow)) * 2.0f;
        int i2 = this.f3571IMuAHx_6 + ((int) ((f2 * min) + (f2 * f3 * 2.0f)));
        if (this.f2543KQgRr5e_0.getVisibility() != 0) {
            this.f2543KQgRr5e_0.setVisibility(0);
        }
        if (!this.f2565X6FRs_4) {
            this.f2543KQgRr5e_0.setScaleX(1.0f);
            this.f2543KQgRr5e_0.setScaleY(1.0f);
        }
        if (this.f2565X6FRs_4) {
            setAnimationProgress(Math.min(1.0f, f / this.f2539KQgRr5e_0));
        }
        if (f < this.f2539KQgRr5e_0) {
            if (this.f2544KQgRr5e_0.getAlpha() > 76 && !KQgRr5e_0(this.f2557PGPF6hQ_2)) {
                X6FRs_4();
            }
        } else if (this.f2544KQgRr5e_0.getAlpha() < 255 && !KQgRr5e_0(this.f2553Mqv2r_3)) {
            Mqv2r_3();
        }
        this.f2544KQgRr5e_0.KQgRr5e_0(0.0f, Math.min(0.8f, max * 0.8f));
        this.f2544KQgRr5e_0.KQgRr5e_0(Math.min(1.0f, max));
        this.f2544KQgRr5e_0.QxJ9d_1((((max * 0.4f) - 0.25f) + (f3 * 2.0f)) * 0.5f);
        setTargetOffsetTopAndBottom(i2 - this.f2556PGPF6hQ_2);
    }

    public final Animation KQgRr5e_0(int i, int i2) {
        Mqv2r_3 mqv2r_3 = new Mqv2r_3(i, i2);
        mqv2r_3.setDuration(300L);
        this.f2543KQgRr5e_0.KQgRr5e_0(null);
        this.f2543KQgRr5e_0.clearAnimation();
        this.f2543KQgRr5e_0.startAnimation(mqv2r_3);
        return mqv2r_3;
    }

    /* renamed from: KQgRr5e_0  reason: collision with other method in class */
    public boolean m984KQgRr5e_0() {
        Xgtqvk_8 xgtqvk_8 = this.f2549KQgRr5e_0;
        if (xgtqvk_8 != null) {
            return xgtqvk_8.KQgRr5e_0(this, this.f2545KQgRr5e_0);
        }
        View view = this.f2545KQgRr5e_0;
        if (view instanceof ListView) {
            return X6FRs_4.IMuAHx_6.WwEq_13.IMuAHx_6.m318KQgRr5e_0((ListView) view, -1);
        }
        return view.canScrollVertically(-1);
    }

    public final boolean KQgRr5e_0(Animation animation) {
        return (animation == null || !animation.hasStarted() || animation.hasEnded()) ? false : true;
    }

    public final void KQgRr5e_0(float f) {
        if (f > this.f2539KQgRr5e_0) {
            KQgRr5e_0(true, true);
            return;
        }
        this.f2561QxJ9d_1 = false;
        this.f2544KQgRr5e_0.KQgRr5e_0(0.0f, 0.0f);
        QxJ9d_1(this.f2556PGPF6hQ_2, this.f2565X6FRs_4 ? null : new X6FRs_4());
        this.f2544KQgRr5e_0.KQgRr5e_0(false);
    }

    public final void KQgRr5e_0(int i, Animation.AnimationListener animationListener) {
        this.f3570IFxWkV_5 = i;
        this.f2535IFxWkV_5.reset();
        this.f2535IFxWkV_5.setDuration(200L);
        this.f2535IFxWkV_5.setInterpolator(this.f2548KQgRr5e_0);
        if (animationListener != null) {
            this.f2543KQgRr5e_0.KQgRr5e_0(animationListener);
        }
        this.f2543KQgRr5e_0.clearAnimation();
        this.f2543KQgRr5e_0.startAnimation(this.f2535IFxWkV_5);
    }

    public final void QxJ9d_1(int i, Animation.AnimationListener animationListener) {
        if (this.f2565X6FRs_4) {
            PGPF6hQ_2(i, animationListener);
            return;
        }
        this.f3570IFxWkV_5 = i;
        this.f2537IMuAHx_6.reset();
        this.f2537IMuAHx_6.setDuration(200L);
        this.f2537IMuAHx_6.setInterpolator(this.f2548KQgRr5e_0);
        if (animationListener != null) {
            this.f2543KQgRr5e_0.KQgRr5e_0(animationListener);
        }
        this.f2543KQgRr5e_0.clearAnimation();
        this.f2543KQgRr5e_0.startAnimation(this.f2537IMuAHx_6);
    }

    public final void KQgRr5e_0(MotionEvent motionEvent) {
        int actionIndex = motionEvent.getActionIndex();
        if (motionEvent.getPointerId(actionIndex) == this.f2552Mqv2r_3) {
            this.f2552Mqv2r_3 = motionEvent.getPointerId(actionIndex == 0 ? 1 : 0);
        }
    }
}
