package X6FRs_4.Xgtqvk_8.KQgRr5e_0;

import X6FRs_4.IMuAHx_6.EuDEkJe_12.ZzDuCHW_20;
import android.content.Context;
import android.util.Log;
import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.animation.Interpolator;
import android.widget.OverScroller;
import java.util.Arrays;
/* compiled from: ViewDragHelper.java */
/* loaded from: classes.dex */
public class PGPF6hQ_2 {
    public static final Interpolator KQgRr5e_0 = new KQgRr5e_0();

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

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

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

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public final AbstractC0068PGPF6hQ_2 f1241KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public VelocityTracker f1242KQgRr5e_0;

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

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public final ViewGroup f1244KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public OverScroller f1245KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public boolean f1247KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public float[] f1248KQgRr5e_0;

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

    /* renamed from: Mqv2r_3  reason: collision with root package name */
    public int f3312Mqv2r_3;

    /* renamed from: Mqv2r_3  reason: collision with other field name */
    public float[] f1250Mqv2r_3;

    /* renamed from: PGPF6hQ_2  reason: collision with other field name */
    public float[] f1251PGPF6hQ_2;

    /* renamed from: PGPF6hQ_2  reason: collision with other field name */
    public int[] f1252PGPF6hQ_2;
    public float QxJ9d_1;

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

    /* renamed from: QxJ9d_1  reason: collision with other field name */
    public float[] f1254QxJ9d_1;

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

    /* renamed from: X6FRs_4  reason: collision with root package name */
    public int f3313X6FRs_4;
    public int PGPF6hQ_2 = -1;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public final Runnable f1246KQgRr5e_0 = new QxJ9d_1();

    /* compiled from: ViewDragHelper.java */
    /* loaded from: classes.dex */
    public static class KQgRr5e_0 implements Interpolator {
        @Override // android.animation.TimeInterpolator
        public float getInterpolation(float f) {
            float f2 = f - 1.0f;
            return (f2 * f2 * f2 * f2 * f2) + 1.0f;
        }
    }

    /* compiled from: ViewDragHelper.java */
    /* renamed from: X6FRs_4.Xgtqvk_8.KQgRr5e_0.PGPF6hQ_2$PGPF6hQ_2  reason: collision with other inner class name */
    /* loaded from: classes.dex */
    public static abstract class AbstractC0068PGPF6hQ_2 {
        public abstract int clampViewPositionHorizontal(View view, int i, int i2);

        public abstract int clampViewPositionVertical(View view, int i, int i2);

        public int getOrderedChildIndex(int i) {
            return i;
        }

        public int getViewHorizontalDragRange(View view) {
            return 0;
        }

        public int getViewVerticalDragRange(View view) {
            return 0;
        }

        public void onEdgeDragStarted(int i, int i2) {
        }

        public boolean onEdgeLock(int i) {
            return false;
        }

        public void onEdgeTouched(int i, int i2) {
        }

        public void onViewCaptured(View view, int i) {
        }

        public abstract void onViewDragStateChanged(int i);

        public abstract void onViewPositionChanged(View view, int i, int i2, int i3, int i4);

        public abstract void onViewReleased(View view, float f, float f2);

        public abstract boolean tryCaptureView(View view, int i);
    }

    /* compiled from: ViewDragHelper.java */
    /* loaded from: classes.dex */
    public class QxJ9d_1 implements Runnable {
        public QxJ9d_1() {
        }

        @Override // java.lang.Runnable
        public void run() {
            PGPF6hQ_2.this.PGPF6hQ_2(0);
        }
    }

    public PGPF6hQ_2(Context context, ViewGroup viewGroup, AbstractC0068PGPF6hQ_2 abstractC0068PGPF6hQ_2) {
        if (viewGroup == null) {
            throw new IllegalArgumentException("Parent view may not be null");
        }
        if (abstractC0068PGPF6hQ_2 != null) {
            this.f1244KQgRr5e_0 = viewGroup;
            this.f1241KQgRr5e_0 = abstractC0068PGPF6hQ_2;
            ViewConfiguration viewConfiguration = ViewConfiguration.get(context);
            this.f3313X6FRs_4 = (int) ((context.getResources().getDisplayMetrics().density * 20.0f) + 0.5f);
            this.f1253QxJ9d_1 = viewConfiguration.getScaledTouchSlop();
            this.f1239KQgRr5e_0 = viewConfiguration.getScaledMaximumFlingVelocity();
            this.QxJ9d_1 = viewConfiguration.getScaledMinimumFlingVelocity();
            this.f1245KQgRr5e_0 = new OverScroller(context, KQgRr5e_0);
            return;
        }
        throw new IllegalArgumentException("Callback may not be null");
    }

