package X6FRs_4.YghfZG_14.PGPF6hQ_2;

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: LinearSmoothScroller.java */
/* loaded from: classes.dex */
public class IMuAHx_6 extends RecyclerView.SI64pbG_23 {
    public final float KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public PointF f1349KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public final LinearInterpolator f1351KQgRr5e_0 = new LinearInterpolator();

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public final DecelerateInterpolator f1350KQgRr5e_0 = new DecelerateInterpolator();
    public int QxJ9d_1 = 0;
    public int PGPF6hQ_2 = 0;

    public IMuAHx_6(Context context) {
        this.KQgRr5e_0 = KQgRr5e_0(context.getResources().getDisplayMetrics());
    }

    @Override // androidx.recyclerview.widget.RecyclerView.SI64pbG_23
    public final int KQgRr5e_0(int i, int i2) {
        int i3 = i - i2;
        if (i * i3 <= 0) {
            return 0;
        }
        return i3;
    }

    @Override // androidx.recyclerview.widget.RecyclerView.SI64pbG_23
    public void KQgRr5e_0() {
    }

    @Override // androidx.recyclerview.widget.RecyclerView.SI64pbG_23
    public void KQgRr5e_0(View view, RecyclerView.G83uNX_24 g83uNX_24, RecyclerView.SI64pbG_23.KQgRr5e_0 kQgRr5e_0) {
        int KQgRr5e_0 = KQgRr5e_0(view, PGPF6hQ_2());
        int QxJ9d_1 = QxJ9d_1(view, Mqv2r_3());
        int KQgRr5e_02 = KQgRr5e_0((int) Math.sqrt((KQgRr5e_0 * KQgRr5e_0) + (QxJ9d_1 * QxJ9d_1)));
        if (KQgRr5e_02 > 0) {
            kQgRr5e_0.KQgRr5e_0(-KQgRr5e_0, -QxJ9d_1, KQgRr5e_02, this.f1350KQgRr5e_0);
        }
    }

    public int Mqv2r_3() {
        PointF pointF = this.f1349KQgRr5e_0;
        if (pointF != null) {
            float f = pointF.y;
            if (f != 0.0f) {
                return f > 0.0f ? 1 : -1;
            }
        }
        return 0;
    }

    @Override // androidx.recyclerview.widget.RecyclerView.SI64pbG_23
    public int PGPF6hQ_2() {
        PointF pointF = this.f1349KQgRr5e_0;
        if (pointF != null) {
            float f = pointF.x;
            if (f != 0.0f) {
                return f > 0.0f ? 1 : -1;
            }
        }
        return 0;
    }

    @Override // androidx.recyclerview.widget.RecyclerView.SI64pbG_23
    public void QxJ9d_1() {
        this.PGPF6hQ_2 = 0;
        this.QxJ9d_1 = 0;
        this.f1349KQgRr5e_0 = null;
    }

    public int QxJ9d_1(int i) {
        return (int) Math.ceil(Math.abs(i) * this.KQgRr5e_0);
    }

    public int QxJ9d_1(View view, int i) {
        RecyclerView.YghfZG_14 m919KQgRr5e_0 = m919KQgRr5e_0();
        if (m919KQgRr5e_0 == null || !m919KQgRr5e_0.m953QxJ9d_1()) {
            return 0;
        }
        RecyclerView.LayoutParams layoutParams = (RecyclerView.LayoutParams) view.getLayoutParams();
        return KQgRr5e_0(m919KQgRr5e_0.IMuAHx_6(view) - ((ViewGroup.MarginLayoutParams) layoutParams).topMargin, m919KQgRr5e_0.QxJ9d_1(view) + ((ViewGroup.MarginLayoutParams) layoutParams).bottomMargin, m919KQgRr5e_0.Nm6q_10(), m919KQgRr5e_0.PGPF6hQ_2() - m919KQgRr5e_0.FSaI4_7(), i);
    }

    @Override // androidx.recyclerview.widget.RecyclerView.SI64pbG_23
    public void KQgRr5e_0(int i, int i2, RecyclerView.G83uNX_24 g83uNX_24, RecyclerView.SI64pbG_23.KQgRr5e_0 kQgRr5e_0) {
        if (KQgRr5e_0() == 0) {
            PGPF6hQ_2();
            return;
        }
        this.QxJ9d_1 = KQgRr5e_0(this.QxJ9d_1, i);
        int KQgRr5e_0 = KQgRr5e_0(this.PGPF6hQ_2, i2);
        this.PGPF6hQ_2 = KQgRr5e_0;
        if (this.QxJ9d_1 == 0 && KQgRr5e_0 == 0) {
            KQgRr5e_0(kQgRr5e_0);
        }
    }

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

    @Override // androidx.recyclerview.widget.RecyclerView.SI64pbG_23
    public int KQgRr5e_0(int i) {
        double QxJ9d_1 = QxJ9d_1(i);
        Double.isNaN(QxJ9d_1);
        return (int) Math.ceil(QxJ9d_1 / 0.3356d);
    }

    public void KQgRr5e_0(RecyclerView.SI64pbG_23.KQgRr5e_0 kQgRr5e_0) {
        PointF KQgRr5e_0 = KQgRr5e_0(QxJ9d_1());
        if (KQgRr5e_0 != null && (KQgRr5e_0.x != 0.0f || KQgRr5e_0.y != 0.0f)) {
            KQgRr5e_0(KQgRr5e_0);
            this.f1349KQgRr5e_0 = KQgRr5e_0;
            this.QxJ9d_1 = (int) (KQgRr5e_0.x * 10000.0f);
            this.PGPF6hQ_2 = (int) (KQgRr5e_0.y * 10000.0f);
            kQgRr5e_0.KQgRr5e_0((int) (this.QxJ9d_1 * 1.2f), (int) (this.PGPF6hQ_2 * 1.2f), (int) (QxJ9d_1(10000) * 1.2f), this.f1351KQgRr5e_0);
            return;
        }
        kQgRr5e_0.KQgRr5e_0(QxJ9d_1());
        PGPF6hQ_2();
    }

    public int KQgRr5e_0(int i, int i2, int i3, int i4, int i5) {
        if (i5 != -1) {
            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;
        }
        return i3 - i;
    }

    public int KQgRr5e_0(View view, int i) {
        RecyclerView.YghfZG_14 m919KQgRr5e_0 = m919KQgRr5e_0();
        if (m919KQgRr5e_0 == null || !m919KQgRr5e_0.m942KQgRr5e_0()) {
            return 0;
        }
        RecyclerView.LayoutParams layoutParams = (RecyclerView.LayoutParams) view.getLayoutParams();
        return KQgRr5e_0(m919KQgRr5e_0.PGPF6hQ_2(view) - ((ViewGroup.MarginLayoutParams) layoutParams).leftMargin, m919KQgRr5e_0.IFxWkV_5(view) + ((ViewGroup.MarginLayoutParams) layoutParams).rightMargin, m919KQgRr5e_0.Xgtqvk_8(), m919KQgRr5e_0.KNBe_11() - m919KQgRr5e_0.XnFJ5_9(), i);
    }
}
