package o; import android.os.Parcel; import android.os.Parcelable; import android.view.MotionEvent; import android.view.View; import android.view.ViewConfiguration; import androidx.recyclerview.widget.RecyclerView; /* renamed from: o.leh, reason: case insensitive filesystem */ /* loaded from: classes2.dex */ public final class C16148leh { public IeS a; public HBt b; int c; int e; RecyclerView f; int h; public kIT j; private Sts k; long i = -1; boolean d = false; private RecyclerView.jNh g = new RecyclerView.jNh(this) { // from class: o.leh.5 private C16148leh e; @Override // androidx.recyclerview.widget.RecyclerView.jNh public final void Oc_(RecyclerView recyclerView, MotionEvent motionEvent) { } @Override // androidx.recyclerview.widget.RecyclerView.jNh public final void b(boolean z) { } { this.e = this; } @Override // androidx.recyclerview.widget.RecyclerView.jNh public final boolean Ob_(RecyclerView recyclerView, MotionEvent motionEvent) { C16148leh c16148leh = this.e; if (c16148leh.j != null) { int actionMasked = motionEvent.getActionMasked(); if (actionMasked == 0) { View a = recyclerView.a(motionEvent.getX(), motionEvent.getY()); RecyclerView.zJl g = a != null ? recyclerView.g(a) : null; c16148leh.c = (int) (motionEvent.getX() + 0.5f); c16148leh.e = (int) (motionEvent.getY() + 0.5f); if (g instanceof InterfaceC9756dpr) { c16148leh.i = g.getItemId(); } else { c16148leh.i = -1L; } } else if (actionMasked == 1 || actionMasked == 3) { long j = c16148leh.i; int i = c16148leh.c; int i2 = c16148leh.e; c16148leh.i = -1L; c16148leh.c = 0; c16148leh.e = 0; if (j != -1 && motionEvent.getActionMasked() == 1 && c16148leh.f.B <= 0) { int x = (int) (motionEvent.getX() + 0.5f); int y = (int) (motionEvent.getY() + 0.5f); if (Math.abs(x - i) < c16148leh.h && Math.abs(y - i2) < c16148leh.h) { View a2 = recyclerView.a(motionEvent.getX(), motionEvent.getY()); RecyclerView.zJl g2 = a2 != null ? recyclerView.g(a2) : null; if (g2 != null && g2.getItemId() == j) { RecyclerView.Sts sts = c16148leh.f.g; int layoutPosition = g2.getLayoutPosition(); if (layoutPosition != g2.getAdapterPosition()) { layoutPosition = -1; } int c = ury.c(sts, c16148leh.j, null, layoutPosition, null); if (c != -1) { View view = g2.itemView; view.getTranslationX(); view.getTranslationY(); view.getLeft(); view.getTop(); kIT kit = c16148leh.j; if (kit.a != null) { long c2 = kit.g.c(c); int i3 = (int) c2; if (((int) (c2 >>> 32)) == -1) { boolean z = !((kit.g.c[i3] & 2147483648L) != 0); if (kit.a.b((Qpt) g2)) { if (z) { kit.a(i3, true); } else { kit.e(i3, true); } } } } } } } } } } return false; } }; /* renamed from: o.leh$HBt */ /* loaded from: classes2.dex */ public interface HBt { void d(int i); } /* renamed from: o.leh$IeS */ /* loaded from: classes2.dex */ public interface IeS { void e(int i); } public C16148leh(Parcelable parcelable) { if (parcelable instanceof Sts) { this.k = (Sts) parcelable; } } public final void b() { RecyclerView.jNh jnh; RecyclerView recyclerView = this.f; if (recyclerView != null && (jnh = this.g) != null) { recyclerView.E.remove(jnh); if (recyclerView.p == jnh) { recyclerView.p = null; } } this.g = null; this.b = null; this.a = null; this.f = null; this.k = null; } public final RecyclerView.Sts d(RecyclerView.Sts sts) { if (!sts.hasStableIds()) { throw new IllegalArgumentException("The passed adapter does not support stable IDs"); } if (this.j != null) { throw new IllegalStateException("already have a wrapped adapter"); } Sts sts2 = this.k; long[] jArr = sts2 != null ? sts2.b : null; this.k = null; kIT kit = new kIT(this, sts, jArr); this.j = kit; kit.e = this.b; this.b = null; this.j.b = this.a; this.a = null; return this.j; } public final Parcelable Oa_() { C15174gjB c15174gjB; kIT kit = this.j; long[] jArr = null; if (kit != null && (c15174gjB = kit.g) != null) { jArr = c15174gjB.d(); } return new Sts(jArr); } public final void e() { kIT kit = this.j; if (kit == null || kit.g.j == 0 || kit.g.b()) { return; } C15174gjB c15174gjB = kit.g; Qpt qpt = kit.a; boolean z = kit.c.d; c15174gjB.d(qpt, 2, false); kit.notifyDataSetChanged(); } public final boolean d(int i) { kIT kit = this.j; return (kit == null || (kit.g.c[i] & 2147483648L) == 0) ? false : true; } /* renamed from: o.leh$Sts */ /* loaded from: classes2.dex */ public static class Sts implements Parcelable { public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { // from class: o.leh.Sts.5 @Override // android.os.Parcelable.Creator public final /* synthetic */ Sts createFromParcel(Parcel parcel) { return new Sts(parcel); } @Override // android.os.Parcelable.Creator public final /* bridge */ /* synthetic */ Sts[] newArray(int i) { return new Sts[i]; } }; final long[] b; @Override // android.os.Parcelable public final int describeContents() { return 0; } public Sts(long[] jArr) { this.b = jArr; } @Override // android.os.Parcelable public final void writeToParcel(Parcel parcel, int i) { parcel.writeLongArray(this.b); } Sts(Parcel parcel) { this.b = parcel.createLongArray(); } } public final void b(RecyclerView recyclerView) { RecyclerView.jNh jnh = this.g; if (jnh != null) { if (this.f != null) { throw new IllegalStateException("RecyclerView instance has already been set"); } this.f = recyclerView; recyclerView.E.add(jnh); this.h = ViewConfiguration.get(this.f.getContext()).getScaledTouchSlop(); return; } throw new IllegalStateException("Accessing released object"); } }