    public static PGPF6hQ_2 KQgRr5e_0(ViewGroup viewGroup, AbstractC0068PGPF6hQ_2 abstractC0068PGPF6hQ_2) {
        return new PGPF6hQ_2(viewGroup.getContext(), viewGroup, abstractC0068PGPF6hQ_2);
    }

    public void Mqv2r_3(int i) {
        this.f3311IFxWkV_5 = i;
    }

    public int PGPF6hQ_2() {
        return this.f1240KQgRr5e_0;
    }

    public int QxJ9d_1() {
        return this.f1253QxJ9d_1;
    }

    public static PGPF6hQ_2 KQgRr5e_0(ViewGroup viewGroup, float f, AbstractC0068PGPF6hQ_2 abstractC0068PGPF6hQ_2) {
        PGPF6hQ_2 KQgRr5e_02 = KQgRr5e_0(viewGroup, abstractC0068PGPF6hQ_2);
        KQgRr5e_02.f1253QxJ9d_1 = (int) (KQgRr5e_02.f1253QxJ9d_1 * (1.0f / f));
        return KQgRr5e_02;
    }

    public final void Mqv2r_3() {
        this.f1242KQgRr5e_0.computeCurrentVelocity(1000, this.f1239KQgRr5e_0);
        KQgRr5e_0(KQgRr5e_0(this.f1242KQgRr5e_0.getXVelocity(this.PGPF6hQ_2), this.QxJ9d_1, this.f1239KQgRr5e_0), KQgRr5e_0(this.f1242KQgRr5e_0.getYVelocity(this.PGPF6hQ_2), this.QxJ9d_1, this.f1239KQgRr5e_0));
    }

    public boolean PGPF6hQ_2(int i, int i2) {
        if (this.f1247KQgRr5e_0) {
            return m589KQgRr5e_0(i, i2, (int) this.f1242KQgRr5e_0.getXVelocity(this.PGPF6hQ_2), (int) this.f1242KQgRr5e_0.getYVelocity(this.PGPF6hQ_2));
        }
        throw new IllegalStateException("Cannot settleCapturedViewAt outside of a call to Callback#onViewReleased");
    }

    /* renamed from: QxJ9d_1  reason: collision with other method in class */
    public void m594QxJ9d_1() {
        this.PGPF6hQ_2 = -1;
        m592PGPF6hQ_2();
        VelocityTracker velocityTracker = this.f1242KQgRr5e_0;
        if (velocityTracker != null) {
            velocityTracker.recycle();
            this.f1242KQgRr5e_0 = null;
        }
    }

    /* renamed from: KQgRr5e_0  reason: collision with other method in class */
    public void m586KQgRr5e_0(float f) {
        this.QxJ9d_1 = f;
    }

    public int KQgRr5e_0() {
        return this.f3313X6FRs_4;
    }

    public void KQgRr5e_0(View view, int i) {
        if (view.getParent() == this.f1244KQgRr5e_0) {
            this.f1243KQgRr5e_0 = view;
            this.PGPF6hQ_2 = i;
            this.f1241KQgRr5e_0.onViewCaptured(view, i);
            PGPF6hQ_2(1);
            return;
        }
        throw new IllegalArgumentException("captureChildView: parameter must be a descendant of the ViewDragHelper's tracked parent view (" + this.f1244KQgRr5e_0 + ")");
    }

    public boolean QxJ9d_1(View view, int i, int i2) {
        this.f1243KQgRr5e_0 = view;
        this.PGPF6hQ_2 = -1;
        boolean m589KQgRr5e_0 = m589KQgRr5e_0(i, i2, 0, 0);
        if (!m589KQgRr5e_0 && this.f1240KQgRr5e_0 == 0 && this.f1243KQgRr5e_0 != null) {
            this.f1243KQgRr5e_0 = null;
        }
        return m589KQgRr5e_0;
    }

    /* renamed from: PGPF6hQ_2  reason: collision with other method in class */
    public final void m592PGPF6hQ_2() {
        float[] fArr = this.f1248KQgRr5e_0;
        if (fArr == null) {
            return;
        }
        Arrays.fill(fArr, 0.0f);
        Arrays.fill(this.f1254QxJ9d_1, 0.0f);
        Arrays.fill(this.f1251PGPF6hQ_2, 0.0f);
        Arrays.fill(this.f1250Mqv2r_3, 0.0f);
        Arrays.fill(this.f1249KQgRr5e_0, 0);
        Arrays.fill(this.f1255QxJ9d_1, 0);
        Arrays.fill(this.f1252PGPF6hQ_2, 0);
        this.f3312Mqv2r_3 = 0;
    }

