package o; import android.util.DisplayMetrics; import android.view.View; import android.view.animation.DecelerateInterpolator; import android.widget.Scroller; import androidx.recyclerview.widget.RecyclerView; import java.util.ArrayList; import java.util.List; /* loaded from: classes.dex */ public abstract class gxT extends RecyclerView.vUG { private Scroller b; RecyclerView c; private final RecyclerView.dAO e = new RecyclerView.dAO(this) { // from class: o.gxT.2 final gxT b; private boolean e = false; { this.b = this; } @Override // androidx.recyclerview.widget.RecyclerView.dAO public final void onScrollStateChanged(RecyclerView recyclerView, int i) { super.onScrollStateChanged(recyclerView, i); if (i == 0 && this.e) { this.e = false; this.b.e(); } } @Override // androidx.recyclerview.widget.RecyclerView.dAO public final void onScrolled(RecyclerView recyclerView, int i, int i2) { if (i == 0 && i2 == 0) { return; } this.e = true; } }; public abstract int b(RecyclerView.tOB tob, int i, int i2); public abstract View b(RecyclerView.tOB tob); public abstract int[] c(RecyclerView.tOB tob, View view); public void a(RecyclerView recyclerView) throws IllegalStateException { RecyclerView recyclerView2 = this.c; if (recyclerView2 == recyclerView) { return; } if (recyclerView2 != null) { RecyclerView.dAO dao = this.e; List list = recyclerView2.S; if (list != null) { list.remove(dao); } this.c.setOnFlingListener(null); } this.c = recyclerView; if (recyclerView != null) { if (recyclerView.H == null) { RecyclerView recyclerView3 = this.c; RecyclerView.dAO dao2 = this.e; if (recyclerView3.S == null) { recyclerView3.S = new ArrayList(); } recyclerView3.S.add(dao2); this.c.setOnFlingListener(this); this.b = new Scroller(this.c.getContext(), new DecelerateInterpolator()); e(); return; } throw new IllegalStateException("An instance of OnFlingListener already set."); } } protected RecyclerView.CeN a(RecyclerView.tOB tob) { return e(tob); } @Deprecated protected C11786els e(RecyclerView.tOB tob) { if (tob instanceof RecyclerView.CeN.RVV) { return new C11786els(this, this.c.getContext()) { // from class: o.gxT.4 final gxT a; { this.a = this; } @Override // o.C11786els, androidx.recyclerview.widget.RecyclerView.CeN public final void b(View view, RecyclerView.AcL acL, RecyclerView.CeN.IeS ieS) { if (this.a.c == null) { return; } gxT gxt = this.a; int[] c = gxt.c(gxt.c.x, view); int i = c[0]; int i2 = c[1]; int ceil = (int) Math.ceil(c(Math.max(Math.abs(i), Math.abs(i2))) / 0.3356d); if (ceil > 0) { DecelerateInterpolator decelerateInterpolator = this.b; ieS.e = i; ieS.d = i2; ieS.a = ceil; ieS.c = decelerateInterpolator; ieS.b = true; } } @Override // o.C11786els protected final float aoq_(DisplayMetrics displayMetrics) { return 100.0f / displayMetrics.densityDpi; } }; } return null; } @Override // androidx.recyclerview.widget.RecyclerView.vUG public final boolean e(int i, int i2) { RecyclerView.CeN a; int b; RecyclerView.tOB tob = this.c.x; if (tob == null || this.c.g == null) { return false; } int i3 = this.c.A; if ((Math.abs(i2) <= i3 && Math.abs(i) <= i3) || !(tob instanceof RecyclerView.CeN.RVV) || (a = a(tob)) == null || (b = b(tob, i, i2)) == -1) { return false; } a.f = b; tob.b(a); return true; } final void e() { RecyclerView.tOB tob; View b; RecyclerView recyclerView = this.c; if (recyclerView == null || (tob = recyclerView.x) == null || (b = b(tob)) == null) { return; } int[] c = c(tob, b); int i = c[0]; if (i == 0 && c[1] == 0) { return; } this.c.c(i, c[1], false); } }