package o;

import android.content.Context;
import android.graphics.PointF;
import android.util.DisplayMetrics;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.LinearInterpolator;
import androidx.recyclerview.widget.RecyclerView;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.xL, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public class C2896xL {
    public int a = -1;
    public RecyclerView b;
    public AbstractC1157f10 c;
    public boolean d;
    public boolean e;
    public View f;
    public final C2014o10 g;
    public final LinearInterpolator h;
    public final DecelerateInterpolator i;
    public PointF j;
    public final DisplayMetrics k;
    public boolean l;
    public float m;
    public int n;

    /* renamed from: o, reason: collision with root package name */
    public int f789o;

    public C2896xL(Context context) {
        C2014o10 c2014o10 = new C2014o10();
        c2014o10.d = -1;
        c2014o10.f = false;
        c2014o10.a = 0;
        c2014o10.b = 0;
        c2014o10.c = Integer.MIN_VALUE;
        c2014o10.e = null;
        this.g = c2014o10;
        this.h = new LinearInterpolator();
        this.i = new DecelerateInterpolator();
        this.l = false;
        this.n = 0;
        this.f789o = 0;
        this.k = context.getResources().getDisplayMetrics();
    }

    public static int a(int i, int i2, int i3, int i4, int i5) {
        if (i5 == -1) {
            return i3 - i;
        }
        if (i5 != 0) {
            if (i5 == 1) {
                return i4 - i2;
            }
            throw new IllegalArgumentException("snap preference should be one of the constants defined in SmoothScroller, starting with SNAP_");
        }
        int i6 = i3 - i;
        if (i6 > 0) {
            return i6;
        }
        int i7 = i4 - i2;
        if (i7 < 0) {
            return i7;
        }
        return 0;
    }

    public int b(View view, int i) {
        AbstractC1157f10 abstractC1157f10 = this.c;
        if (abstractC1157f10 == null || !abstractC1157f10.d()) {
            return 0;
        }
        C1253g10 c1253g10 = (C1253g10) view.getLayoutParams();
        return a((view.getLeft() - ((C1253g10) view.getLayoutParams()).b.left) - ((ViewGroup.MarginLayoutParams) c1253g10).leftMargin, view.getRight() + ((C1253g10) view.getLayoutParams()).b.right + ((ViewGroup.MarginLayoutParams) c1253g10).rightMargin, abstractC1157f10.E(), abstractC1157f10.n - abstractC1157f10.F(), i);
    }

    public int c(View view, int i) {
        AbstractC1157f10 abstractC1157f10 = this.c;
        if (abstractC1157f10 == null || !abstractC1157f10.e()) {
            return 0;
        }
        C1253g10 c1253g10 = (C1253g10) view.getLayoutParams();
        return a((view.getTop() - ((C1253g10) view.getLayoutParams()).b.top) - ((ViewGroup.MarginLayoutParams) c1253g10).topMargin, view.getBottom() + ((C1253g10) view.getLayoutParams()).b.bottom + ((ViewGroup.MarginLayoutParams) c1253g10).bottomMargin, abstractC1157f10.G(), abstractC1157f10.f519o - abstractC1157f10.D(), i);
    }

    public float d(DisplayMetrics displayMetrics) {
        return 25.0f / displayMetrics.densityDpi;
    }

    public int e(int i) {
        float fAbs = Math.abs(i);
        if (!this.l) {
            this.m = d(this.k);
            this.l = true;
        }
        return (int) Math.ceil(fAbs * this.m);
    }

    public PointF f(int i) {
        Object obj = this.c;
        if (obj instanceof InterfaceC2109p10) {
            return ((InterfaceC2109p10) obj).a(i);
        }
        return null;
    }

    /* JADX WARN: Removed duplicated region for block: B:50:0x00f1  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final void g(int r9, int r10) {
        /*
            Method dump skipped, instructions count: 270
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: o.C2896xL.g(int, int):void");
    }

    /* JADX WARN: Removed duplicated region for block: B:10:0x0015  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public void h(android.view.View r7, o.C2014o10 r8) {
        /*
            r6 = this;
            android.graphics.PointF r0 = r6.j
            r1 = 0
            r2 = -1
            r3 = 1
            r4 = 0
            if (r0 == 0) goto L15
            float r0 = r0.x
            int r0 = (r0 > r4 ? 1 : (r0 == r4 ? 0 : -1))
            if (r0 != 0) goto Lf
            goto L15
        Lf:
            if (r0 <= 0) goto L13
            r0 = r3
            goto L16
        L13:
            r0 = r2
            goto L16
        L15:
            r0 = r1
        L16:
            int r0 = r6.b(r7, r0)
            android.graphics.PointF r5 = r6.j
            if (r5 == 0) goto L2a
            float r5 = r5.y
            int r4 = (r5 > r4 ? 1 : (r5 == r4 ? 0 : -1))
            if (r4 != 0) goto L25
            goto L2a
        L25:
            if (r4 <= 0) goto L29
            r1 = r3
            goto L2a
        L29:
            r1 = r2
        L2a:
            int r7 = r6.c(r7, r1)
            int r1 = r0 * r0
            int r2 = r7 * r7
            int r2 = r2 + r1
            double r1 = (double) r2
            double r1 = java.lang.Math.sqrt(r1)
            int r1 = (int) r1
            int r1 = r6.e(r1)
            double r1 = (double) r1
            r4 = 4599717252057688074(0x3fd57a786c22680a, double:0.3356)
            double r1 = r1 / r4
            double r1 = java.lang.Math.ceil(r1)
            int r1 = (int) r1
            if (r1 <= 0) goto L59
            int r0 = -r0
            int r7 = -r7
            r8.a = r0
            r8.b = r7
            r8.c = r1
            android.view.animation.DecelerateInterpolator r7 = r6.i
            r8.e = r7
            r8.f = r3
        L59:
            return
        */
        throw new UnsupportedOperationException("Method not decompiled: o.C2896xL.h(android.view.View, o.o10):void");
    }

    public final void i() {
        if (this.e) {
            this.e = false;
            this.f789o = 0;
            this.n = 0;
            this.j = null;
            this.b.n0.a = -1;
            this.f = null;
            this.a = -1;
            this.d = false;
            AbstractC1157f10 abstractC1157f10 = this.c;
            if (abstractC1157f10.e == this) {
                abstractC1157f10.e = null;
            }
            this.c = null;
            this.b = null;
        }
    }
}