    /* renamed from: KQgRr5e_0  reason: collision with other method in class */
    public View m583KQgRr5e_0() {
        return this.f1243KQgRr5e_0;
    }

    public final int QxJ9d_1(int i, int i2, int i3) {
        int abs;
        if (i == 0) {
            return 0;
        }
        int width = this.f1244KQgRr5e_0.getWidth();
        float f = width / 2;
        float KQgRr5e_02 = f + (KQgRr5e_0(Math.min(1.0f, Math.abs(i) / width)) * f);
        int abs2 = Math.abs(i2);
        if (abs2 > 0) {
            abs = Math.round(Math.abs(KQgRr5e_02 / abs2) * 1000.0f) * 4;
        } else {
            abs = (int) (((Math.abs(i) / i3) + 1.0f) * 256.0f);
        }
        return Math.min(abs, 600);
    }

    /* renamed from: KQgRr5e_0  reason: collision with other method in class */
    public void m585KQgRr5e_0() {
        m594QxJ9d_1();
        if (this.f1240KQgRr5e_0 == 2) {
            int currX = this.f1245KQgRr5e_0.getCurrX();
            int currY = this.f1245KQgRr5e_0.getCurrY();
            this.f1245KQgRr5e_0.abortAnimation();
            int currX2 = this.f1245KQgRr5e_0.getCurrX();
            int currY2 = this.f1245KQgRr5e_0.getCurrY();
            this.f1241KQgRr5e_0.onViewPositionChanged(this.f1243KQgRr5e_0, currX2, currY2, currX2 - currX, currY2 - currY);
        }
        PGPF6hQ_2(0);
    }

    public void PGPF6hQ_2(int i) {
        this.f1244KQgRr5e_0.removeCallbacks(this.f1246KQgRr5e_0);
        if (this.f1240KQgRr5e_0 != i) {
            this.f1240KQgRr5e_0 = i;
            this.f1241KQgRr5e_0.onViewDragStateChanged(i);
            if (this.f1240KQgRr5e_0 == 0) {
                this.f1243KQgRr5e_0 = null;
            }
        }
    }

    public final void QxJ9d_1(int i) {
        float[] fArr = this.f1248KQgRr5e_0;
        if (fArr == null || fArr.length <= i) {
            int i2 = i + 1;
            float[] fArr2 = new float[i2];
            float[] fArr3 = new float[i2];
            float[] fArr4 = new float[i2];
            float[] fArr5 = new float[i2];
            int[] iArr = new int[i2];
            int[] iArr2 = new int[i2];
            int[] iArr3 = new int[i2];
            float[] fArr6 = this.f1248KQgRr5e_0;
            if (fArr6 != null) {
                System.arraycopy(fArr6, 0, fArr2, 0, fArr6.length);
                float[] fArr7 = this.f1254QxJ9d_1;
                System.arraycopy(fArr7, 0, fArr3, 0, fArr7.length);
                float[] fArr8 = this.f1251PGPF6hQ_2;
                System.arraycopy(fArr8, 0, fArr4, 0, fArr8.length);
                float[] fArr9 = this.f1250Mqv2r_3;
                System.arraycopy(fArr9, 0, fArr5, 0, fArr9.length);
                int[] iArr4 = this.f1249KQgRr5e_0;
                System.arraycopy(iArr4, 0, iArr, 0, iArr4.length);
                int[] iArr5 = this.f1255QxJ9d_1;
                System.arraycopy(iArr5, 0, iArr2, 0, iArr5.length);
                int[] iArr6 = this.f1252PGPF6hQ_2;
                System.arraycopy(iArr6, 0, iArr3, 0, iArr6.length);
            }
            this.f1248KQgRr5e_0 = fArr2;
            this.f1254QxJ9d_1 = fArr3;
            this.f1251PGPF6hQ_2 = fArr4;
            this.f1250Mqv2r_3 = fArr5;
            this.f1249KQgRr5e_0 = iArr;
            this.f1255QxJ9d_1 = iArr2;
            this.f1252PGPF6hQ_2 = iArr3;
        }
    }

    /* renamed from: KQgRr5e_0  reason: collision with other method in class */
    public final boolean m589KQgRr5e_0(int i, int i2, int i3, int i4) {
        int left = this.f1243KQgRr5e_0.getLeft();
        int top = this.f1243KQgRr5e_0.getTop();
        int i5 = i - left;
        int i6 = i2 - top;
        if (i5 == 0 && i6 == 0) {
            this.f1245KQgRr5e_0.abortAnimation();
            PGPF6hQ_2(0);
            return false;
        }
        this.f1245KQgRr5e_0.startScroll(left, top, i5, i6, KQgRr5e_0(this.f1243KQgRr5e_0, i5, i6, i3, i4));
        PGPF6hQ_2(2);
        return true;
    }

