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; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import com.huawei.hms.android.HwBuildEx; /* renamed from: o.els, reason: case insensitive filesystem */ /* loaded from: classes.dex */ public class C11786els extends RecyclerView.CeN { private final DisplayMetrics a; private float k; private PointF l; protected final LinearInterpolator d = new LinearInterpolator(); public final DecelerateInterpolator b = new DecelerateInterpolator(); private boolean n = false; private int m = 0; /* renamed from: o, reason: collision with root package name */ private int f9045o = 0; public C11786els(Context context) { this.a = context.getResources().getDisplayMetrics(); } @Override // androidx.recyclerview.widget.RecyclerView.CeN public void b(View view, RecyclerView.AcL acL, RecyclerView.CeN.IeS ieS) { int a = a(view, a()); PointF pointF = this.l; int i = 0; int i2 = (pointF == null || pointF.y == BitmapDescriptorFactory.HUE_RED) ? 0 : this.l.y > BitmapDescriptorFactory.HUE_RED ? 1 : -1; RecyclerView.tOB tob = this.e; if (tob != null && tob.c()) { RecyclerView.saX sax = (RecyclerView.saX) view.getLayoutParams(); i = a((view.getTop() - RecyclerView.tOB.m(view)) - ((ViewGroup.MarginLayoutParams) sax).topMargin, view.getBottom() + RecyclerView.tOB.b(view) + ((ViewGroup.MarginLayoutParams) sax).bottomMargin, tob.getPaddingTop(), tob.l - tob.getPaddingBottom(), i2); } int ceil = (int) Math.ceil(c((int) Math.sqrt((a * a) + (i * i))) / 0.3356d); if (ceil > 0) { int i3 = -i; DecelerateInterpolator decelerateInterpolator = this.b; ieS.e = -a; ieS.d = i3; ieS.a = ceil; ieS.c = decelerateInterpolator; ieS.b = true; } } @Override // androidx.recyclerview.widget.RecyclerView.CeN public final void d(int i, int i2, RecyclerView.CeN.IeS ieS) { if (this.i.x.i_() == 0) { c(); return; } int i3 = this.m; int i4 = i3 - i; if (i3 * i4 <= 0) { i4 = 0; } this.m = i4; int i5 = this.f9045o; int i6 = i5 - i2; int i7 = i5 * i6 > 0 ? i6 : 0; this.f9045o = i7; if (i4 == 0 && i7 == 0) { PointF Iw_ = Iw_(this.f); if (Iw_ == null || (Iw_.x == BitmapDescriptorFactory.HUE_RED && Iw_.y == BitmapDescriptorFactory.HUE_RED)) { ieS.g = this.f; c(); return; } float sqrt = (float) Math.sqrt((Iw_.x * Iw_.x) + (Iw_.y * Iw_.y)); Iw_.x /= sqrt; Iw_.y /= sqrt; this.l = Iw_; this.m = (int) (Iw_.x * 10000.0f); this.f9045o = (int) (Iw_.y * 10000.0f); int c = c(HwBuildEx.VersionCodes.CUR_DEVELOPMENT); LinearInterpolator linearInterpolator = this.d; ieS.e = (int) (this.m * 1.2f); ieS.d = (int) (this.f9045o * 1.2f); ieS.a = (int) (c * 1.2f); ieS.c = linearInterpolator; ieS.b = true; } } protected float aoq_(DisplayMetrics displayMetrics) { return 25.0f / displayMetrics.densityDpi; } public int c(int i) { float abs = Math.abs(i); if (!this.n) { this.k = aoq_(this.a); this.n = true; } return (int) Math.ceil(abs * this.k); } protected int a() { PointF pointF = this.l; if (pointF == null || pointF.x == BitmapDescriptorFactory.HUE_RED) { return 0; } return this.l.x > BitmapDescriptorFactory.HUE_RED ? 1 : -1; } private 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 a(View view, int i) { RecyclerView.tOB tob = this.e; if (tob == null || !tob.d()) { return 0; } RecyclerView.saX sax = (RecyclerView.saX) view.getLayoutParams(); int left = view.getLeft() - RecyclerView.tOB.h(view); int i2 = ((ViewGroup.MarginLayoutParams) sax).leftMargin; return a(left - i2, view.getRight() + RecyclerView.tOB.j(view) + ((ViewGroup.MarginLayoutParams) sax).rightMargin, tob.getPaddingLeft(), tob.w - tob.getPaddingRight(), i); } @Override // androidx.recyclerview.widget.RecyclerView.CeN public final void d() { this.f9045o = 0; this.m = 0; this.l = null; } }