package androidx.recyclerview.widget; import android.content.Context; import android.graphics.PointF; import android.os.Parcel; import android.os.Parcelable; import android.util.AttributeSet; import android.view.View; import android.view.ViewGroup; import android.view.accessibility.AccessibilityEvent; import androidx.core.view.ViewCompat; import androidx.recyclerview.widget.RecyclerView; import com.airbnb.deeplinkdispatch.UrlTreeKt; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import java.util.List; import o.C11786els; import o.Emo; import o.MSs; import o.pNC; import org.bouncycastle.asn1.cmp.PKIFailureInfo; /* loaded from: classes.dex */ public class LinearLayoutManager extends RecyclerView.tOB implements RecyclerView.CeN.RVV { private int A; private boolean B; private boolean C; private int[] D; private boolean E; private int a; private int b; private Sts c; private final IeS d; private boolean e; final RVV f; boolean g; public int h; MSs i; HBt j; private boolean z; /* JADX INFO: Access modifiers changed from: package-private */ public void c(RecyclerView.huo huoVar, RecyclerView.AcL acL, RVV rvv, int i) { } @Override // androidx.recyclerview.widget.RecyclerView.tOB public final boolean k_() { return true; } public LinearLayoutManager() { this(1, false); } public LinearLayoutManager(int i, boolean z) { this.h = 1; this.B = false; this.g = false; this.E = false; this.C = true; this.b = -1; this.A = PKIFailureInfo.systemUnavail; this.j = null; this.f = new RVV(); this.d = new IeS(); this.a = 2; this.D = new int[2]; e(i); if (this.j == null) { super.e((String) null); } if (this.B) { this.B = false; RecyclerView recyclerView = this.s; if (recyclerView != null) { recyclerView.requestLayout(); } } } public LinearLayoutManager(Context context, AttributeSet attributeSet, int i, int i2) { this.h = 1; this.B = false; this.g = false; this.E = false; this.C = true; this.b = -1; this.A = PKIFailureInfo.systemUnavail; this.j = null; this.f = new RVV(); this.d = new IeS(); this.a = 2; this.D = new int[2]; RecyclerView.tOB.IeS Ai_ = Ai_(context, attributeSet, i, i2); e(Ai_.a); boolean z = Ai_.c; if (this.j == null) { super.e((String) null); } if (z != this.B) { this.B = z; RecyclerView recyclerView = this.s; if (recyclerView != null) { recyclerView.requestLayout(); } } a(Ai_.b); } @Override // androidx.recyclerview.widget.RecyclerView.tOB public RecyclerView.saX e() { return new RecyclerView.saX(-2, -2); } @Override // androidx.recyclerview.widget.RecyclerView.tOB public final void e(RecyclerView recyclerView, RecyclerView.huo huoVar) { super.e(recyclerView, huoVar); } @Override // androidx.recyclerview.widget.RecyclerView.tOB public final void Iu_(AccessibilityEvent accessibilityEvent) { super.Iu_(accessibilityEvent); Emo emo = this.k; if (emo == null || emo.d.c() - emo.b.size() <= 0) { return; } accessibilityEvent.setFromIndex(j()); accessibilityEvent.setToIndex(h()); } @Override // androidx.recyclerview.widget.RecyclerView.tOB public final Parcelable HB_() { if (this.j != null) { return new HBt(this.j); } HBt hBt = new HBt(); Emo emo = this.k; if (emo != null && emo.d.c() - emo.b.size() > 0) { if (this.c == null) { this.c = new Sts(); } boolean z = this.e ^ this.g; hBt.a = z; if (z) { View x = x(); hBt.e = this.i.d() - this.i.a(x); hBt.c = ((RecyclerView.saX) x.getLayoutParams()).g.getLayoutPosition(); } else { View w = w(); hBt.c = ((RecyclerView.saX) w.getLayoutParams()).g.getLayoutPosition(); hBt.e = this.i.c(w) - this.i.i(); } } else { hBt.c = -1; } return hBt; } @Override // androidx.recyclerview.widget.RecyclerView.tOB public final void HA_(Parcelable parcelable) { if (parcelable instanceof HBt) { HBt hBt = (HBt) parcelable; this.j = hBt; if (this.b != -1) { hBt.c = -1; } RecyclerView recyclerView = this.s; if (recyclerView != null) { recyclerView.requestLayout(); } } } public void a(boolean z) { if (this.j == null) { super.e((String) null); } if (this.E == z) { return; } this.E = z; RecyclerView recyclerView = this.s; if (recyclerView != null) { recyclerView.requestLayout(); } } public final void e(int i) { MSs anonymousClass4; if (i != 0 && i != 1) { throw new IllegalArgumentException("invalid orientation:".concat(String.valueOf(i))); } if (this.j == null) { super.e((String) null); } if (i != this.h || this.i == null) { if (i == 0) { anonymousClass4 = new MSs.AnonymousClass4(this); } else { if (i != 1) { throw new IllegalArgumentException("invalid orientation"); } anonymousClass4 = new MSs.AnonymousClass3(this); } this.i = anonymousClass4; this.f.c = anonymousClass4; this.h = i; RecyclerView recyclerView = this.s; if (recyclerView != null) { recyclerView.requestLayout(); } } } @Override // androidx.recyclerview.widget.RecyclerView.tOB public final View a_(int i) { Emo emo = this.k; int c = emo != null ? emo.d.c() - emo.b.size() : 0; if (c == 0) { return null; } int layoutPosition = i - ((RecyclerView.saX) f(0).getLayoutParams()).g.getLayoutPosition(); if (layoutPosition >= 0 && layoutPosition < c) { View f = f(layoutPosition); if (((RecyclerView.saX) f.getLayoutParams()).g.getLayoutPosition() == i) { return f; } } return super.a_(i); } @Override // androidx.recyclerview.widget.RecyclerView.tOB public void d(RecyclerView recyclerView, int i) { C11786els c11786els = new C11786els(recyclerView.getContext()); c11786els.f = i; b(c11786els); } @Override // androidx.recyclerview.widget.RecyclerView.CeN.RVV public final PointF Hy_(int i) { Emo emo = this.k; if (emo == null || emo.d.c() - emo.b.size() == 0) { return null; } int i2 = (i < ((RecyclerView.saX) f(0).getLayoutParams()).g.getLayoutPosition()) != this.g ? -1 : 1; if (this.h == 0) { return new PointF(i2, BitmapDescriptorFactory.HUE_RED); } return new PointF(BitmapDescriptorFactory.HUE_RED, i2); } @Override // androidx.recyclerview.widget.RecyclerView.tOB public void d(RecyclerView.AcL acL) { super.d(acL); this.j = null; this.b = -1; this.A = PKIFailureInfo.systemUnavail; RVV rvv = this.f; rvv.b = -1; rvv.d = PKIFailureInfo.systemUnavail; rvv.e = false; rvv.a = false; } private int d(int i, RecyclerView.huo huoVar, RecyclerView.AcL acL, boolean z) { int d; int d2 = this.i.d() - i; if (d2 <= 0) { return 0; } int i2 = -d(-d2, huoVar, acL); if (!z || (d = this.i.d() - (i + i2)) <= 0) { return i2; } this.i.c(d); return d + i2; } private int c(int i, RecyclerView.huo huoVar, RecyclerView.AcL acL, boolean z) { int i2; int i3 = i - this.i.i(); if (i3 <= 0) { return 0; } int i4 = -d(i3, huoVar, acL); if (!z || (i2 = (i + i4) - this.i.i()) <= 0) { return i4; } this.i.c(-i2); return i4 - i2; } private void b(int i, int i2) { this.c.c = this.i.d() - i2; this.c.g = this.g ? -1 : 1; this.c.e = i; this.c.h = 1; this.c.j = i2; this.c.f6393o = PKIFailureInfo.systemUnavail; } private void e(int i, int i2) { this.c.c = i2 - this.i.i(); this.c.e = i; this.c.g = this.g ? 1 : -1; this.c.h = -1; this.c.j = i2; this.c.f6393o = PKIFailureInfo.systemUnavail; } @Override // androidx.recyclerview.widget.RecyclerView.tOB public int b(int i, RecyclerView.huo huoVar, RecyclerView.AcL acL) { if (this.h == 1) { return 0; } return d(i, huoVar, acL); } @Override // androidx.recyclerview.widget.RecyclerView.tOB public int c(int i, RecyclerView.huo huoVar, RecyclerView.AcL acL) { if (this.h == 0) { return 0; } return d(i, huoVar, acL); } @Override // androidx.recyclerview.widget.RecyclerView.tOB public int b(RecyclerView.AcL acL) { return h(acL); } @Override // androidx.recyclerview.widget.RecyclerView.tOB public int c(RecyclerView.AcL acL) { return h(acL); } @Override // androidx.recyclerview.widget.RecyclerView.tOB public final int f(RecyclerView.AcL acL) { return i(acL); } @Override // androidx.recyclerview.widget.RecyclerView.tOB public final int j(RecyclerView.AcL acL) { return i(acL); } @Override // androidx.recyclerview.widget.RecyclerView.tOB public int e(RecyclerView.AcL acL) { return g(acL); } @Override // androidx.recyclerview.widget.RecyclerView.tOB public int a(RecyclerView.AcL acL) { return g(acL); } private int h(RecyclerView.AcL acL) { Emo emo = this.k; if (emo == null || emo.d.c() - emo.b.size() == 0) { return 0; } if (this.c == null) { this.c = new Sts(); } return pNC.c(acL, this.i, c(!this.C), d(!this.C), this, this.C, this.g); } private int i(RecyclerView.AcL acL) { Emo emo = this.k; if (emo == null || emo.d.c() - emo.b.size() == 0) { return 0; } if (this.c == null) { this.c = new Sts(); } return pNC.b(acL, this.i, c(!this.C), d(!this.C), this, this.C); } private int g(RecyclerView.AcL acL) { Emo emo = this.k; if (emo == null || emo.d.c() - emo.b.size() == 0) { return 0; } if (this.c == null) { this.c = new Sts(); } return pNC.c(acL, this.i, c(!this.C), d(!this.C), this, this.C); } private void e(int i, int i2, boolean z, RecyclerView.AcL acL) { int i3; this.c.b = this.i.e() == 0 && this.i.c() == 0; this.c.h = i; int[] iArr = this.D; iArr[0] = 0; iArr[1] = 0; a(acL, iArr); int max = Math.max(0, this.D[0]); int max2 = Math.max(0, this.D[1]); boolean z2 = i == 1; this.c.d = z2 ? max2 : max; Sts sts = this.c; if (!z2) { max = max2; } sts.f = max; if (z2) { this.c.d += this.i.b(); View x = x(); this.c.g = this.g ? -1 : 1; this.c.e = ((RecyclerView.saX) x.getLayoutParams()).g.getLayoutPosition() + this.c.g; this.c.j = this.i.a(x); i3 = this.i.a(x) - this.i.d(); } else { View w = w(); this.c.d += this.i.i(); this.c.g = this.g ? 1 : -1; this.c.e = ((RecyclerView.saX) w.getLayoutParams()).g.getLayoutPosition() + this.c.g; this.c.j = this.i.c(w); i3 = (-this.i.c(w)) + this.i.i(); } this.c.c = i2; if (z) { this.c.c -= i3; } this.c.f6393o = i3; } void c(RecyclerView.AcL acL, Sts sts, RecyclerView.tOB.Sts sts2) { int i = sts.e; if (i >= 0) { if (i < (acL.c ? acL.i - acL.b : acL.h)) { sts2.c(i, Math.max(0, sts.f6393o)); } } } @Override // androidx.recyclerview.widget.RecyclerView.tOB public final void b(int i, int i2, RecyclerView.AcL acL, RecyclerView.tOB.Sts sts) { if (this.h != 0) { i = i2; } Emo emo = this.k; if (emo == null || emo.d.c() - emo.b.size() == 0 || i == 0) { return; } if (this.c == null) { this.c = new Sts(); } e(i > 0 ? 1 : -1, Math.abs(i), true, acL); c(acL, this.c, sts); } private int d(int i, RecyclerView.huo huoVar, RecyclerView.AcL acL) { Emo emo = this.k; if (emo == null || emo.d.c() - emo.b.size() == 0 || i == 0) { return 0; } if (this.c == null) { this.c = new Sts(); } this.c.l = true; int i2 = i > 0 ? 1 : -1; int abs = Math.abs(i); e(i2, abs, true, acL); int a = this.c.f6393o + a(huoVar, this.c, acL, false); if (a < 0) { return 0; } if (abs > a) { i = i2 * a; } this.i.c(-i); this.c.i = i; return i; } @Override // androidx.recyclerview.widget.RecyclerView.tOB public final void e(String str) { if (this.j == null) { super.e(str); } } private void c(RecyclerView.huo huoVar, int i, int i2) { if (i == i2) { return; } if (i2 <= i) { while (i > i2) { e(i, huoVar); i--; } } else { while (true) { i2--; if (i2 < i) { return; } else { e(i2, huoVar); } } } } private void c(RecyclerView.huo huoVar, Sts sts) { if (!sts.l || sts.b) { return; } int i = sts.f6393o; int i2 = sts.f; if (sts.h == -1) { Emo emo = this.k; int c = emo != null ? emo.d.c() - emo.b.size() : 0; if (i >= 0) { int c2 = (this.i.c() - i) + i2; if (this.g) { for (int i3 = 0; i3 < c; i3++) { View f = f(i3); if (this.i.c(f) < c2 || this.i.h(f) < c2) { c(huoVar, 0, i3); return; } } return; } int i4 = c - 1; for (int i5 = i4; i5 >= 0; i5--) { View f2 = f(i5); if (this.i.c(f2) < c2 || this.i.h(f2) < c2) { c(huoVar, i4, i5); return; } } return; } return; } if (i >= 0) { int i6 = i - i2; Emo emo2 = this.k; int c3 = emo2 != null ? emo2.d.c() - emo2.b.size() : 0; if (!this.g) { for (int i7 = 0; i7 < c3; i7++) { View f3 = f(i7); if (this.i.a(f3) > i6 || this.i.d(f3) > i6) { c(huoVar, 0, i7); return; } } return; } int i8 = c3 - 1; for (int i9 = i8; i9 >= 0; i9--) { View f4 = f(i9); if (this.i.a(f4) > i6 || this.i.d(f4) > i6) { c(huoVar, i8, i9); return; } } } } private int a(RecyclerView.huo huoVar, Sts sts, RecyclerView.AcL acL, boolean z) { int i; int i2 = sts.c; if (sts.f6393o != Integer.MIN_VALUE) { if (sts.c < 0) { sts.f6393o += sts.c; } c(huoVar, sts); } int i3 = sts.c + sts.d; IeS ieS = this.d; while (true) { if ((!sts.b && i3 <= 0) || (i = sts.e) < 0) { break; } if (i >= (acL.c ? acL.i - acL.b : acL.h)) { break; } ieS.d = 0; ieS.c = false; ieS.a = false; ieS.b = false; c(huoVar, acL, sts, ieS); if (!ieS.c) { sts.j += ieS.d * sts.h; if (!ieS.a || sts.m != null || !acL.c) { sts.c -= ieS.d; i3 -= ieS.d; } if (sts.f6393o != Integer.MIN_VALUE) { sts.f6393o += ieS.d; if (sts.c < 0) { sts.f6393o += sts.c; } c(huoVar, sts); } if (z && ieS.b) { break; } } else { break; } } return i2 - sts.c; } void c(RecyclerView.huo huoVar, RecyclerView.AcL acL, Sts sts, IeS ieS) { int i; int i2; int i3; int i4; View d = sts.d(huoVar); if (d == null) { ieS.c = true; return; } RecyclerView.saX sax = (RecyclerView.saX) d.getLayoutParams(); if (sts.m == null) { if (this.g == (sts.h == -1)) { a_(d); } else { d(d, 0); } } else { if (this.g == (sts.h == -1)) { e(d); } else { c(d); } } o(d); ieS.d = this.i.e(d); if (this.h != 1) { int paddingTop = getPaddingTop(); int b = this.i.b(d) + paddingTop; if (sts.h == -1) { int i5 = sts.j; i3 = sts.j - ieS.d; i2 = paddingTop; i4 = b; i = i5; } else { int i6 = sts.j; i = sts.j + ieS.d; i2 = paddingTop; i3 = i6; i4 = b; } } else { if (ViewCompat.m(this.s) == 1) { i = this.w - getPaddingRight(); i3 = i - this.i.b(d); } else { i3 = getPaddingLeft(); i = this.i.b(d) + i3; } if (sts.h == -1) { i4 = sts.j; i2 = sts.j - ieS.d; } else { int i7 = sts.j; i4 = sts.j + ieS.d; i2 = i7; } } b(d, i3, i2, i, i4); if (sax.g.isRemoved() || sax.g.isUpdated()) { ieS.a = true; } ieS.b = d.hasFocusable(); } private View w() { if (this.g) { Emo emo = this.k; r1 = (emo != null ? emo.d.c() - emo.b.size() : 0) - 1; } return f(r1); } private View x() { if (!this.g) { Emo emo = this.k; r1 = (emo != null ? emo.d.c() - emo.b.size() : 0) - 1; } return f(r1); } private View c(boolean z) { if (this.g) { Emo emo = this.k; return c((emo != null ? emo.d.c() - emo.b.size() : 0) - 1, -1, z, true); } Emo emo2 = this.k; return c(0, emo2 != null ? emo2.d.c() - emo2.b.size() : 0, z, true); } private View d(boolean z) { if (this.g) { Emo emo = this.k; return c(0, emo != null ? emo.d.c() - emo.b.size() : 0, z, true); } Emo emo2 = this.k; return c((emo2 != null ? emo2.d.c() - emo2.b.size() : 0) - 1, -1, z, true); } View c(RecyclerView.huo huoVar, RecyclerView.AcL acL, boolean z, boolean z2) { int i; int i2; if (this.c == null) { this.c = new Sts(); } Emo emo = this.k; int c = emo != null ? emo.d.c() - emo.b.size() : 0; if (z2) { Emo emo2 = this.k; int c2 = emo2 != null ? emo2.d.c() - emo2.b.size() : 0; c = -1; i2 = c2 - 1; i = -1; } else { i = 1; i2 = 0; } int i3 = acL.c ? acL.i - acL.b : acL.h; int i4 = this.i.i(); int d = this.i.d(); View view = null; View view2 = null; View view3 = null; while (i2 != c) { View f = f(i2); int layoutPosition = ((RecyclerView.saX) f.getLayoutParams()).g.getLayoutPosition(); int c3 = this.i.c(f); int a = this.i.a(f); if (layoutPosition >= 0 && layoutPosition < i3) { if (!((RecyclerView.saX) f.getLayoutParams()).g.isRemoved()) { boolean z3 = a <= i4 && c3 < i4; boolean z4 = c3 >= d && a > d; if (!z3 && !z4) { return f; } if (z) { if (!z4) { if (view != null) { } view = f; } view2 = f; } else { if (!z3) { if (view != null) { } view = f; } view2 = f; } } else if (view3 == null) { view3 = f; } } i2 += i; } return view == null ? view2 != null ? view2 : view3 : view; } private View s() { Emo emo = this.k; return c(0, emo != null ? emo.d.c() - emo.b.size() : 0); } private View v() { return c((this.k != null ? r0.d.c() - r0.b.size() : 0) - 1, -1); } public final int j() { Emo emo = this.k; View c = c(0, emo != null ? emo.d.c() - emo.b.size() : 0, false, true); if (c == null) { return -1; } return ((RecyclerView.saX) c.getLayoutParams()).g.getLayoutPosition(); } public final int h() { Emo emo = this.k; View c = c((emo != null ? emo.d.c() - emo.b.size() : 0) - 1, -1, false, true); if (c != null) { return ((RecyclerView.saX) c.getLayoutParams()).g.getLayoutPosition(); } return -1; } public final int i() { Emo emo = this.k; View c = c((emo != null ? emo.d.c() - emo.b.size() : 0) - 1, -1, true, false); if (c != null) { return ((RecyclerView.saX) c.getLayoutParams()).g.getLayoutPosition(); } return -1; } public final View c(int i, int i2, boolean z, boolean z2) { if (this.c == null) { this.c = new Sts(); } int i3 = z ? 24579 : 320; int i4 = z2 ? 320 : 0; if (this.h == 0) { return this.f6396o.c(i, i2, i3, i4); } return this.v.c(i, i2, i3, i4); } private View c(int i, int i2) { int i3; int i4; if (this.c == null) { this.c = new Sts(); } if (i2 <= i && i2 >= i) { return f(i); } if (this.i.c(f(i)) < this.i.i()) { i3 = 16644; i4 = 16388; } else { i3 = 4161; i4 = 4097; } if (this.h == 0) { return this.f6396o.c(i, i2, i3, i4); } return this.v.c(i, i2, i3, i4); } @Override // androidx.recyclerview.widget.RecyclerView.tOB public View a(View view, int i, RecyclerView.huo huoVar, RecyclerView.AcL acL) { int c; View v; View x; u(); Emo emo = this.k; if (emo == null || emo.d.c() - emo.b.size() == 0 || (c = c(i)) == Integer.MIN_VALUE) { return null; } if (this.c == null) { this.c = new Sts(); } e(c, (int) (this.i.h() * 0.33333334f), false, acL); this.c.f6393o = PKIFailureInfo.systemUnavail; this.c.l = false; a(huoVar, this.c, acL, true); if (c == -1) { if (this.g) { v = v(); } else { v = s(); } } else if (this.g) { v = s(); } else { v = v(); } if (c == -1) { x = w(); } else { x = x(); } if (!x.hasFocusable()) { return v; } if (v == null) { return null; } return x; } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes.dex */ public static class Sts { boolean b; int c; int e; int g; int h; int i; int j; /* renamed from: o, reason: collision with root package name */ int f6393o; boolean l = true; int d = 0; int f = 0; boolean a = false; List m = null; Sts() { } /* JADX INFO: Access modifiers changed from: package-private */ public final View d(RecyclerView.huo huoVar) { if (this.m != null) { return d(); } View b = huoVar.b(this.e); this.e += this.g; return b; } private View d() { int size = this.m.size(); for (int i = 0; i < size; i++) { View view = this.m.get(i).itemView; RecyclerView.saX sax = (RecyclerView.saX) view.getLayoutParams(); if (!sax.g.isRemoved() && this.e == sax.g.getLayoutPosition()) { d(view); return view; } } return null; } public final void d(View view) { View e = e(view); if (e == null) { this.e = -1; } else { this.e = ((RecyclerView.saX) e.getLayoutParams()).g.getLayoutPosition(); } } private View e(View view) { int layoutPosition; int size = this.m.size(); View view2 = null; int i = Integer.MAX_VALUE; for (int i2 = 0; i2 < size; i2++) { View view3 = this.m.get(i2).itemView; RecyclerView.saX sax = (RecyclerView.saX) view3.getLayoutParams(); if (view3 != view && !sax.g.isRemoved() && (layoutPosition = (sax.g.getLayoutPosition() - this.e) * this.g) >= 0 && layoutPosition < i) { view2 = view3; if (layoutPosition == 0) { break; } i = layoutPosition; } } return view2; } } /* loaded from: classes.dex */ public static class HBt implements Parcelable { public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { // from class: androidx.recyclerview.widget.LinearLayoutManager.HBt.5 @Override // android.os.Parcelable.Creator public final /* synthetic */ HBt createFromParcel(Parcel parcel) { return new HBt(parcel); } @Override // android.os.Parcelable.Creator public final /* bridge */ /* synthetic */ HBt[] newArray(int i) { return new HBt[i]; } }; boolean a; int c; int e; @Override // android.os.Parcelable public final int describeContents() { return 0; } public HBt() { } HBt(Parcel parcel) { this.c = parcel.readInt(); this.e = parcel.readInt(); this.a = parcel.readInt() == 1; } public HBt(HBt hBt) { this.c = hBt.c; this.e = hBt.e; this.a = hBt.a; } @Override // android.os.Parcelable public final void writeToParcel(Parcel parcel, int i) { parcel.writeInt(this.c); parcel.writeInt(this.e); parcel.writeInt(this.a ? 1 : 0); } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes.dex */ public static class RVV { MSs c; int b = -1; int d = PKIFailureInfo.systemUnavail; boolean e = false; boolean a = false; RVV() { } public final String toString() { StringBuilder sb = new StringBuilder("AnchorInfo{mPosition="); sb.append(this.b); sb.append(", mCoordinate="); sb.append(this.d); sb.append(", mLayoutFromEnd="); sb.append(this.e); sb.append(", mValid="); sb.append(this.a); sb.append(UrlTreeKt.componentParamSuffixChar); return sb.toString(); } public final void e(View view, int i) { MSs mSs = this.c; int h = Integer.MIN_VALUE == mSs.c ? 0 : mSs.h() - mSs.c; if (h >= 0) { b(view, i); return; } this.b = i; if (this.e) { int d = (this.c.d() - h) - this.c.a(view); this.d = this.c.d() - d; if (d > 0) { int e = this.c.e(view); int i2 = this.d; int i3 = this.c.i(); int min = (i2 - e) - (i3 + Math.min(this.c.c(view) - i3, 0)); if (min < 0) { this.d += Math.min(d, -min); return; } return; } return; } int c = this.c.c(view); int i4 = c - this.c.i(); this.d = c; if (i4 > 0) { int d2 = (this.c.d() - Math.min(0, (this.c.d() - h) - this.c.a(view))) - (c + this.c.e(view)); if (d2 < 0) { this.d -= Math.min(i4, -d2); } } } public final void b(View view, int i) { if (this.e) { int a = this.c.a(view); MSs mSs = this.c; this.d = a + (Integer.MIN_VALUE == mSs.c ? 0 : mSs.h() - mSs.c); } else { this.d = this.c.c(view); } this.b = i; } } /* JADX INFO: Access modifiers changed from: protected */ /* loaded from: classes.dex */ public static class IeS { public boolean a; public boolean b; public boolean c; public int d; protected IeS() { } } private void u() { this.g = (this.h == 1 || ViewCompat.m(this.s) != 1) ? this.B : !this.B; } public void a(RecyclerView.AcL acL, int[] iArr) { int i; int h = acL.l != -1 ? this.i.h() : 0; if (this.c.h == -1) { i = 0; } else { i = h; h = 0; } iArr[0] = h; iArr[1] = i; } @Override // androidx.recyclerview.widget.RecyclerView.tOB public final void d(int i, RecyclerView.tOB.Sts sts) { boolean z; int i2; HBt hBt = this.j; if (hBt != null && hBt.c >= 0) { z = this.j.a; i2 = this.j.c; } else { u(); z = this.g; i2 = this.b; if (i2 == -1) { i2 = z ? i - 1 : 0; } } int i3 = z ? -1 : 1; for (int i4 = 0; i4 < this.a && i2 >= 0 && i2 < i; i4++) { sts.c(i2, 0); i2 += i3; } } @Override // androidx.recyclerview.widget.RecyclerView.tOB public void e(RecyclerView.huo huoVar, RecyclerView.AcL acL) { int i; int i2; View c; int i3; int i4; int c2; int i5; int i6; int i7; Emo emo; int i8; int i9; int d; int i10; View a_; int c3; int i11; if (this.j != null || this.b != -1) { if ((acL.c ? acL.i - acL.b : acL.h) == 0) { c(huoVar); return; } } HBt hBt = this.j; if (hBt != null && hBt.c >= 0) { this.b = this.j.c; } if (this.c == null) { this.c = new Sts(); } this.c.l = false; u(); View j_ = j_(); if (this.f.a && this.b == -1 && this.j == null) { if (j_ != null && (this.i.c(j_) >= this.i.d() || this.i.a(j_) <= this.i.i())) { this.f.e(j_, ((RecyclerView.saX) j_.getLayoutParams()).g.getLayoutPosition()); } } else { RVV rvv = this.f; rvv.b = -1; rvv.d = PKIFailureInfo.systemUnavail; rvv.e = false; rvv.a = false; this.f.e = this.g ^ this.E; RVV rvv2 = this.f; if (!acL.c && (i3 = this.b) != -1) { if (i3 >= 0) { if (i3 < (acL.c ? acL.i - acL.b : acL.h)) { rvv2.b = this.b; HBt hBt2 = this.j; if (hBt2 != null && hBt2.c >= 0) { rvv2.e = this.j.a; if (rvv2.e) { rvv2.d = this.i.d() - this.j.e; } else { rvv2.d = this.i.i() + this.j.e; } } else if (this.A == Integer.MIN_VALUE) { View a_2 = a_(this.b); if (a_2 != null) { if (this.i.e(a_2) > this.i.h()) { if (rvv2.e) { i5 = rvv2.c.d(); } else { i5 = rvv2.c.i(); } rvv2.d = i5; } else if (this.i.c(a_2) - this.i.i() < 0) { rvv2.d = this.i.i(); rvv2.e = false; } else if (this.i.d() - this.i.a(a_2) < 0) { rvv2.d = this.i.d(); rvv2.e = true; } else { if (rvv2.e) { int a = this.i.a(a_2); MSs mSs = this.i; c2 = a + (Integer.MIN_VALUE == mSs.c ? 0 : mSs.h() - mSs.c); } else { c2 = this.i.c(a_2); } rvv2.d = c2; } } else { Emo emo2 = this.k; if (emo2 != null && emo2.d.c() - emo2.b.size() > 0) { rvv2.e = (this.b < ((RecyclerView.saX) f(0).getLayoutParams()).g.getLayoutPosition()) == this.g; } if (rvv2.e) { i4 = rvv2.c.d(); } else { i4 = rvv2.c.i(); } rvv2.d = i4; } } else { rvv2.e = this.g; if (this.g) { rvv2.d = this.i.d() - this.A; } else { rvv2.d = this.i.i() + this.A; } } this.f.a = true; } } this.b = -1; this.A = PKIFailureInfo.systemUnavail; } Emo emo3 = this.k; if (emo3 != null && emo3.d.c() - emo3.b.size() != 0) { View j_2 = j_(); if (j_2 != null) { RecyclerView.saX sax = (RecyclerView.saX) j_2.getLayoutParams(); if (!sax.g.isRemoved() && sax.g.getLayoutPosition() >= 0) { if (sax.g.getLayoutPosition() < (acL.c ? acL.i - acL.b : acL.h)) { rvv2.e(j_2, ((RecyclerView.saX) j_2.getLayoutParams()).g.getLayoutPosition()); this.f.a = true; } } } if (this.e == this.E && (c = c(huoVar, acL, rvv2.e, this.E)) != null) { rvv2.b(c, ((RecyclerView.saX) c.getLayoutParams()).g.getLayoutPosition()); if (!acL.c && n_()) { int c4 = this.i.c(c); int a2 = this.i.a(c); int i12 = this.i.i(); int d2 = this.i.d(); boolean z = a2 <= i12 && c4 < i12; boolean z2 = c4 >= d2 && a2 > d2; if (z || z2) { if (rvv2.e) { i12 = d2; } rvv2.d = i12; } } this.f.a = true; } } if (rvv2.e) { i = rvv2.c.d(); } else { i = rvv2.c.i(); } rvv2.d = i; if (this.E) { i2 = (acL.c ? acL.i - acL.b : acL.h) - 1; } else { i2 = 0; } rvv2.b = i2; this.f.a = true; } Sts sts = this.c; sts.h = sts.i >= 0 ? 1 : -1; int[] iArr = this.D; iArr[0] = 0; iArr[1] = 0; a(acL, iArr); int max = Math.max(0, this.D[0]) + this.i.i(); int max2 = Math.max(0, this.D[1]) + this.i.b(); if (acL.c && (i10 = this.b) != -1 && this.A != Integer.MIN_VALUE && (a_ = a_(i10)) != null) { if (this.g) { i11 = this.i.d() - this.i.a(a_); c3 = this.A; } else { c3 = this.i.c(a_) - this.i.i(); i11 = this.A; } int i13 = i11 - c3; if (i13 > 0) { max += i13; } else { max2 -= i13; } } c(huoVar, acL, this.f, (!this.f.e ? this.g : !this.g) ? 1 : -1); a(huoVar); this.c.b = this.i.e() == 0 && this.i.c() == 0; this.c.a = acL.c; this.c.f = 0; if (!this.f.e) { RVV rvv3 = this.f; b(rvv3.b, rvv3.d); this.c.d = max2; a(huoVar, this.c, acL, false); i6 = this.c.j; int i14 = this.c.e; if (this.c.c > 0) { max += this.c.c; } RVV rvv4 = this.f; e(rvv4.b, rvv4.d); this.c.d = max; this.c.e += this.c.g; a(huoVar, this.c, acL, false); i7 = this.c.j; if (this.c.c > 0) { int i15 = this.c.c; b(i14, i6); this.c.d = i15; a(huoVar, this.c, acL, false); i6 = this.c.j; } } else { RVV rvv5 = this.f; e(rvv5.b, rvv5.d); this.c.d = max; a(huoVar, this.c, acL, false); i7 = this.c.j; int i16 = this.c.e; if (this.c.c > 0) { max2 += this.c.c; } RVV rvv6 = this.f; b(rvv6.b, rvv6.d); this.c.d = max2; this.c.e += this.c.g; a(huoVar, this.c, acL, false); i6 = this.c.j; if (this.c.c > 0) { int i17 = this.c.c; e(i16, i7); this.c.d = i17; a(huoVar, this.c, acL, false); i7 = this.c.j; } } Emo emo4 = this.k; if (emo4 != null && emo4.d.c() - emo4.b.size() > 0) { if (this.g ^ this.E) { int d3 = d(i6, huoVar, acL, true); i8 = i7 + d3; i9 = i6 + d3; d = c(i8, huoVar, acL, false); } else { int c5 = c(i7, huoVar, acL, true); i8 = i7 + c5; i9 = i6 + c5; d = d(i9, huoVar, acL, false); } i7 = i8 + d; i6 = i9 + d; } if (acL.f6395o && (emo = this.k) != null && emo.d.c() - emo.b.size() != 0 && !acL.c && n_()) { List list = huoVar.i; int size = list.size(); int layoutPosition = ((RecyclerView.saX) f(0).getLayoutParams()).g.getLayoutPosition(); int i18 = 0; int i19 = 0; for (int i20 = 0; i20 < size; i20++) { RecyclerView.zJl zjl = list.get(i20); if (!zjl.isRemoved()) { if ((zjl.getLayoutPosition() < layoutPosition) != this.g) { i18 += this.i.e(zjl.itemView); } else { i19 += this.i.e(zjl.itemView); } } } this.c.m = list; if (i18 > 0) { e(((RecyclerView.saX) w().getLayoutParams()).g.getLayoutPosition(), i7); this.c.d = i18; this.c.c = 0; this.c.d((View) null); a(huoVar, this.c, acL, false); } if (i19 > 0) { b(((RecyclerView.saX) x().getLayoutParams()).g.getLayoutPosition(), i6); this.c.d = i19; this.c.c = 0; this.c.d((View) null); a(huoVar, this.c, acL, false); } this.c.m = null; } if (!acL.c) { MSs mSs2 = this.i; mSs2.c = mSs2.h(); } else { RVV rvv7 = this.f; rvv7.b = -1; rvv7.d = PKIFailureInfo.systemUnavail; rvv7.e = false; rvv7.a = false; } this.e = this.E; } @Override // androidx.recyclerview.widget.RecyclerView.tOB public final void b(int i) { this.b = i; this.A = PKIFailureInfo.systemUnavail; HBt hBt = this.j; if (hBt != null) { hBt.c = -1; } RecyclerView recyclerView = this.s; if (recyclerView != null) { recyclerView.requestLayout(); } } @Override // androidx.recyclerview.widget.RecyclerView.tOB final boolean m_() { if (this.m == 1073741824 || this.x == 1073741824) { return false; } Emo emo = this.k; int c = emo != null ? emo.d.c() - emo.b.size() : 0; for (int i = 0; i < c; i++) { ViewGroup.LayoutParams layoutParams = f(i).getLayoutParams(); if (layoutParams.width < 0 && layoutParams.height < 0) { return true; } } return false; } /* JADX INFO: Access modifiers changed from: package-private */ public final int c(int i) { if (i == 1) { return (this.h != 1 && ViewCompat.m(this.s) == 1) ? 1 : -1; } if (i == 2) { return (this.h != 1 && ViewCompat.m(this.s) == 1) ? -1 : 1; } if (i == 17) { if (this.h != 0) { return PKIFailureInfo.systemUnavail; } return -1; } if (i == 33) { if (this.h != 1) { return PKIFailureInfo.systemUnavail; } return -1; } if (i == 66) { if (this.h == 0) { return 1; } return PKIFailureInfo.systemUnavail; } if (i == 130 && this.h == 1) { return 1; } return PKIFailureInfo.systemUnavail; } /* JADX INFO: Access modifiers changed from: package-private */ public final void f() { if (this.c == null) { this.c = new Sts(); } } @Override // androidx.recyclerview.widget.RecyclerView.tOB public boolean n_() { return this.j == null && this.e == this.E; } @Override // androidx.recyclerview.widget.RecyclerView.tOB public boolean c() { return this.h == 1; } @Override // androidx.recyclerview.widget.RecyclerView.tOB public final boolean d() { return this.h == 0; } }