    /* renamed from: PGPF6hQ_2  reason: collision with other method in class */
    public final boolean m593PGPF6hQ_2(int i) {
        if (m595QxJ9d_1(i)) {
            return true;
        }
        Log.e("ViewDragHelper", "Ignoring pointerId=" + i + " because ACTION_DOWN was not received for this pointer before ACTION_MOVE. It likely happened because  ViewDragHelper did not receive all the events in the event stream.");
        return false;
    }

    public final int KQgRr5e_0(View view, int i, int i2, int i3, int i4) {
        float f;
        float f2;
        float f3;
        float f4;
        int KQgRr5e_02 = KQgRr5e_0(i3, (int) this.QxJ9d_1, (int) this.f1239KQgRr5e_0);
        int KQgRr5e_03 = KQgRr5e_0(i4, (int) this.QxJ9d_1, (int) this.f1239KQgRr5e_0);
        int abs = Math.abs(i);
        int abs2 = Math.abs(i2);
        int abs3 = Math.abs(KQgRr5e_02);
        int abs4 = Math.abs(KQgRr5e_03);
        int i5 = abs3 + abs4;
        int i6 = abs + abs2;
        if (KQgRr5e_02 != 0) {
            f = abs3;
            f2 = i5;
        } else {
            f = abs;
            f2 = i6;
        }
        float f5 = f / f2;
        if (KQgRr5e_03 != 0) {
            f3 = abs4;
            f4 = i5;
        } else {
            f3 = abs2;
            f4 = i6;
        }
        return (int) ((QxJ9d_1(i, KQgRr5e_02, this.f1241KQgRr5e_0.getViewHorizontalDragRange(view)) * f5) + (QxJ9d_1(i2, KQgRr5e_03, this.f1241KQgRr5e_0.getViewVerticalDragRange(view)) * (f3 / f4)));
    }

    public final int KQgRr5e_0(int i, int i2, int i3) {
        int abs = Math.abs(i);
        if (abs < i2) {
            return 0;
        }
        return abs > i3 ? i > 0 ? i3 : -i3 : i;
    }

    public final float KQgRr5e_0(float f, float f2, float f3) {
        float abs = Math.abs(f);
        if (abs < f2) {
            return 0.0f;
        }
        return abs > f3 ? f > 0.0f ? f3 : -f3 : f;
    }

    public final float KQgRr5e_0(float f) {
        return (float) Math.sin((f - 0.5f) * 0.47123894f);
    }

    public boolean KQgRr5e_0(boolean z) {
        if (this.f1240KQgRr5e_0 == 2) {
            boolean computeScrollOffset = this.f1245KQgRr5e_0.computeScrollOffset();
            int currX = this.f1245KQgRr5e_0.getCurrX();
            int currY = this.f1245KQgRr5e_0.getCurrY();
            int left = currX - this.f1243KQgRr5e_0.getLeft();
            int top = currY - this.f1243KQgRr5e_0.getTop();
            if (left != 0) {
                ZzDuCHW_20.Mqv2r_3(this.f1243KQgRr5e_0, left);
            }
            if (top != 0) {
                ZzDuCHW_20.X6FRs_4(this.f1243KQgRr5e_0, top);
            }
            if (left != 0 || top != 0) {
                this.f1241KQgRr5e_0.onViewPositionChanged(this.f1243KQgRr5e_0, currX, currY, left, top);
            }
            if (computeScrollOffset && currX == this.f1245KQgRr5e_0.getFinalX() && currY == this.f1245KQgRr5e_0.getFinalY()) {
                this.f1245KQgRr5e_0.abortAnimation();
                computeScrollOffset = false;
            }
            if (!computeScrollOffset) {
                if (z) {
                    this.f1244KQgRr5e_0.post(this.f1246KQgRr5e_0);
                } else {
                    PGPF6hQ_2(0);
                }
            }
        }
        return this.f1240KQgRr5e_0 == 2;
    }

    public final void QxJ9d_1(float f, float f2, int i) {
        QxJ9d_1(i);
        float[] fArr = this.f1248KQgRr5e_0;
        this.f1251PGPF6hQ_2[i] = f;
        fArr[i] = f;
        float[] fArr2 = this.f1254QxJ9d_1;
        this.f1250Mqv2r_3[i] = f2;
        fArr2[i] = f2;
        this.f1249KQgRr5e_0[i] = KQgRr5e_0((int) f, (int) f2);
        this.f3312Mqv2r_3 |= 1 << i;
    }

