package defpackage;

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;

/* JADX INFO: renamed from: ˋᵪˎᴵ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public class C1531 {

    /* JADX INFO: renamed from: ʽˈˋ, reason: contains not printable characters */
    public RecyclerView f6172;

    /* JADX INFO: renamed from: ˊᵫᵗ, reason: contains not printable characters */
    public final LinearInterpolator f6173;

    /* JADX INFO: renamed from: ˋˈ, reason: contains not printable characters */
    public int f6174;

    /* JADX INFO: renamed from: ːˏᵟᵯ, reason: contains not printable characters */
    public AbstractC0421 f6175;

    /* JADX INFO: renamed from: ᵝᵶ, reason: contains not printable characters */
    public float f6176;

    /* JADX INFO: renamed from: ᵨᵣ, reason: contains not printable characters */
    public boolean f6177;

    /* JADX INFO: renamed from: ᵪᵹᵥᵻ, reason: contains not printable characters */
    public int f6178;

    /* JADX INFO: renamed from: ᵮᵣᵗˈ, reason: contains not printable characters */
    public boolean f6179;

    /* JADX INFO: renamed from: ᵱᵽʡᵚ, reason: contains not printable characters */
    public PointF f6180;

    /* JADX INFO: renamed from: ᵲᵶᵳˈ, reason: contains not printable characters */
    public int f6181 = -1;

    /* JADX INFO: renamed from: ᵵᵽ, reason: contains not printable characters */
    public final C2197 f6182;

    /* JADX INFO: renamed from: ᵶᵥᵝ, reason: contains not printable characters */
    public final DisplayMetrics f6183;

    /* JADX INFO: renamed from: ᵷᵺʾᵖ, reason: contains not printable characters */
    public boolean f6184;

    /* JADX INFO: renamed from: ᵻʽᵯ, reason: contains not printable characters */
    public final DecelerateInterpolator f6185;

    /* JADX INFO: renamed from: ᵻˈᵦʼ, reason: contains not printable characters */
    public View f6186;

    public C1531(Context context) {
        C2197 c2197 = new C2197();
        c2197.f8732 = -1;
        c2197.f8730 = false;
        c2197.f8731 = 0;
        c2197.f8728 = 0;
        c2197.f8729 = Integer.MIN_VALUE;
        c2197.f8733 = null;
        this.f6182 = c2197;
        this.f6173 = new LinearInterpolator();
        this.f6185 = new DecelerateInterpolator();
        this.f6179 = false;
        this.f6174 = 0;
        this.f6178 = 0;
        this.f6183 = context.getResources().getDisplayMetrics();
    }

    /* JADX INFO: renamed from: ᵲᵶᵳˈ, reason: contains not printable characters */
    public static int m4331(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;
            }
            ᵕᵩʽᵲ.ᵮᵣᵗˈ("snap preference should be one of the constants defined in SmoothScroller, starting with SNAP_");
            return 0;
        }
        int i6 = i3 - i;
        if (i6 > 0) {
            return i6;
        }
        int i7 = i4 - i2;
        if (i7 < 0) {
            return i7;
        }
        return 0;
    }

    /* JADX INFO: renamed from: ʽˈˋ, reason: contains not printable characters */
    public int mo4332(View view, int i) {
        AbstractC0421 abstractC0421 = this.f6175;
        if (abstractC0421 == null || !abstractC0421.mo312()) {
            return 0;
        }
        C5319 c5319 = (C5319) view.getLayoutParams();
        return m4331(abstractC0421.mo280(view) - ((ViewGroup.MarginLayoutParams) c5319).leftMargin, abstractC0421.mo262(view) + ((ViewGroup.MarginLayoutParams) c5319).rightMargin, abstractC0421.m1784(), abstractC0421.f2349 - abstractC0421.m1792(), i);
    }

    /* JADX INFO: renamed from: ˊᵫᵗ, reason: contains not printable characters */
    public void mo4333() {
        this.f6178 = 0;
        this.f6174 = 0;
        this.f6180 = null;
    }

    /* JADX INFO: renamed from: ːˏᵟᵯ, reason: contains not printable characters */
    public int mo4334(View view, int i) {
        AbstractC0421 abstractC0421 = this.f6175;
        if (abstractC0421 == null || !abstractC0421.mo333()) {
            return 0;
        }
        C5319 c5319 = (C5319) view.getLayoutParams();
        return m4331(abstractC0421.mo300(view) - ((ViewGroup.MarginLayoutParams) c5319).topMargin, abstractC0421.mo330(view) + ((ViewGroup.MarginLayoutParams) c5319).bottomMargin, abstractC0421.m1791(), abstractC0421.f2353 - abstractC0421.m1786(), i);
    }

    /* JADX INFO: renamed from: ᵨᵣ, reason: contains not printable characters */
    public int mo4335(int i) {
        float fAbs = Math.abs(i);
        if (!this.f6179) {
            this.f6176 = mo4338(this.f6183);
            this.f6179 = true;
        }
        return (int) Math.ceil(fAbs * this.f6176);
    }

    /* JADX INFO: renamed from: ᵱᵽʡᵚ, reason: contains not printable characters */
    public final void m4336() {
        if (this.f6177) {
            this.f6177 = false;
            mo4333();
            this.f6172.f899.f6054 = -1;
            this.f6186 = null;
            this.f6181 = -1;
            this.f6184 = false;
            AbstractC0421 abstractC0421 = this.f6175;
            if (abstractC0421.f2352 == this) {
                abstractC0421.f2352 = null;
            }
            this.f6175 = null;
            this.f6172 = null;
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:50:0x00f1  */
    /* JADX INFO: renamed from: ᵵᵽ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final void m4337(int i, int i2) {
        PointF pointFMo1344;
        RecyclerView recyclerView = this.f6172;
        if (this.f6181 == -1 || recyclerView == null) {
            m4336();
        }
        if (this.f6184 && this.f6186 == null && this.f6175 != null && (pointFMo1344 = mo1344(this.f6181)) != null) {
            float f = pointFMo1344.x;
            if (f != 0.0f || pointFMo1344.y != 0.0f) {
                recyclerView.m590(null, (int) Math.signum(f), (int) Math.signum(pointFMo1344.y));
            }
        }
        this.f6184 = false;
        View view = this.f6186;
        C2197 c2197 = this.f6182;
        if (view != null) {
            this.f6172.getClass();
            AbstractC4793 abstractC4793M539 = RecyclerView.m539(view);
            if ((abstractC4793M539 != null ? abstractC4793M539.m9999() : -1) == this.f6181) {
                View view2 = this.f6186;
                C1499 c1499 = recyclerView.f899;
                mo4339(view2, c2197);
                c2197.m5756(recyclerView);
                m4336();
            } else {
                this.f6186 = null;
            }
        }
        if (this.f6177) {
            C1499 c14992 = recyclerView.f899;
            if (this.f6172.f869.m1795() == 0) {
                m4336();
            } else {
                int i3 = this.f6174;
                int i4 = i3 - i;
                if (i3 * i4 <= 0) {
                    i4 = 0;
                }
                this.f6174 = i4;
                int i5 = this.f6178;
                int i6 = i5 - i2;
                if (i5 * i6 <= 0) {
                    i6 = 0;
                }
                this.f6178 = i6;
                if (i4 == 0 && i6 == 0) {
                    PointF pointFMo13442 = mo1344(this.f6181);
                    if (pointFMo13442 != null) {
                        if (pointFMo13442.x == 0.0f && pointFMo13442.y == 0.0f) {
                            c2197.f8732 = this.f6181;
                            m4336();
                        } else {
                            float f2 = pointFMo13442.y;
                            float fSqrt = (float) Math.sqrt((f2 * f2) + (r10 * r10));
                            float f3 = pointFMo13442.x / fSqrt;
                            pointFMo13442.x = f3;
                            float f4 = pointFMo13442.y / fSqrt;
                            pointFMo13442.y = f4;
                            this.f6180 = pointFMo13442;
                            this.f6174 = (int) (f3 * 10000.0f);
                            this.f6178 = (int) (f4 * 10000.0f);
                            int iMo4335 = mo4335(10000);
                            c2197.f8731 = (int) (this.f6174 * 1.2f);
                            c2197.f8728 = (int) (this.f6178 * 1.2f);
                            c2197.f8729 = (int) (iMo4335 * 1.2f);
                            c2197.f8733 = this.f6173;
                            c2197.f8730 = true;
                        }
                    }
                }
            }
            boolean z = c2197.f8732 >= 0;
            c2197.m5756(recyclerView);
            if (z && this.f6177) {
                this.f6184 = true;
                recyclerView.f921.m10092();
            }
        }
    }

    /* JADX INFO: renamed from: ᵷᵺʾᵖ, reason: contains not printable characters */
    public float mo4338(DisplayMetrics displayMetrics) {
        return 25.0f / displayMetrics.densityDpi;
    }

    /* JADX WARN: Removed duplicated region for block: B:10:0x0015  */
    /* JADX INFO: renamed from: ᵻʽᵯ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public void mo4339(View view, C2197 c2197) {
        int i;
        PointF pointF = this.f6180;
        int i2 = 0;
        if (pointF != null) {
            float f = pointF.x;
            i = f == 0.0f ? 0 : f > 0.0f ? 1 : -1;
        }
        int iMo4332 = mo4332(view, i);
        PointF pointF2 = this.f6180;
        if (pointF2 != null) {
            float f2 = pointF2.y;
            if (f2 != 0.0f) {
                i2 = f2 > 0.0f ? 1 : -1;
            }
        }
        int iMo4334 = mo4334(view, i2);
        int iCeil = (int) Math.ceil(((double) mo4335((int) Math.sqrt((iMo4334 * iMo4334) + (iMo4332 * iMo4332)))) / 0.3356d);
        if (iCeil > 0) {
            c2197.f8731 = -iMo4332;
            c2197.f8728 = -iMo4334;
            c2197.f8729 = iCeil;
            c2197.f8733 = this.f6185;
            c2197.f8730 = true;
        }
    }

    /* JADX INFO: renamed from: ᵻˈᵦʼ */
    public PointF mo1344(int i) {
        Object obj = this.f6175;
        if (obj instanceof InterfaceC3572) {
            return ((InterfaceC3572) obj).mo525(i);
        }
        return null;
    }
}
