package o; import android.view.ViewGroup; import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView.zJl; import java.util.List; import org.bouncycastle.asn1.cmp.PKIFailureInfo; /* loaded from: classes2.dex */ public final class qHQ extends DDX { JuK a; iIq b; boolean c; int e; C16549pIo f; int g; int h; RecyclerView.zJl i; private C15703hqi j; public qHQ(C15703hqi c15703hqi, RecyclerView.Sts sts) { super(sts); this.g = -1; this.e = -1; this.j = c15703hqi; } @Override // o.DDX public final void a() { super.a(); this.i = null; this.b = null; this.j = null; } @Override // o.DDX, androidx.recyclerview.widget.RecyclerView.Sts public final VH onCreateViewHolder(ViewGroup viewGroup, int i) { VH vh = (VH) super.onCreateViewHolder(viewGroup, i); if (vh instanceof YNE) { ((YNE) vh).b(-1); } return vh; } /* JADX INFO: Access modifiers changed from: package-private */ public static int b(int i, int i2, int i3, int i4) { if (i2 < 0 || i3 < 0) { return i; } if (i4 == 0) { return i2 != i3 ? (i >= i2 || i >= i3) ? (i <= i2 || i <= i3) ? i3 < i2 ? i == i3 ? i2 : i - 1 : i == i3 ? i2 : i + 1 : i : i : i; } if (i4 == 1) { return i == i3 ? i2 : i == i2 ? i3 : i; } throw new IllegalStateException("unexpected state"); } @Override // o.DDX public final void e() { if (b()) { C15703hqi c15703hqi = this.j; if (c15703hqi != null) { c15703hqi.b(false); return; } return; } super.e(); } @Override // o.DDX public final void b(int i, int i2) { if (b()) { C15703hqi c15703hqi = this.j; if (c15703hqi != null) { c15703hqi.b(false); return; } return; } super.b(i, i2); } @Override // o.DDX public final void f(int i, int i2) { if (b()) { C15703hqi c15703hqi = this.j; if (c15703hqi != null) { c15703hqi.b(false); return; } return; } super.f(i, i2); } @Override // o.DDX public final void j(int i, int i2) { if (b()) { C15703hqi c15703hqi = this.j; if (c15703hqi != null) { c15703hqi.b(false); return; } return; } super.j(i, i2); } @Override // o.DDX public final void d(int i, int i2, int i3) { if (b()) { C15703hqi c15703hqi = this.j; if (c15703hqi != null) { c15703hqi.b(false); return; } return; } super.d(i, i2, i3); } /* JADX WARN: Multi-variable type inference failed */ private static void e(RecyclerView.zJl zjl, int i) { if (zjl instanceof YNE) { YNE yne = (YNE) zjl; int a = yne.a(); if (a == -1 || ((a ^ i) & Integer.MAX_VALUE) != 0) { i |= PKIFailureInfo.systemUnavail; } yne.b(i); } } private boolean b() { return (this.f == null || this.c) ? false : true; } @Override // o.DDX, androidx.recyclerview.widget.RecyclerView.Sts public final long getItemId(int i) { if (this.f != null) { return super.getItemId(b(i, this.g, this.e, this.h)); } return super.getItemId(i); } @Override // o.DDX, androidx.recyclerview.widget.RecyclerView.Sts public final int getItemViewType(int i) { if (this.f != null) { return super.getItemViewType(b(i, this.g, this.e, this.h)); } return super.getItemViewType(i); } @Override // o.DDX, androidx.recyclerview.widget.RecyclerView.Sts public final void onBindViewHolder(VH vh, int i, List list) { C16549pIo c16549pIo = this.f; if (c16549pIo != null) { long j = c16549pIo.c; long itemId = vh.getItemId(); int b = b(i, this.g, this.e, this.h); if (itemId == j && vh != this.i) { this.i = vh; C15703hqi c15703hqi = this.j; if (c15703hqi.n != null) { c15703hqi.n = null; c15703hqi.l.d(); } c15703hqi.n = vh; c15703hqi.l.a(vh); } int i2 = itemId == j ? 3 : 1; JuK juK = this.a; if (i >= juK.c && i <= juK.b) { i2 |= 4; } e(vh, i2); super.onBindViewHolder(vh, b, list); return; } e(vh, 0); super.onBindViewHolder(vh, i, list); } @Override // o.DDX, o.InterfaceC7784cup public final void b(VH vh, int i) { if (this.f != null) { C15703hqi c15703hqi = this.j; if (vh != c15703hqi.n) { C15730iBR c15730iBR = c15703hqi.J; if (c15730iBR != null && vh == c15730iBR.c) { c15730iBR.a(null); } } else { c15703hqi.n = null; c15703hqi.l.d(); } this.i = this.j.n; } super.b((qHQ) vh, i); } }