    public final void QxJ9d_1(MotionEvent motionEvent) {
        int pointerCount = motionEvent.getPointerCount();
        for (int i = 0; i < pointerCount; i++) {
            int pointerId = motionEvent.getPointerId(i);
            if (m593PGPF6hQ_2(pointerId)) {
                float x = motionEvent.getX(i);
                float y = motionEvent.getY(i);
                this.f1251PGPF6hQ_2[pointerId] = x;
                this.f1250Mqv2r_3[pointerId] = y;
            }
        }
    }

    public final void KQgRr5e_0(float f, float f2) {
        this.f1247KQgRr5e_0 = true;
        this.f1241KQgRr5e_0.onViewReleased(this.f1243KQgRr5e_0, f, f2);
        this.f1247KQgRr5e_0 = false;
        if (this.f1240KQgRr5e_0 == 1) {
            PGPF6hQ_2(0);
        }
    }

    /* renamed from: QxJ9d_1  reason: collision with other method in class */
    public boolean m595QxJ9d_1(int i) {
        return ((1 << i) & this.f3312Mqv2r_3) != 0;
    }

    public boolean QxJ9d_1(int i, int i2) {
        return KQgRr5e_0(this.f1243KQgRr5e_0, i, i2);
    }

    public final void KQgRr5e_0(int i) {
        if (this.f1248KQgRr5e_0 == null || !m595QxJ9d_1(i)) {
            return;
        }
        this.f1248KQgRr5e_0[i] = 0.0f;
        this.f1254QxJ9d_1[i] = 0.0f;
        this.f1251PGPF6hQ_2[i] = 0.0f;
        this.f1250Mqv2r_3[i] = 0.0f;
        this.f1249KQgRr5e_0[i] = 0;
        this.f1255QxJ9d_1[i] = 0;
        this.f1252PGPF6hQ_2[i] = 0;
        this.f3312Mqv2r_3 = ((1 << i) ^ (-1)) & this.f3312Mqv2r_3;
    }

    /* renamed from: KQgRr5e_0  reason: collision with other method in class */
    public boolean m591KQgRr5e_0(View view, int i) {
        if (view == this.f1243KQgRr5e_0 && this.PGPF6hQ_2 == i) {
            return true;
        }
        if (view == null || !this.f1241KQgRr5e_0.tryCaptureView(view, i)) {
            return false;
        }
        this.PGPF6hQ_2 = i;
        KQgRr5e_0(view, i);
        return true;
    }

    /* JADX WARN: Code restructure failed: missing block: B:49:0x00dd, code lost:
        if (r12 != r11) goto L57;
     */
    /* renamed from: KQgRr5e_0  reason: collision with other method in class */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public boolean m590KQgRr5e_0(MotionEvent motionEvent) {
        boolean z;
        View m584KQgRr5e_0;
        int actionMasked = motionEvent.getActionMasked();
        int actionIndex = motionEvent.getActionIndex();
        if (actionMasked == 0) {
            m594QxJ9d_1();
        }
        if (this.f1242KQgRr5e_0 == null) {
            this.f1242KQgRr5e_0 = VelocityTracker.obtain();
        }
        this.f1242KQgRr5e_0.addMovement(motionEvent);
        if (actionMasked != 0) {
            if (actionMasked != 1) {
                if (actionMasked != 2) {
                    if (actionMasked != 3) {
                        if (actionMasked == 5) {
                            int pointerId = motionEvent.getPointerId(actionIndex);
                            float x = motionEvent.getX(actionIndex);
                            float y = motionEvent.getY(actionIndex);
                            QxJ9d_1(x, y, pointerId);
                            int i = this.f1240KQgRr5e_0;
                            if (i == 0) {
                                int i2 = this.f1249KQgRr5e_0[pointerId];
                                int i3 = this.f3311IFxWkV_5;
                                if ((i2 & i3) != 0) {
                                    this.f1241KQgRr5e_0.onEdgeTouched(i2 & i3, pointerId);
                                }
                            } else if (i == 2 && (m584KQgRr5e_0 = m584KQgRr5e_0((int) x, (int) y)) == this.f1243KQgRr5e_0) {
                                m591KQgRr5e_0(m584KQgRr5e_0, pointerId);
                            }
                        } else if (actionMasked == 6) {
                            KQgRr5e_0(motionEvent.getPointerId(actionIndex));
                        }
                    }
                } else if (this.f1248KQgRr5e_0 != null && this.f1254QxJ9d_1 != null) {
                    int pointerCount = motionEvent.getPointerCount();
                    for (int i4 = 0; i4 < pointerCount; i4++) {
                        int pointerId2 = motionEvent.getPointerId(i4);
                        if (m593PGPF6hQ_2(pointerId2)) {
                            float x2 = motionEvent.getX(i4);
                            float y2 = motionEvent.getY(i4);
                            float f = x2 - this.f1248KQgRr5e_0[pointerId2];
                            float f2 = y2 - this.f1254QxJ9d_1[pointerId2];
                            View m584KQgRr5e_02 = m584KQgRr5e_0((int) x2, (int) y2);
                            boolean z2 = m584KQgRr5e_02 != null && KQgRr5e_0(m584KQgRr5e_02, f, f2);
                            if (z2) {
                                int left = m584KQgRr5e_02.getLeft();
                                int i5 = (int) f;
                                int clampViewPositionHorizontal = this.f1241KQgRr5e_0.clampViewPositionHorizontal(m584KQgRr5e_02, left + i5, i5);
                                int top = m584KQgRr5e_02.getTop();
                                int i6 = (int) f2;
                                int clampViewPositionVertical = this.f1241KQgRr5e_0.clampViewPositionVertical(m584KQgRr5e_02, top + i6, i6);
                                int viewHorizontalDragRange = this.f1241KQgRr5e_0.getViewHorizontalDragRange(m584KQgRr5e_02);
                                int viewVerticalDragRange = this.f1241KQgRr5e_0.getViewVerticalDragRange(m584KQgRr5e_02);
                                if (viewHorizontalDragRange != 0) {
                                    if (viewHorizontalDragRange > 0) {
                                    }
                                }
                                if (viewVerticalDragRange == 0) {
                                    break;
                                } else if (viewVerticalDragRange > 0 && clampViewPositionVertical == top) {
                                    break;
                                }
                            }
                            KQgRr5e_0(f, f2, pointerId2);
                            if (this.f1240KQgRr5e_0 != 1) {
                                if (z2 && m591KQgRr5e_0(m584KQgRr5e_02, pointerId2)) {
                                    break;
                                }
                            } else {
                                break;
                            }
                        }
                    }
                    QxJ9d_1(motionEvent);
                }
                z = false;
            }
            m594QxJ9d_1();
            z = false;
        } else {
            float x3 = motionEvent.getX();
            float y3 = motionEvent.getY();
            z = false;
            int pointerId3 = motionEvent.getPointerId(0);
            QxJ9d_1(x3, y3, pointerId3);
            View m584KQgRr5e_03 = m584KQgRr5e_0((int) x3, (int) y3);
            if (m584KQgRr5e_03 == this.f1243KQgRr5e_0 && this.f1240KQgRr5e_0 == 2) {
                m591KQgRr5e_0(m584KQgRr5e_03, pointerId3);
            }
            int i7 = this.f1249KQgRr5e_0[pointerId3];
            int i8 = this.f3311IFxWkV_5;
            if ((i7 & i8) != 0) {
                this.f1241KQgRr5e_0.onEdgeTouched(i7 & i8, pointerId3);
            }
        }
        if (this.f1240KQgRr5e_0 == 1) {
            return true;
        }
        return z;
    }

    public void KQgRr5e_0(MotionEvent motionEvent) {
        int i;
        int actionMasked = motionEvent.getActionMasked();
        int actionIndex = motionEvent.getActionIndex();
        if (actionMasked == 0) {
            m594QxJ9d_1();
        }
        if (this.f1242KQgRr5e_0 == null) {
            this.f1242KQgRr5e_0 = VelocityTracker.obtain();
        }
        this.f1242KQgRr5e_0.addMovement(motionEvent);
        int i2 = 0;
        if (actionMasked == 0) {
            float x = motionEvent.getX();
            float y = motionEvent.getY();
            int pointerId = motionEvent.getPointerId(0);
            View m584KQgRr5e_0 = m584KQgRr5e_0((int) x, (int) y);
            QxJ9d_1(x, y, pointerId);
            m591KQgRr5e_0(m584KQgRr5e_0, pointerId);
            int i3 = this.f1249KQgRr5e_0[pointerId];
            int i4 = this.f3311IFxWkV_5;
            if ((i3 & i4) != 0) {
                this.f1241KQgRr5e_0.onEdgeTouched(i3 & i4, pointerId);
            }
        } else if (actionMasked == 1) {
            if (this.f1240KQgRr5e_0 == 1) {
                Mqv2r_3();
            }
            m594QxJ9d_1();
        } else if (actionMasked == 2) {
            if (this.f1240KQgRr5e_0 == 1) {
                if (m593PGPF6hQ_2(this.PGPF6hQ_2)) {
                    int findPointerIndex = motionEvent.findPointerIndex(this.PGPF6hQ_2);
                    float x2 = motionEvent.getX(findPointerIndex);
                    float y2 = motionEvent.getY(findPointerIndex);
                    float[] fArr = this.f1251PGPF6hQ_2;
                    int i5 = this.PGPF6hQ_2;
                    int i6 = (int) (x2 - fArr[i5]);
                    int i7 = (int) (y2 - this.f1250Mqv2r_3[i5]);
                    KQgRr5e_0(this.f1243KQgRr5e_0.getLeft() + i6, this.f1243KQgRr5e_0.getTop() + i7, i6, i7);
                    QxJ9d_1(motionEvent);
                    return;
                }
                return;
            }
            int pointerCount = motionEvent.getPointerCount();
            while (i2 < pointerCount) {
                int pointerId2 = motionEvent.getPointerId(i2);
                if (m593PGPF6hQ_2(pointerId2)) {
                    float x3 = motionEvent.getX(i2);
                    float y3 = motionEvent.getY(i2);
                    float f = x3 - this.f1248KQgRr5e_0[pointerId2];
                    float f2 = y3 - this.f1254QxJ9d_1[pointerId2];
                    KQgRr5e_0(f, f2, pointerId2);
                    if (this.f1240KQgRr5e_0 != 1) {
                        View m584KQgRr5e_02 = m584KQgRr5e_0((int) x3, (int) y3);
                        if (KQgRr5e_0(m584KQgRr5e_02, f, f2) && m591KQgRr5e_0(m584KQgRr5e_02, pointerId2)) {
                            break;
                        }
                    } else {
                        break;
                    }
                }
                i2++;
            }
            QxJ9d_1(motionEvent);
        } else if (actionMasked == 3) {
            if (this.f1240KQgRr5e_0 == 1) {
                KQgRr5e_0(0.0f, 0.0f);
            }
            m594QxJ9d_1();
        } else if (actionMasked == 5) {
            int pointerId3 = motionEvent.getPointerId(actionIndex);
            float x4 = motionEvent.getX(actionIndex);
            float y4 = motionEvent.getY(actionIndex);
            QxJ9d_1(x4, y4, pointerId3);
            if (this.f1240KQgRr5e_0 == 0) {
                m591KQgRr5e_0(m584KQgRr5e_0((int) x4, (int) y4), pointerId3);
                int i8 = this.f1249KQgRr5e_0[pointerId3];
                int i9 = this.f3311IFxWkV_5;
                if ((i8 & i9) != 0) {
                    this.f1241KQgRr5e_0.onEdgeTouched(i8 & i9, pointerId3);
                }
            } else if (QxJ9d_1((int) x4, (int) y4)) {
                m591KQgRr5e_0(this.f1243KQgRr5e_0, pointerId3);
            }
        } else if (actionMasked != 6) {
        } else {
            int pointerId4 = motionEvent.getPointerId(actionIndex);
            if (this.f1240KQgRr5e_0 == 1 && pointerId4 == this.PGPF6hQ_2) {
                int pointerCount2 = motionEvent.getPointerCount();
                while (true) {
                    if (i2 >= pointerCount2) {
                        i = -1;
                        break;
                    }
                    int pointerId5 = motionEvent.getPointerId(i2);
                    if (pointerId5 != this.PGPF6hQ_2) {
                        View m584KQgRr5e_03 = m584KQgRr5e_0((int) motionEvent.getX(i2), (int) motionEvent.getY(i2));
                        View view = this.f1243KQgRr5e_0;
                        if (m584KQgRr5e_03 == view && m591KQgRr5e_0(view, pointerId5)) {
                            i = this.PGPF6hQ_2;
                            break;
                        }
                    }
                    i2++;
                }
                if (i == -1) {
                    Mqv2r_3();
                }
            }
            KQgRr5e_0(pointerId4);
        }
    }

    public final void KQgRr5e_0(float f, float f2, int i) {
        int i2 = KQgRr5e_0(f, f2, i, 1) ? 1 : 0;
        if (KQgRr5e_0(f2, f, i, 4)) {
            i2 |= 4;
        }
        if (KQgRr5e_0(f, f2, i, 2)) {
            i2 |= 2;
        }
        if (KQgRr5e_0(f2, f, i, 8)) {
            i2 |= 8;
        }
        if (i2 != 0) {
            int[] iArr = this.f1255QxJ9d_1;
            iArr[i] = iArr[i] | i2;
            this.f1241KQgRr5e_0.onEdgeDragStarted(i2, i);
        }
    }

    public final boolean KQgRr5e_0(float f, float f2, int i, int i2) {
        float abs = Math.abs(f);
        float abs2 = Math.abs(f2);
        if ((this.f1249KQgRr5e_0[i] & i2) != i2 || (this.f3311IFxWkV_5 & i2) == 0 || (this.f1252PGPF6hQ_2[i] & i2) == i2 || (this.f1255QxJ9d_1[i] & i2) == i2) {
            return false;
        }
        int i3 = this.f1253QxJ9d_1;
        if (abs > i3 || abs2 > i3) {
            if (abs >= abs2 * 0.5f || !this.f1241KQgRr5e_0.onEdgeLock(i2)) {
                return (this.f1255QxJ9d_1[i] & i2) == 0 && abs > ((float) this.f1253QxJ9d_1);
            }
            int[] iArr = this.f1252PGPF6hQ_2;
            iArr[i] = iArr[i] | i2;
            return false;
        }
        return false;
    }

    public final boolean KQgRr5e_0(View view, float f, float f2) {
        if (view == null) {
            return false;
        }
        boolean z = this.f1241KQgRr5e_0.getViewHorizontalDragRange(view) > 0;
        boolean z2 = this.f1241KQgRr5e_0.getViewVerticalDragRange(view) > 0;
        if (!z || !z2) {
            return z ? Math.abs(f) > ((float) this.f1253QxJ9d_1) : z2 && Math.abs(f2) > ((float) this.f1253QxJ9d_1);
        }
        int i = this.f1253QxJ9d_1;
        return (f * f) + (f2 * f2) > ((float) (i * i));
    }

    /* renamed from: KQgRr5e_0  reason: collision with other method in class */
    public boolean m587KQgRr5e_0(int i) {
        int length = this.f1248KQgRr5e_0.length;
        for (int i2 = 0; i2 < length; i2++) {
            if (m588KQgRr5e_0(i, i2)) {
                return true;
            }
        }
        return false;
    }

    /* renamed from: KQgRr5e_0  reason: collision with other method in class */
    public boolean m588KQgRr5e_0(int i, int i2) {
        if (m595QxJ9d_1(i2)) {
            boolean z = (i & 1) == 1;
            boolean z2 = (i & 2) == 2;
            float f = this.f1251PGPF6hQ_2[i2] - this.f1248KQgRr5e_0[i2];
            float f2 = this.f1250Mqv2r_3[i2] - this.f1254QxJ9d_1[i2];
            if (!z || !z2) {
                return z ? Math.abs(f) > ((float) this.f1253QxJ9d_1) : z2 && Math.abs(f2) > ((float) this.f1253QxJ9d_1);
            }
            int i3 = this.f1253QxJ9d_1;
            return (f * f) + (f2 * f2) > ((float) (i3 * i3));
        }
        return false;
    }

    public final void KQgRr5e_0(int i, int i2, int i3, int i4) {
        int left = this.f1243KQgRr5e_0.getLeft();
        int top = this.f1243KQgRr5e_0.getTop();
        if (i3 != 0) {
            i = this.f1241KQgRr5e_0.clampViewPositionHorizontal(this.f1243KQgRr5e_0, i, i3);
            ZzDuCHW_20.Mqv2r_3(this.f1243KQgRr5e_0, i - left);
        }
        int i5 = i;
        if (i4 != 0) {
            i2 = this.f1241KQgRr5e_0.clampViewPositionVertical(this.f1243KQgRr5e_0, i2, i4);
            ZzDuCHW_20.X6FRs_4(this.f1243KQgRr5e_0, i2 - top);
        }
        int i6 = i2;
        if (i3 == 0 && i4 == 0) {
            return;
        }
        this.f1241KQgRr5e_0.onViewPositionChanged(this.f1243KQgRr5e_0, i5, i6, i5 - left, i6 - top);
    }

    public boolean KQgRr5e_0(View view, int i, int i2) {
        return view != null && i >= view.getLeft() && i < view.getRight() && i2 >= view.getTop() && i2 < view.getBottom();
    }

    /* renamed from: KQgRr5e_0  reason: collision with other method in class */
    public View m584KQgRr5e_0(int i, int i2) {
        for (int childCount = this.f1244KQgRr5e_0.getChildCount() - 1; childCount >= 0; childCount--) {
            View childAt = this.f1244KQgRr5e_0.getChildAt(this.f1241KQgRr5e_0.getOrderedChildIndex(childCount));
            if (i >= childAt.getLeft() && i < childAt.getRight() && i2 >= childAt.getTop() && i2 < childAt.getBottom()) {
                return childAt;
            }
        }
        return null;
    }

    public final int KQgRr5e_0(int i, int i2) {
        int i3 = i < this.f1244KQgRr5e_0.getLeft() + this.f3313X6FRs_4 ? 1 : 0;
        if (i2 < this.f1244KQgRr5e_0.getTop() + this.f3313X6FRs_4) {
            i3 |= 4;
        }
        if (i > this.f1244KQgRr5e_0.getRight() - this.f3313X6FRs_4) {
            i3 |= 2;
        }
        return i2 > this.f1244KQgRr5e_0.getBottom() - this.f3313X6FRs_4 ? i3 | 8 : i3;
    }
}
