package androidx.recyclerview.widget; import android.content.Context; import android.graphics.PointF; import android.graphics.Rect; 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.recyclerview.widget.RecyclerView; import com.google.android.gms.common.api.Api; import java.util.ArrayList; import java.util.Arrays; import java.util.BitSet; import java.util.List; import z.a0; /* loaded from: classes.dex */ public class StaggeredGridLayoutManager extends RecyclerView.o implements RecyclerView.z.b { private BitSet B; private boolean G; private boolean H; private e I; private int J; private int[] O; /* renamed from: t, reason: collision with root package name */ f[] f2333t; /* renamed from: u, reason: collision with root package name */ j f2334u; /* renamed from: v, reason: collision with root package name */ j f2335v; /* renamed from: w, reason: collision with root package name */ private int f2336w; /* renamed from: x, reason: collision with root package name */ private int f2337x; /* renamed from: y, reason: collision with root package name */ private final androidx.recyclerview.widget.f f2338y; /* renamed from: s, reason: collision with root package name */ private int f2332s = -1; /* renamed from: z, reason: collision with root package name */ boolean f2339z = false; boolean A = false; int C = -1; int D = RecyclerView.UNDEFINED_DURATION; d E = new d(); private int F = 2; private final Rect K = new Rect(); private final b L = new b(); private boolean M = false; private boolean N = true; private final Runnable P = new a(); class a implements Runnable { a() { } @Override // java.lang.Runnable public void run() { StaggeredGridLayoutManager.this.S1(); } } class b { /* renamed from: a, reason: collision with root package name */ int f2341a; /* renamed from: b, reason: collision with root package name */ int f2342b; /* renamed from: c, reason: collision with root package name */ boolean f2343c; /* renamed from: d, reason: collision with root package name */ boolean f2344d; /* renamed from: e, reason: collision with root package name */ boolean f2345e; /* renamed from: f, reason: collision with root package name */ int[] f2346f; b() { c(); } void a() { this.f2342b = this.f2343c ? StaggeredGridLayoutManager.this.f2334u.i() : StaggeredGridLayoutManager.this.f2334u.m(); } void b(int i10) { if (this.f2343c) { this.f2342b = StaggeredGridLayoutManager.this.f2334u.i() - i10; } else { this.f2342b = StaggeredGridLayoutManager.this.f2334u.m() + i10; } } void c() { this.f2341a = -1; this.f2342b = RecyclerView.UNDEFINED_DURATION; this.f2343c = false; this.f2344d = false; this.f2345e = false; int[] iArr = this.f2346f; if (iArr != null) { Arrays.fill(iArr, -1); } } void d(f[] fVarArr) { int length = fVarArr.length; int[] iArr = this.f2346f; if (iArr == null || iArr.length < length) { this.f2346f = new int[StaggeredGridLayoutManager.this.f2333t.length]; } for (int i10 = 0; i10 < length; i10++) { this.f2346f[i10] = fVarArr[i10].p(RecyclerView.UNDEFINED_DURATION); } } } public static class c extends RecyclerView.p { /* renamed from: e, reason: collision with root package name */ f f2348e; /* renamed from: f, reason: collision with root package name */ boolean f2349f; public c(Context context, AttributeSet attributeSet) { super(context, attributeSet); } public final int e() { f fVar = this.f2348e; if (fVar == null) { return -1; } return fVar.f2370e; } public boolean f() { return this.f2349f; } public c(int i10, int i11) { super(i10, i11); } public c(ViewGroup.MarginLayoutParams marginLayoutParams) { super(marginLayoutParams); } public c(ViewGroup.LayoutParams layoutParams) { super(layoutParams); } } public static class e implements Parcelable { public static final Parcelable.Creator CREATOR = new a(); /* renamed from: a, reason: collision with root package name */ int f2356a; /* renamed from: b, reason: collision with root package name */ int f2357b; /* renamed from: c, reason: collision with root package name */ int f2358c; /* renamed from: d, reason: collision with root package name */ int[] f2359d; /* renamed from: e, reason: collision with root package name */ int f2360e; /* renamed from: f, reason: collision with root package name */ int[] f2361f; /* renamed from: g, reason: collision with root package name */ List f2362g; /* renamed from: h, reason: collision with root package name */ boolean f2363h; /* renamed from: i, reason: collision with root package name */ boolean f2364i; /* renamed from: j, reason: collision with root package name */ boolean f2365j; static class a implements Parcelable.Creator { a() { } @Override // android.os.Parcelable.Creator /* renamed from: a, reason: merged with bridge method [inline-methods] */ public e createFromParcel(Parcel parcel) { return new e(parcel); } @Override // android.os.Parcelable.Creator /* renamed from: b, reason: merged with bridge method [inline-methods] */ public e[] newArray(int i10) { return new e[i10]; } } public e() { } void a() { this.f2359d = null; this.f2358c = 0; this.f2356a = -1; this.f2357b = -1; } void b() { this.f2359d = null; this.f2358c = 0; this.f2360e = 0; this.f2361f = null; this.f2362g = null; } @Override // android.os.Parcelable public int describeContents() { return 0; } @Override // android.os.Parcelable public void writeToParcel(Parcel parcel, int i10) { parcel.writeInt(this.f2356a); parcel.writeInt(this.f2357b); parcel.writeInt(this.f2358c); if (this.f2358c > 0) { parcel.writeIntArray(this.f2359d); } parcel.writeInt(this.f2360e); if (this.f2360e > 0) { parcel.writeIntArray(this.f2361f); } parcel.writeInt(this.f2363h ? 1 : 0); parcel.writeInt(this.f2364i ? 1 : 0); parcel.writeInt(this.f2365j ? 1 : 0); parcel.writeList(this.f2362g); } e(Parcel parcel) { this.f2356a = parcel.readInt(); this.f2357b = parcel.readInt(); int readInt = parcel.readInt(); this.f2358c = readInt; if (readInt > 0) { int[] iArr = new int[readInt]; this.f2359d = iArr; parcel.readIntArray(iArr); } int readInt2 = parcel.readInt(); this.f2360e = readInt2; if (readInt2 > 0) { int[] iArr2 = new int[readInt2]; this.f2361f = iArr2; parcel.readIntArray(iArr2); } this.f2363h = parcel.readInt() == 1; this.f2364i = parcel.readInt() == 1; this.f2365j = parcel.readInt() == 1; this.f2362g = parcel.readArrayList(d.a.class.getClassLoader()); } public e(e eVar) { this.f2358c = eVar.f2358c; this.f2356a = eVar.f2356a; this.f2357b = eVar.f2357b; this.f2359d = eVar.f2359d; this.f2360e = eVar.f2360e; this.f2361f = eVar.f2361f; this.f2363h = eVar.f2363h; this.f2364i = eVar.f2364i; this.f2365j = eVar.f2365j; this.f2362g = eVar.f2362g; } } class f { /* renamed from: a, reason: collision with root package name */ ArrayList f2366a = new ArrayList(); /* renamed from: b, reason: collision with root package name */ int f2367b = RecyclerView.UNDEFINED_DURATION; /* renamed from: c, reason: collision with root package name */ int f2368c = RecyclerView.UNDEFINED_DURATION; /* renamed from: d, reason: collision with root package name */ int f2369d = 0; /* renamed from: e, reason: collision with root package name */ final int f2370e; f(int i10) { this.f2370e = i10; } void a(View view) { c n10 = n(view); n10.f2348e = this; this.f2366a.add(view); this.f2368c = RecyclerView.UNDEFINED_DURATION; if (this.f2366a.size() == 1) { this.f2367b = RecyclerView.UNDEFINED_DURATION; } if (n10.c() || n10.b()) { this.f2369d += StaggeredGridLayoutManager.this.f2334u.e(view); } } void b(boolean z10, int i10) { int l10 = z10 ? l(RecyclerView.UNDEFINED_DURATION) : p(RecyclerView.UNDEFINED_DURATION); e(); if (l10 == Integer.MIN_VALUE) { return; } if (!z10 || l10 >= StaggeredGridLayoutManager.this.f2334u.i()) { if (z10 || l10 <= StaggeredGridLayoutManager.this.f2334u.m()) { if (i10 != Integer.MIN_VALUE) { l10 += i10; } this.f2368c = l10; this.f2367b = l10; } } } void c() { d.a f10; ArrayList arrayList = this.f2366a; View view = (View) arrayList.get(arrayList.size() - 1); c n10 = n(view); this.f2368c = StaggeredGridLayoutManager.this.f2334u.d(view); if (n10.f2349f && (f10 = StaggeredGridLayoutManager.this.E.f(n10.a())) != null && f10.f2353b == 1) { this.f2368c += f10.a(this.f2370e); } } void d() { d.a f10; View view = (View) this.f2366a.get(0); c n10 = n(view); this.f2367b = StaggeredGridLayoutManager.this.f2334u.g(view); if (n10.f2349f && (f10 = StaggeredGridLayoutManager.this.E.f(n10.a())) != null && f10.f2353b == -1) { this.f2367b -= f10.a(this.f2370e); } } void e() { this.f2366a.clear(); q(); this.f2369d = 0; } public int f() { return StaggeredGridLayoutManager.this.f2339z ? i(this.f2366a.size() - 1, -1, true) : i(0, this.f2366a.size(), true); } public int g() { return StaggeredGridLayoutManager.this.f2339z ? i(0, this.f2366a.size(), true) : i(this.f2366a.size() - 1, -1, true); } int h(int i10, int i11, boolean z10, boolean z11, boolean z12) { int m10 = StaggeredGridLayoutManager.this.f2334u.m(); int i12 = StaggeredGridLayoutManager.this.f2334u.i(); int i13 = i11 > i10 ? 1 : -1; while (i10 != i11) { View view = (View) this.f2366a.get(i10); int g10 = StaggeredGridLayoutManager.this.f2334u.g(view); int d10 = StaggeredGridLayoutManager.this.f2334u.d(view); boolean z13 = false; boolean z14 = !z12 ? g10 >= i12 : g10 > i12; if (!z12 ? d10 > m10 : d10 >= m10) { z13 = true; } if (z14 && z13) { if (z10 && z11) { if (g10 >= m10 && d10 <= i12) { return StaggeredGridLayoutManager.this.h0(view); } } else { if (z11) { return StaggeredGridLayoutManager.this.h0(view); } if (g10 < m10 || d10 > i12) { return StaggeredGridLayoutManager.this.h0(view); } } } i10 += i13; } return -1; } int i(int i10, int i11, boolean z10) { return h(i10, i11, false, false, z10); } public int j() { return this.f2369d; } int k() { int i10 = this.f2368c; if (i10 != Integer.MIN_VALUE) { return i10; } c(); return this.f2368c; } int l(int i10) { int i11 = this.f2368c; if (i11 != Integer.MIN_VALUE) { return i11; } if (this.f2366a.size() == 0) { return i10; } c(); return this.f2368c; } public View m(int i10, int i11) { View view = null; if (i11 != -1) { int size = this.f2366a.size() - 1; while (size >= 0) { View view2 = (View) this.f2366a.get(size); StaggeredGridLayoutManager staggeredGridLayoutManager = StaggeredGridLayoutManager.this; if (staggeredGridLayoutManager.f2339z && staggeredGridLayoutManager.h0(view2) >= i10) { break; } StaggeredGridLayoutManager staggeredGridLayoutManager2 = StaggeredGridLayoutManager.this; if ((!staggeredGridLayoutManager2.f2339z && staggeredGridLayoutManager2.h0(view2) <= i10) || !view2.hasFocusable()) { break; } size--; view = view2; } } else { int size2 = this.f2366a.size(); int i12 = 0; while (i12 < size2) { View view3 = (View) this.f2366a.get(i12); StaggeredGridLayoutManager staggeredGridLayoutManager3 = StaggeredGridLayoutManager.this; if (staggeredGridLayoutManager3.f2339z && staggeredGridLayoutManager3.h0(view3) <= i10) { break; } StaggeredGridLayoutManager staggeredGridLayoutManager4 = StaggeredGridLayoutManager.this; if ((!staggeredGridLayoutManager4.f2339z && staggeredGridLayoutManager4.h0(view3) >= i10) || !view3.hasFocusable()) { break; } i12++; view = view3; } } return view; } c n(View view) { return (c) view.getLayoutParams(); } int o() { int i10 = this.f2367b; if (i10 != Integer.MIN_VALUE) { return i10; } d(); return this.f2367b; } int p(int i10) { int i11 = this.f2367b; if (i11 != Integer.MIN_VALUE) { return i11; } if (this.f2366a.size() == 0) { return i10; } d(); return this.f2367b; } void q() { this.f2367b = RecyclerView.UNDEFINED_DURATION; this.f2368c = RecyclerView.UNDEFINED_DURATION; } void r(int i10) { int i11 = this.f2367b; if (i11 != Integer.MIN_VALUE) { this.f2367b = i11 + i10; } int i12 = this.f2368c; if (i12 != Integer.MIN_VALUE) { this.f2368c = i12 + i10; } } void s() { int size = this.f2366a.size(); View view = (View) this.f2366a.remove(size - 1); c n10 = n(view); n10.f2348e = null; if (n10.c() || n10.b()) { this.f2369d -= StaggeredGridLayoutManager.this.f2334u.e(view); } if (size == 1) { this.f2367b = RecyclerView.UNDEFINED_DURATION; } this.f2368c = RecyclerView.UNDEFINED_DURATION; } void t() { View view = (View) this.f2366a.remove(0); c n10 = n(view); n10.f2348e = null; if (this.f2366a.size() == 0) { this.f2368c = RecyclerView.UNDEFINED_DURATION; } if (n10.c() || n10.b()) { this.f2369d -= StaggeredGridLayoutManager.this.f2334u.e(view); } this.f2367b = RecyclerView.UNDEFINED_DURATION; } void u(View view) { c n10 = n(view); n10.f2348e = this; this.f2366a.add(0, view); this.f2367b = RecyclerView.UNDEFINED_DURATION; if (this.f2366a.size() == 1) { this.f2368c = RecyclerView.UNDEFINED_DURATION; } if (n10.c() || n10.b()) { this.f2369d += StaggeredGridLayoutManager.this.f2334u.e(view); } } void v(int i10) { this.f2367b = i10; this.f2368c = i10; } } public StaggeredGridLayoutManager(Context context, AttributeSet attributeSet, int i10, int i11) { RecyclerView.o.d i02 = RecyclerView.o.i0(context, attributeSet, i10, i11); H2(i02.f2293a); J2(i02.f2294b); I2(i02.f2295c); this.f2338y = new androidx.recyclerview.widget.f(); a2(); } private void A2(RecyclerView.v vVar, androidx.recyclerview.widget.f fVar) { if (!fVar.f2486a || fVar.f2494i) { return; } if (fVar.f2487b == 0) { if (fVar.f2490e == -1) { B2(vVar, fVar.f2492g); return; } else { C2(vVar, fVar.f2491f); return; } } if (fVar.f2490e != -1) { int n22 = n2(fVar.f2492g) - fVar.f2492g; C2(vVar, n22 < 0 ? fVar.f2491f : Math.min(n22, fVar.f2487b) + fVar.f2491f); } else { int i10 = fVar.f2491f; int m22 = i10 - m2(i10); B2(vVar, m22 < 0 ? fVar.f2492g : fVar.f2492g - Math.min(m22, fVar.f2487b)); } } private void B2(RecyclerView.v vVar, int i10) { for (int J = J() - 1; J >= 0; J--) { View I = I(J); if (this.f2334u.g(I) < i10 || this.f2334u.q(I) < i10) { return; } c cVar = (c) I.getLayoutParams(); if (cVar.f2349f) { for (int i11 = 0; i11 < this.f2332s; i11++) { if (this.f2333t[i11].f2366a.size() == 1) { return; } } for (int i12 = 0; i12 < this.f2332s; i12++) { this.f2333t[i12].s(); } } else if (cVar.f2348e.f2366a.size() == 1) { return; } else { cVar.f2348e.s(); } m1(I, vVar); } } private void C2(RecyclerView.v vVar, int i10) { while (J() > 0) { View I = I(0); if (this.f2334u.d(I) > i10 || this.f2334u.p(I) > i10) { return; } c cVar = (c) I.getLayoutParams(); if (cVar.f2349f) { for (int i11 = 0; i11 < this.f2332s; i11++) { if (this.f2333t[i11].f2366a.size() == 1) { return; } } for (int i12 = 0; i12 < this.f2332s; i12++) { this.f2333t[i12].t(); } } else if (cVar.f2348e.f2366a.size() == 1) { return; } else { cVar.f2348e.t(); } m1(I, vVar); } } private void D2() { if (this.f2335v.k() == 1073741824) { return; } int J = J(); float f10 = 0.0f; for (int i10 = 0; i10 < J; i10++) { View I = I(i10); float e10 = this.f2335v.e(I); if (e10 >= f10) { if (((c) I.getLayoutParams()).f()) { e10 = (e10 * 1.0f) / this.f2332s; } f10 = Math.max(f10, e10); } } int i11 = this.f2337x; int round = Math.round(f10 * this.f2332s); if (this.f2335v.k() == Integer.MIN_VALUE) { round = Math.min(round, this.f2335v.n()); } P2(round); if (this.f2337x == i11) { return; } for (int i12 = 0; i12 < J; i12++) { View I2 = I(i12); c cVar = (c) I2.getLayoutParams(); if (!cVar.f2349f) { if (t2() && this.f2336w == 1) { int i13 = this.f2332s; int i14 = cVar.f2348e.f2370e; I2.offsetLeftAndRight(((-((i13 - 1) - i14)) * this.f2337x) - ((-((i13 - 1) - i14)) * i11)); } else { int i15 = cVar.f2348e.f2370e; int i16 = this.f2337x * i15; int i17 = i15 * i11; if (this.f2336w == 1) { I2.offsetLeftAndRight(i16 - i17); } else { I2.offsetTopAndBottom(i16 - i17); } } } } } private void E2() { if (this.f2336w == 1 || !t2()) { this.A = this.f2339z; } else { this.A = !this.f2339z; } } private void G2(int i10) { androidx.recyclerview.widget.f fVar = this.f2338y; fVar.f2490e = i10; fVar.f2489d = this.A != (i10 == -1) ? -1 : 1; } private void K2(int i10, int i11) { for (int i12 = 0; i12 < this.f2332s; i12++) { if (!this.f2333t[i12].f2366a.isEmpty()) { Q2(this.f2333t[i12], i10, i11); } } } private boolean L2(RecyclerView.a0 a0Var, b bVar) { bVar.f2341a = this.G ? g2(a0Var.b()) : c2(a0Var.b()); bVar.f2342b = RecyclerView.UNDEFINED_DURATION; return true; } private void M1(View view) { for (int i10 = this.f2332s - 1; i10 >= 0; i10--) { this.f2333t[i10].a(view); } } private void N1(b bVar) { e eVar = this.I; int i10 = eVar.f2358c; if (i10 > 0) { if (i10 == this.f2332s) { for (int i11 = 0; i11 < this.f2332s; i11++) { this.f2333t[i11].e(); e eVar2 = this.I; int i12 = eVar2.f2359d[i11]; if (i12 != Integer.MIN_VALUE) { i12 += eVar2.f2364i ? this.f2334u.i() : this.f2334u.m(); } this.f2333t[i11].v(i12); } } else { eVar.b(); e eVar3 = this.I; eVar3.f2356a = eVar3.f2357b; } } e eVar4 = this.I; this.H = eVar4.f2365j; I2(eVar4.f2363h); E2(); e eVar5 = this.I; int i13 = eVar5.f2356a; if (i13 != -1) { this.C = i13; bVar.f2343c = eVar5.f2364i; } else { bVar.f2343c = this.A; } if (eVar5.f2360e > 1) { d dVar = this.E; dVar.f2350a = eVar5.f2361f; dVar.f2351b = eVar5.f2362g; } } /* JADX WARN: Removed duplicated region for block: B:13:0x0036 */ /* JADX WARN: Removed duplicated region for block: B:22:0x004d */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct code enable 'Show inconsistent code' option in preferences */ private void O2(int r5, androidx.recyclerview.widget.RecyclerView.a0 r6) { /* r4 = this; androidx.recyclerview.widget.f r0 = r4.f2338y r1 = 0 r0.f2487b = r1 r0.f2488c = r5 boolean r0 = r4.x0() r2 = 1 if (r0 == 0) goto L2e int r6 = r6.c() r0 = -1 if (r6 == r0) goto L2e boolean r0 = r4.A if (r6 >= r5) goto L1b r5 = 1 goto L1c L1b: r5 = 0 L1c: if (r0 != r5) goto L25 androidx.recyclerview.widget.j r5 = r4.f2334u int r5 = r5.n() goto L2f L25: androidx.recyclerview.widget.j r5 = r4.f2334u int r5 = r5.n() r6 = r5 r5 = 0 goto L30 L2e: r5 = 0 L2f: r6 = 0 L30: boolean r0 = r4.M() if (r0 == 0) goto L4d androidx.recyclerview.widget.f r0 = r4.f2338y androidx.recyclerview.widget.j r3 = r4.f2334u int r3 = r3.m() int r3 = r3 - r6 r0.f2491f = r3 androidx.recyclerview.widget.f r6 = r4.f2338y androidx.recyclerview.widget.j r0 = r4.f2334u int r0 = r0.i() int r0 = r0 + r5 r6.f2492g = r0 goto L5d L4d: androidx.recyclerview.widget.f r0 = r4.f2338y androidx.recyclerview.widget.j r3 = r4.f2334u int r3 = r3.h() int r3 = r3 + r5 r0.f2492g = r3 androidx.recyclerview.widget.f r5 = r4.f2338y int r6 = -r6 r5.f2491f = r6 L5d: androidx.recyclerview.widget.f r5 = r4.f2338y r5.f2493h = r1 r5.f2486a = r2 androidx.recyclerview.widget.j r6 = r4.f2334u int r6 = r6.k() if (r6 != 0) goto L74 androidx.recyclerview.widget.j r6 = r4.f2334u int r6 = r6.h() if (r6 != 0) goto L74 r1 = 1 L74: r5.f2494i = r1 return */ throw new UnsupportedOperationException("Method not decompiled: androidx.recyclerview.widget.StaggeredGridLayoutManager.O2(int, androidx.recyclerview.widget.RecyclerView$a0):void"); } private void Q1(View view, c cVar, androidx.recyclerview.widget.f fVar) { if (fVar.f2490e == 1) { if (cVar.f2349f) { M1(view); return; } else { cVar.f2348e.a(view); return; } } if (cVar.f2349f) { z2(view); } else { cVar.f2348e.u(view); } } private void Q2(f fVar, int i10, int i11) { int j10 = fVar.j(); if (i10 == -1) { if (fVar.o() + j10 <= i11) { this.B.set(fVar.f2370e, false); } } else if (fVar.k() - j10 >= i11) { this.B.set(fVar.f2370e, false); } } private int R1(int i10) { if (J() == 0) { return this.A ? 1 : -1; } return (i10 < j2()) != this.A ? -1 : 1; } private int R2(int i10, int i11, int i12) { if (i11 == 0 && i12 == 0) { return i10; } int mode = View.MeasureSpec.getMode(i10); return (mode == Integer.MIN_VALUE || mode == 1073741824) ? View.MeasureSpec.makeMeasureSpec(Math.max(0, (View.MeasureSpec.getSize(i10) - i11) - i12), mode) : i10; } private boolean T1(f fVar) { if (this.A) { if (fVar.k() < this.f2334u.i()) { ArrayList arrayList = fVar.f2366a; return !fVar.n((View) arrayList.get(arrayList.size() - 1)).f2349f; } } else if (fVar.o() > this.f2334u.m()) { return !fVar.n((View) fVar.f2366a.get(0)).f2349f; } return false; } private int U1(RecyclerView.a0 a0Var) { if (J() == 0) { return 0; } return m.a(a0Var, this.f2334u, e2(!this.N), d2(!this.N), this, this.N); } private int V1(RecyclerView.a0 a0Var) { if (J() == 0) { return 0; } return m.b(a0Var, this.f2334u, e2(!this.N), d2(!this.N), this, this.N, this.A); } private int W1(RecyclerView.a0 a0Var) { if (J() == 0) { return 0; } return m.c(a0Var, this.f2334u, e2(!this.N), d2(!this.N), this, this.N); } private int X1(int i10) { if (i10 == 1) { return (this.f2336w != 1 && t2()) ? 1 : -1; } if (i10 == 2) { return (this.f2336w != 1 && t2()) ? -1 : 1; } if (i10 == 17) { if (this.f2336w == 0) { return -1; } return RecyclerView.UNDEFINED_DURATION; } if (i10 == 33) { if (this.f2336w == 1) { return -1; } return RecyclerView.UNDEFINED_DURATION; } if (i10 == 66) { if (this.f2336w == 0) { return 1; } return RecyclerView.UNDEFINED_DURATION; } if (i10 != 130) { return RecyclerView.UNDEFINED_DURATION; } if (this.f2336w == 1) { return 1; } return RecyclerView.UNDEFINED_DURATION; } private d.a Y1(int i10) { d.a aVar = new d.a(); aVar.f2354c = new int[this.f2332s]; for (int i11 = 0; i11 < this.f2332s; i11++) { aVar.f2354c[i11] = i10 - this.f2333t[i11].l(i10); } return aVar; } private d.a Z1(int i10) { d.a aVar = new d.a(); aVar.f2354c = new int[this.f2332s]; for (int i11 = 0; i11 < this.f2332s; i11++) { aVar.f2354c[i11] = this.f2333t[i11].p(i10) - i10; } return aVar; } private void a2() { this.f2334u = j.b(this, this.f2336w); this.f2335v = j.b(this, 1 - this.f2336w); } /* JADX WARN: Multi-variable type inference failed */ /* JADX WARN: Type inference failed for: r9v0 */ /* JADX WARN: Type inference failed for: r9v1, types: [boolean, int] */ /* JADX WARN: Type inference failed for: r9v7 */ private int b2(RecyclerView.v vVar, androidx.recyclerview.widget.f fVar, RecyclerView.a0 a0Var) { int i10; f fVar2; int e10; int i11; int i12; int e11; ?? r92 = 0; this.B.set(0, this.f2332s, true); if (this.f2338y.f2494i) { i10 = fVar.f2490e == 1 ? Api.BaseClientBuilder.API_PRIORITY_OTHER : RecyclerView.UNDEFINED_DURATION; } else { i10 = fVar.f2490e == 1 ? fVar.f2492g + fVar.f2487b : fVar.f2491f - fVar.f2487b; } K2(fVar.f2490e, i10); int i13 = this.A ? this.f2334u.i() : this.f2334u.m(); boolean z10 = false; while (fVar.a(a0Var) && (this.f2338y.f2494i || !this.B.isEmpty())) { View b10 = fVar.b(vVar); c cVar = (c) b10.getLayoutParams(); int a10 = cVar.a(); int g10 = this.E.g(a10); boolean z11 = g10 == -1; if (z11) { fVar2 = cVar.f2349f ? this.f2333t[r92] : p2(fVar); this.E.n(a10, fVar2); } else { fVar2 = this.f2333t[g10]; } f fVar3 = fVar2; cVar.f2348e = fVar3; if (fVar.f2490e == 1) { d(b10); } else { e(b10, r92); } v2(b10, cVar, r92); if (fVar.f2490e == 1) { int l22 = cVar.f2349f ? l2(i13) : fVar3.l(i13); int e12 = this.f2334u.e(b10) + l22; if (z11 && cVar.f2349f) { d.a Y1 = Y1(l22); Y1.f2353b = -1; Y1.f2352a = a10; this.E.a(Y1); } i11 = e12; e10 = l22; } else { int o22 = cVar.f2349f ? o2(i13) : fVar3.p(i13); e10 = o22 - this.f2334u.e(b10); if (z11 && cVar.f2349f) { d.a Z1 = Z1(o22); Z1.f2353b = 1; Z1.f2352a = a10; this.E.a(Z1); } i11 = o22; } if (cVar.f2349f && fVar.f2489d == -1) { if (z11) { this.M = true; } else { if (!(fVar.f2490e == 1 ? O1() : P1())) { d.a f10 = this.E.f(a10); if (f10 != null) { f10.f2355d = true; } this.M = true; } } } Q1(b10, cVar, fVar); if (t2() && this.f2336w == 1) { int i14 = cVar.f2349f ? this.f2335v.i() : this.f2335v.i() - (((this.f2332s - 1) - fVar3.f2370e) * this.f2337x); e11 = i14; i12 = i14 - this.f2335v.e(b10); } else { int m10 = cVar.f2349f ? this.f2335v.m() : (fVar3.f2370e * this.f2337x) + this.f2335v.m(); i12 = m10; e11 = this.f2335v.e(b10) + m10; } if (this.f2336w == 1) { z0(b10, i12, e10, e11, i11); } else { z0(b10, e10, i12, i11, e11); } if (cVar.f2349f) { K2(this.f2338y.f2490e, i10); } else { Q2(fVar3, this.f2338y.f2490e, i10); } A2(vVar, this.f2338y); if (this.f2338y.f2493h && b10.hasFocusable()) { if (cVar.f2349f) { this.B.clear(); } else { this.B.set(fVar3.f2370e, false); z10 = true; r92 = 0; } } z10 = true; r92 = 0; } if (!z10) { A2(vVar, this.f2338y); } int m11 = this.f2338y.f2490e == -1 ? this.f2334u.m() - o2(this.f2334u.m()) : l2(this.f2334u.i()) - this.f2334u.i(); if (m11 > 0) { return Math.min(fVar.f2487b, m11); } return 0; } private int c2(int i10) { int J = J(); for (int i11 = 0; i11 < J; i11++) { int h02 = h0(I(i11)); if (h02 >= 0 && h02 < i10) { return h02; } } return 0; } private int g2(int i10) { for (int J = J() - 1; J >= 0; J--) { int h02 = h0(I(J)); if (h02 >= 0 && h02 < i10) { return h02; } } return 0; } private void h2(RecyclerView.v vVar, RecyclerView.a0 a0Var, boolean z10) { int i10; int l22 = l2(RecyclerView.UNDEFINED_DURATION); if (l22 != Integer.MIN_VALUE && (i10 = this.f2334u.i() - l22) > 0) { int i11 = i10 - (-F2(-i10, vVar, a0Var)); if (!z10 || i11 <= 0) { return; } this.f2334u.r(i11); } } private void i2(RecyclerView.v vVar, RecyclerView.a0 a0Var, boolean z10) { int m10; int o22 = o2(Api.BaseClientBuilder.API_PRIORITY_OTHER); if (o22 != Integer.MAX_VALUE && (m10 = o22 - this.f2334u.m()) > 0) { int F2 = m10 - F2(m10, vVar, a0Var); if (!z10 || F2 <= 0) { return; } this.f2334u.r(-F2); } } private int l2(int i10) { int l10 = this.f2333t[0].l(i10); for (int i11 = 1; i11 < this.f2332s; i11++) { int l11 = this.f2333t[i11].l(i10); if (l11 > l10) { l10 = l11; } } return l10; } private int m2(int i10) { int p10 = this.f2333t[0].p(i10); for (int i11 = 1; i11 < this.f2332s; i11++) { int p11 = this.f2333t[i11].p(i10); if (p11 > p10) { p10 = p11; } } return p10; } private int n2(int i10) { int l10 = this.f2333t[0].l(i10); for (int i11 = 1; i11 < this.f2332s; i11++) { int l11 = this.f2333t[i11].l(i10); if (l11 < l10) { l10 = l11; } } return l10; } private int o2(int i10) { int p10 = this.f2333t[0].p(i10); for (int i11 = 1; i11 < this.f2332s; i11++) { int p11 = this.f2333t[i11].p(i10); if (p11 < p10) { p10 = p11; } } return p10; } private f p2(androidx.recyclerview.widget.f fVar) { int i10; int i11; int i12; if (x2(fVar.f2490e)) { i11 = this.f2332s - 1; i10 = -1; i12 = -1; } else { i10 = this.f2332s; i11 = 0; i12 = 1; } f fVar2 = null; if (fVar.f2490e == 1) { int m10 = this.f2334u.m(); int i13 = Api.BaseClientBuilder.API_PRIORITY_OTHER; while (i11 != i10) { f fVar3 = this.f2333t[i11]; int l10 = fVar3.l(m10); if (l10 < i13) { fVar2 = fVar3; i13 = l10; } i11 += i12; } return fVar2; } int i14 = this.f2334u.i(); int i15 = RecyclerView.UNDEFINED_DURATION; while (i11 != i10) { f fVar4 = this.f2333t[i11]; int p10 = fVar4.p(i14); if (p10 > i15) { fVar2 = fVar4; i15 = p10; } i11 += i12; } return fVar2; } /* JADX WARN: Removed duplicated region for block: B:11:0x0025 */ /* JADX WARN: Removed duplicated region for block: B:16:0x0043 A[RETURN] */ /* JADX WARN: Removed duplicated region for block: B:18:0x0044 */ /* JADX WARN: Removed duplicated region for block: B:27:0x003c */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct code enable 'Show inconsistent code' option in preferences */ private void q2(int r7, int r8, int r9) { /* r6 = this; boolean r0 = r6.A if (r0 == 0) goto L9 int r0 = r6.k2() goto Ld L9: int r0 = r6.j2() Ld: r1 = 8 if (r9 != r1) goto L1a if (r7 >= r8) goto L16 int r2 = r8 + 1 goto L1c L16: int r2 = r7 + 1 r3 = r8 goto L1d L1a: int r2 = r7 + r8 L1c: r3 = r7 L1d: androidx.recyclerview.widget.StaggeredGridLayoutManager$d r4 = r6.E r4.h(r3) r4 = 1 if (r9 == r4) goto L3c r5 = 2 if (r9 == r5) goto L36 if (r9 == r1) goto L2b goto L41 L2b: androidx.recyclerview.widget.StaggeredGridLayoutManager$d r9 = r6.E r9.k(r7, r4) androidx.recyclerview.widget.StaggeredGridLayoutManager$d r7 = r6.E r7.j(r8, r4) goto L41 L36: androidx.recyclerview.widget.StaggeredGridLayoutManager$d r9 = r6.E r9.k(r7, r8) goto L41 L3c: androidx.recyclerview.widget.StaggeredGridLayoutManager$d r9 = r6.E r9.j(r7, r8) L41: if (r2 > r0) goto L44 return L44: boolean r7 = r6.A if (r7 == 0) goto L4d int r7 = r6.j2() goto L51 L4d: int r7 = r6.k2() L51: if (r3 > r7) goto L56 r6.t1() L56: return */ throw new UnsupportedOperationException("Method not decompiled: androidx.recyclerview.widget.StaggeredGridLayoutManager.q2(int, int, int):void"); } private void u2(View view, int i10, int i11, boolean z10) { j(view, this.K); c cVar = (c) view.getLayoutParams(); int i12 = ((ViewGroup.MarginLayoutParams) cVar).leftMargin; Rect rect = this.K; int R2 = R2(i10, i12 + rect.left, ((ViewGroup.MarginLayoutParams) cVar).rightMargin + rect.right); int i13 = ((ViewGroup.MarginLayoutParams) cVar).topMargin; Rect rect2 = this.K; int R22 = R2(i11, i13 + rect2.top, ((ViewGroup.MarginLayoutParams) cVar).bottomMargin + rect2.bottom); if (z10 ? H1(view, R2, R22, cVar) : F1(view, R2, R22, cVar)) { view.measure(R2, R22); } } private void v2(View view, c cVar, boolean z10) { if (cVar.f2349f) { if (this.f2336w == 1) { u2(view, this.J, RecyclerView.o.K(W(), X(), g0() + d0(), ((ViewGroup.MarginLayoutParams) cVar).height, true), z10); return; } else { u2(view, RecyclerView.o.K(o0(), p0(), e0() + f0(), ((ViewGroup.MarginLayoutParams) cVar).width, true), this.J, z10); return; } } if (this.f2336w == 1) { u2(view, RecyclerView.o.K(this.f2337x, p0(), 0, ((ViewGroup.MarginLayoutParams) cVar).width, false), RecyclerView.o.K(W(), X(), g0() + d0(), ((ViewGroup.MarginLayoutParams) cVar).height, true), z10); } else { u2(view, RecyclerView.o.K(o0(), p0(), e0() + f0(), ((ViewGroup.MarginLayoutParams) cVar).width, true), RecyclerView.o.K(this.f2337x, X(), 0, ((ViewGroup.MarginLayoutParams) cVar).height, false), z10); } } /* JADX WARN: Code restructure failed: missing block: B:82:0x0157, code lost: if (S1() != false) goto L90; */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct code enable 'Show inconsistent code' option in preferences */ private void w2(androidx.recyclerview.widget.RecyclerView.v r9, androidx.recyclerview.widget.RecyclerView.a0 r10, boolean r11) { /* Method dump skipped, instructions count: 379 To view this dump change 'Code comments level' option to 'DEBUG' */ throw new UnsupportedOperationException("Method not decompiled: androidx.recyclerview.widget.StaggeredGridLayoutManager.w2(androidx.recyclerview.widget.RecyclerView$v, androidx.recyclerview.widget.RecyclerView$a0, boolean):void"); } private boolean x2(int i10) { if (this.f2336w == 0) { return (i10 == -1) != this.A; } return ((i10 == -1) == this.A) == t2(); } private void z2(View view) { for (int i10 = this.f2332s - 1; i10 >= 0; i10--) { this.f2333t[i10].u(view); } } @Override // androidx.recyclerview.widget.RecyclerView.o public void C0(int i10) { super.C0(i10); for (int i11 = 0; i11 < this.f2332s; i11++) { this.f2333t[i11].r(i10); } } @Override // androidx.recyclerview.widget.RecyclerView.o public void C1(Rect rect, int i10, int i11) { int n10; int n11; int e02 = e0() + f0(); int g02 = g0() + d0(); if (this.f2336w == 1) { n11 = RecyclerView.o.n(i11, rect.height() + g02, b0()); n10 = RecyclerView.o.n(i10, (this.f2337x * this.f2332s) + e02, c0()); } else { n10 = RecyclerView.o.n(i10, rect.width() + e02, c0()); n11 = RecyclerView.o.n(i11, (this.f2337x * this.f2332s) + g02, b0()); } B1(n10, n11); } @Override // androidx.recyclerview.widget.RecyclerView.o public RecyclerView.p D() { return this.f2336w == 0 ? new c(-2, -1) : new c(-1, -2); } @Override // androidx.recyclerview.widget.RecyclerView.o public void D0(int i10) { super.D0(i10); for (int i11 = 0; i11 < this.f2332s; i11++) { this.f2333t[i11].r(i10); } } @Override // androidx.recyclerview.widget.RecyclerView.o public RecyclerView.p E(Context context, AttributeSet attributeSet) { return new c(context, attributeSet); } @Override // androidx.recyclerview.widget.RecyclerView.o public RecyclerView.p F(ViewGroup.LayoutParams layoutParams) { return layoutParams instanceof ViewGroup.MarginLayoutParams ? new c((ViewGroup.MarginLayoutParams) layoutParams) : new c(layoutParams); } int F2(int i10, RecyclerView.v vVar, RecyclerView.a0 a0Var) { if (J() == 0 || i10 == 0) { return 0; } y2(i10, a0Var); int b22 = b2(vVar, this.f2338y, a0Var); if (this.f2338y.f2487b >= b22) { i10 = i10 < 0 ? -b22 : b22; } this.f2334u.r(-i10); this.G = this.A; androidx.recyclerview.widget.f fVar = this.f2338y; fVar.f2487b = 0; A2(vVar, fVar); return i10; } public void H2(int i10) { if (i10 != 0 && i10 != 1) { throw new IllegalArgumentException("invalid orientation."); } g(null); if (i10 == this.f2336w) { return; } this.f2336w = i10; j jVar = this.f2334u; this.f2334u = this.f2335v; this.f2335v = jVar; t1(); } @Override // androidx.recyclerview.widget.RecyclerView.o public void I0(RecyclerView recyclerView, RecyclerView.v vVar) { super.I0(recyclerView, vVar); o1(this.P); for (int i10 = 0; i10 < this.f2332s; i10++) { this.f2333t[i10].e(); } recyclerView.requestLayout(); } @Override // androidx.recyclerview.widget.RecyclerView.o public void I1(RecyclerView recyclerView, RecyclerView.a0 a0Var, int i10) { g gVar = new g(recyclerView.getContext()); gVar.p(i10); J1(gVar); } public void I2(boolean z10) { g(null); e eVar = this.I; if (eVar != null && eVar.f2363h != z10) { eVar.f2363h = z10; } this.f2339z = z10; t1(); } @Override // androidx.recyclerview.widget.RecyclerView.o public View J0(View view, int i10, RecyclerView.v vVar, RecyclerView.a0 a0Var) { View B; View m10; if (J() == 0 || (B = B(view)) == null) { return null; } E2(); int X1 = X1(i10); if (X1 == Integer.MIN_VALUE) { return null; } c cVar = (c) B.getLayoutParams(); boolean z10 = cVar.f2349f; f fVar = cVar.f2348e; int k22 = X1 == 1 ? k2() : j2(); O2(k22, a0Var); G2(X1); androidx.recyclerview.widget.f fVar2 = this.f2338y; fVar2.f2488c = fVar2.f2489d + k22; fVar2.f2487b = (int) (this.f2334u.n() * 0.33333334f); androidx.recyclerview.widget.f fVar3 = this.f2338y; fVar3.f2493h = true; fVar3.f2486a = false; b2(vVar, fVar3, a0Var); this.G = this.A; if (!z10 && (m10 = fVar.m(k22, X1)) != null && m10 != B) { return m10; } if (x2(X1)) { for (int i11 = this.f2332s - 1; i11 >= 0; i11--) { View m11 = this.f2333t[i11].m(k22, X1); if (m11 != null && m11 != B) { return m11; } } } else { for (int i12 = 0; i12 < this.f2332s; i12++) { View m12 = this.f2333t[i12].m(k22, X1); if (m12 != null && m12 != B) { return m12; } } } boolean z11 = (this.f2339z ^ true) == (X1 == -1); if (!z10) { View C = C(z11 ? fVar.f() : fVar.g()); if (C != null && C != B) { return C; } } if (x2(X1)) { for (int i13 = this.f2332s - 1; i13 >= 0; i13--) { if (i13 != fVar.f2370e) { View C2 = C(z11 ? this.f2333t[i13].f() : this.f2333t[i13].g()); if (C2 != null && C2 != B) { return C2; } } } } else { for (int i14 = 0; i14 < this.f2332s; i14++) { View C3 = C(z11 ? this.f2333t[i14].f() : this.f2333t[i14].g()); if (C3 != null && C3 != B) { return C3; } } } return null; } public void J2(int i10) { g(null); if (i10 != this.f2332s) { s2(); this.f2332s = i10; this.B = new BitSet(this.f2332s); this.f2333t = new f[this.f2332s]; for (int i11 = 0; i11 < this.f2332s; i11++) { this.f2333t[i11] = new f(i11); } t1(); } } @Override // androidx.recyclerview.widget.RecyclerView.o public void K0(AccessibilityEvent accessibilityEvent) { super.K0(accessibilityEvent); if (J() > 0) { View e22 = e2(false); View d22 = d2(false); if (e22 == null || d22 == null) { return; } int h02 = h0(e22); int h03 = h0(d22); if (h02 < h03) { accessibilityEvent.setFromIndex(h02); accessibilityEvent.setToIndex(h03); } else { accessibilityEvent.setFromIndex(h03); accessibilityEvent.setToIndex(h02); } } } @Override // androidx.recyclerview.widget.RecyclerView.o public boolean L1() { return this.I == null; } boolean M2(RecyclerView.a0 a0Var, b bVar) { int i10; if (!a0Var.e() && (i10 = this.C) != -1) { if (i10 >= 0 && i10 < a0Var.b()) { e eVar = this.I; if (eVar == null || eVar.f2356a == -1 || eVar.f2358c < 1) { View C = C(this.C); if (C != null) { bVar.f2341a = this.A ? k2() : j2(); if (this.D != Integer.MIN_VALUE) { if (bVar.f2343c) { bVar.f2342b = (this.f2334u.i() - this.D) - this.f2334u.d(C); } else { bVar.f2342b = (this.f2334u.m() + this.D) - this.f2334u.g(C); } return true; } if (this.f2334u.e(C) > this.f2334u.n()) { bVar.f2342b = bVar.f2343c ? this.f2334u.i() : this.f2334u.m(); return true; } int g10 = this.f2334u.g(C) - this.f2334u.m(); if (g10 < 0) { bVar.f2342b = -g10; return true; } int i11 = this.f2334u.i() - this.f2334u.d(C); if (i11 < 0) { bVar.f2342b = i11; return true; } bVar.f2342b = RecyclerView.UNDEFINED_DURATION; } else { int i12 = this.C; bVar.f2341a = i12; int i13 = this.D; if (i13 == Integer.MIN_VALUE) { bVar.f2343c = R1(i12) == 1; bVar.a(); } else { bVar.b(i13); } bVar.f2344d = true; } } else { bVar.f2342b = RecyclerView.UNDEFINED_DURATION; bVar.f2341a = this.C; } return true; } this.C = -1; this.D = RecyclerView.UNDEFINED_DURATION; } return false; } @Override // androidx.recyclerview.widget.RecyclerView.o public int N(RecyclerView.v vVar, RecyclerView.a0 a0Var) { return this.f2336w == 1 ? this.f2332s : super.N(vVar, a0Var); } void N2(RecyclerView.a0 a0Var, b bVar) { if (M2(a0Var, bVar) || L2(a0Var, bVar)) { return; } bVar.a(); bVar.f2341a = 0; } boolean O1() { int l10 = this.f2333t[0].l(RecyclerView.UNDEFINED_DURATION); for (int i10 = 1; i10 < this.f2332s; i10++) { if (this.f2333t[i10].l(RecyclerView.UNDEFINED_DURATION) != l10) { return false; } } return true; } @Override // androidx.recyclerview.widget.RecyclerView.o public void P0(RecyclerView.v vVar, RecyclerView.a0 a0Var, View view, a0 a0Var2) { ViewGroup.LayoutParams layoutParams = view.getLayoutParams(); if (!(layoutParams instanceof c)) { super.O0(view, a0Var2); return; } c cVar = (c) layoutParams; if (this.f2336w == 0) { a0Var2.Z(a0.c.a(cVar.e(), cVar.f2349f ? this.f2332s : 1, -1, -1, false, false)); } else { a0Var2.Z(a0.c.a(-1, -1, cVar.e(), cVar.f2349f ? this.f2332s : 1, false, false)); } } boolean P1() { int p10 = this.f2333t[0].p(RecyclerView.UNDEFINED_DURATION); for (int i10 = 1; i10 < this.f2332s; i10++) { if (this.f2333t[i10].p(RecyclerView.UNDEFINED_DURATION) != p10) { return false; } } return true; } void P2(int i10) { this.f2337x = i10 / this.f2332s; this.J = View.MeasureSpec.makeMeasureSpec(i10, this.f2335v.k()); } @Override // androidx.recyclerview.widget.RecyclerView.o public void R0(RecyclerView recyclerView, int i10, int i11) { q2(i10, i11, 1); } @Override // androidx.recyclerview.widget.RecyclerView.o public void S0(RecyclerView recyclerView) { this.E.b(); t1(); } boolean S1() { int j22; int k22; if (J() == 0 || this.F == 0 || !r0()) { return false; } if (this.A) { j22 = k2(); k22 = j2(); } else { j22 = j2(); k22 = k2(); } if (j22 == 0 && r2() != null) { this.E.b(); u1(); t1(); return true; } if (!this.M) { return false; } int i10 = this.A ? -1 : 1; int i11 = k22 + 1; d.a e10 = this.E.e(j22, i11, i10, true); if (e10 == null) { this.M = false; this.E.d(i11); return false; } d.a e11 = this.E.e(j22, e10.f2352a, i10 * (-1), true); if (e11 == null) { this.E.d(e10.f2352a); } else { this.E.d(e11.f2352a + 1); } u1(); t1(); return true; } @Override // androidx.recyclerview.widget.RecyclerView.o public void T0(RecyclerView recyclerView, int i10, int i11, int i12) { q2(i10, i11, 8); } @Override // androidx.recyclerview.widget.RecyclerView.o public void U0(RecyclerView recyclerView, int i10, int i11) { q2(i10, i11, 2); } @Override // androidx.recyclerview.widget.RecyclerView.o public void W0(RecyclerView recyclerView, int i10, int i11, Object obj) { q2(i10, i11, 4); } @Override // androidx.recyclerview.widget.RecyclerView.o public void X0(RecyclerView.v vVar, RecyclerView.a0 a0Var) { w2(vVar, a0Var, true); } @Override // androidx.recyclerview.widget.RecyclerView.o public void Y0(RecyclerView.a0 a0Var) { super.Y0(a0Var); this.C = -1; this.D = RecyclerView.UNDEFINED_DURATION; this.I = null; this.L.c(); } @Override // androidx.recyclerview.widget.RecyclerView.z.b public PointF a(int i10) { int R1 = R1(i10); PointF pointF = new PointF(); if (R1 == 0) { return null; } if (this.f2336w == 0) { pointF.x = R1; pointF.y = 0.0f; } else { pointF.x = 0.0f; pointF.y = R1; } return pointF; } @Override // androidx.recyclerview.widget.RecyclerView.o public void c1(Parcelable parcelable) { if (parcelable instanceof e) { this.I = (e) parcelable; t1(); } } @Override // androidx.recyclerview.widget.RecyclerView.o public Parcelable d1() { int p10; int m10; int[] iArr; if (this.I != null) { return new e(this.I); } e eVar = new e(); eVar.f2363h = this.f2339z; eVar.f2364i = this.G; eVar.f2365j = this.H; d dVar = this.E; if (dVar == null || (iArr = dVar.f2350a) == null) { eVar.f2360e = 0; } else { eVar.f2361f = iArr; eVar.f2360e = iArr.length; eVar.f2362g = dVar.f2351b; } if (J() > 0) { eVar.f2356a = this.G ? k2() : j2(); eVar.f2357b = f2(); int i10 = this.f2332s; eVar.f2358c = i10; eVar.f2359d = new int[i10]; for (int i11 = 0; i11 < this.f2332s; i11++) { if (this.G) { p10 = this.f2333t[i11].l(RecyclerView.UNDEFINED_DURATION); if (p10 != Integer.MIN_VALUE) { m10 = this.f2334u.i(); p10 -= m10; eVar.f2359d[i11] = p10; } else { eVar.f2359d[i11] = p10; } } else { p10 = this.f2333t[i11].p(RecyclerView.UNDEFINED_DURATION); if (p10 != Integer.MIN_VALUE) { m10 = this.f2334u.m(); p10 -= m10; eVar.f2359d[i11] = p10; } else { eVar.f2359d[i11] = p10; } } } } else { eVar.f2356a = -1; eVar.f2357b = -1; eVar.f2358c = 0; } return eVar; } View d2(boolean z10) { int m10 = this.f2334u.m(); int i10 = this.f2334u.i(); View view = null; for (int J = J() - 1; J >= 0; J--) { View I = I(J); int g10 = this.f2334u.g(I); int d10 = this.f2334u.d(I); if (d10 > m10 && g10 < i10) { if (d10 <= i10 || !z10) { return I; } if (view == null) { view = I; } } } return view; } @Override // androidx.recyclerview.widget.RecyclerView.o public void e1(int i10) { if (i10 == 0) { S1(); } } View e2(boolean z10) { int m10 = this.f2334u.m(); int i10 = this.f2334u.i(); int J = J(); View view = null; for (int i11 = 0; i11 < J; i11++) { View I = I(i11); int g10 = this.f2334u.g(I); if (this.f2334u.d(I) > m10 && g10 < i10) { if (g10 >= m10 || !z10) { return I; } if (view == null) { view = I; } } } return view; } int f2() { View d22 = this.A ? d2(true) : e2(true); if (d22 == null) { return -1; } return h0(d22); } @Override // androidx.recyclerview.widget.RecyclerView.o public void g(String str) { if (this.I == null) { super.g(str); } } int j2() { if (J() == 0) { return 0; } return h0(I(0)); } @Override // androidx.recyclerview.widget.RecyclerView.o public boolean k() { return this.f2336w == 0; } @Override // androidx.recyclerview.widget.RecyclerView.o public int k0(RecyclerView.v vVar, RecyclerView.a0 a0Var) { return this.f2336w == 0 ? this.f2332s : super.k0(vVar, a0Var); } int k2() { int J = J(); if (J == 0) { return 0; } return h0(I(J - 1)); } @Override // androidx.recyclerview.widget.RecyclerView.o public boolean l() { return this.f2336w == 1; } @Override // androidx.recyclerview.widget.RecyclerView.o public boolean m(RecyclerView.p pVar) { return pVar instanceof c; } @Override // androidx.recyclerview.widget.RecyclerView.o public void o(int i10, int i11, RecyclerView.a0 a0Var, RecyclerView.o.c cVar) { int l10; int i12; if (this.f2336w != 0) { i10 = i11; } if (J() == 0 || i10 == 0) { return; } y2(i10, a0Var); int[] iArr = this.O; if (iArr == null || iArr.length < this.f2332s) { this.O = new int[this.f2332s]; } int i13 = 0; for (int i14 = 0; i14 < this.f2332s; i14++) { androidx.recyclerview.widget.f fVar = this.f2338y; if (fVar.f2489d == -1) { l10 = fVar.f2491f; i12 = this.f2333t[i14].p(l10); } else { l10 = this.f2333t[i14].l(fVar.f2492g); i12 = this.f2338y.f2492g; } int i15 = l10 - i12; if (i15 >= 0) { this.O[i13] = i15; i13++; } } Arrays.sort(this.O, 0, i13); for (int i16 = 0; i16 < i13 && this.f2338y.a(a0Var); i16++) { cVar.a(this.f2338y.f2488c, this.O[i16]); androidx.recyclerview.widget.f fVar2 = this.f2338y; fVar2.f2488c += fVar2.f2489d; } } @Override // androidx.recyclerview.widget.RecyclerView.o public int q(RecyclerView.a0 a0Var) { return U1(a0Var); } @Override // androidx.recyclerview.widget.RecyclerView.o public int r(RecyclerView.a0 a0Var) { return V1(a0Var); } /* JADX WARN: Code restructure failed: missing block: B:29:0x0074, code lost: if (r10 == r11) goto L37; */ /* JADX WARN: Code restructure failed: missing block: B:30:0x008a, code lost: r10 = false; */ /* JADX WARN: Code restructure failed: missing block: B:45:0x0088, code lost: r10 = true; */ /* JADX WARN: Code restructure failed: missing block: B:50:0x0086, code lost: if (r10 == r11) goto L37; */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct code enable 'Show inconsistent code' option in preferences */ android.view.View r2() { /* r12 = this; int r0 = r12.J() r1 = 1 int r0 = r0 - r1 java.util.BitSet r2 = new java.util.BitSet int r3 = r12.f2332s r2.(r3) int r3 = r12.f2332s r4 = 0 r2.set(r4, r3, r1) int r3 = r12.f2336w r5 = -1 if (r3 != r1) goto L20 boolean r3 = r12.t2() if (r3 == 0) goto L20 r3 = 1 goto L21 L20: r3 = -1 L21: boolean r6 = r12.A if (r6 == 0) goto L27 r6 = -1 goto L2b L27: int r0 = r0 + 1 r6 = r0 r0 = 0 L2b: if (r0 >= r6) goto L2e r5 = 1 L2e: if (r0 == r6) goto Lab android.view.View r7 = r12.I(r0) android.view.ViewGroup$LayoutParams r8 = r7.getLayoutParams() androidx.recyclerview.widget.StaggeredGridLayoutManager$c r8 = (androidx.recyclerview.widget.StaggeredGridLayoutManager.c) r8 androidx.recyclerview.widget.StaggeredGridLayoutManager$f r9 = r8.f2348e int r9 = r9.f2370e boolean r9 = r2.get(r9) if (r9 == 0) goto L54 androidx.recyclerview.widget.StaggeredGridLayoutManager$f r9 = r8.f2348e boolean r9 = r12.T1(r9) if (r9 == 0) goto L4d return r7 L4d: androidx.recyclerview.widget.StaggeredGridLayoutManager$f r9 = r8.f2348e int r9 = r9.f2370e r2.clear(r9) L54: boolean r9 = r8.f2349f if (r9 == 0) goto L59 goto La9 L59: int r9 = r0 + r5 if (r9 == r6) goto La9 android.view.View r9 = r12.I(r9) boolean r10 = r12.A if (r10 == 0) goto L77 androidx.recyclerview.widget.j r10 = r12.f2334u int r10 = r10.d(r7) androidx.recyclerview.widget.j r11 = r12.f2334u int r11 = r11.d(r9) if (r10 >= r11) goto L74 return r7 L74: if (r10 != r11) goto L8a goto L88 L77: androidx.recyclerview.widget.j r10 = r12.f2334u int r10 = r10.g(r7) androidx.recyclerview.widget.j r11 = r12.f2334u int r11 = r11.g(r9) if (r10 <= r11) goto L86 return r7 L86: if (r10 != r11) goto L8a L88: r10 = 1 goto L8b L8a: r10 = 0 L8b: if (r10 == 0) goto La9 android.view.ViewGroup$LayoutParams r9 = r9.getLayoutParams() androidx.recyclerview.widget.StaggeredGridLayoutManager$c r9 = (androidx.recyclerview.widget.StaggeredGridLayoutManager.c) r9 androidx.recyclerview.widget.StaggeredGridLayoutManager$f r8 = r8.f2348e int r8 = r8.f2370e androidx.recyclerview.widget.StaggeredGridLayoutManager$f r9 = r9.f2348e int r9 = r9.f2370e int r8 = r8 - r9 if (r8 >= 0) goto La0 r8 = 1 goto La1 La0: r8 = 0 La1: if (r3 >= 0) goto La5 r9 = 1 goto La6 La5: r9 = 0 La6: if (r8 == r9) goto La9 return r7 La9: int r0 = r0 + r5 goto L2e Lab: r0 = 0 return r0 */ throw new UnsupportedOperationException("Method not decompiled: androidx.recyclerview.widget.StaggeredGridLayoutManager.r2():android.view.View"); } @Override // androidx.recyclerview.widget.RecyclerView.o public int s(RecyclerView.a0 a0Var) { return W1(a0Var); } @Override // androidx.recyclerview.widget.RecyclerView.o public boolean s0() { return this.F != 0; } public void s2() { this.E.b(); t1(); } @Override // androidx.recyclerview.widget.RecyclerView.o public int t(RecyclerView.a0 a0Var) { return U1(a0Var); } boolean t2() { return Z() == 1; } @Override // androidx.recyclerview.widget.RecyclerView.o public int u(RecyclerView.a0 a0Var) { return V1(a0Var); } @Override // androidx.recyclerview.widget.RecyclerView.o public int v(RecyclerView.a0 a0Var) { return W1(a0Var); } @Override // androidx.recyclerview.widget.RecyclerView.o public int w1(int i10, RecyclerView.v vVar, RecyclerView.a0 a0Var) { return F2(i10, vVar, a0Var); } @Override // androidx.recyclerview.widget.RecyclerView.o public void x1(int i10) { e eVar = this.I; if (eVar != null && eVar.f2356a != i10) { eVar.a(); } this.C = i10; this.D = RecyclerView.UNDEFINED_DURATION; t1(); } @Override // androidx.recyclerview.widget.RecyclerView.o public int y1(int i10, RecyclerView.v vVar, RecyclerView.a0 a0Var) { return F2(i10, vVar, a0Var); } void y2(int i10, RecyclerView.a0 a0Var) { int j22; int i11; if (i10 > 0) { j22 = k2(); i11 = 1; } else { j22 = j2(); i11 = -1; } this.f2338y.f2486a = true; O2(j22, a0Var); G2(i11); androidx.recyclerview.widget.f fVar = this.f2338y; fVar.f2488c = j22 + fVar.f2489d; fVar.f2487b = Math.abs(i10); } static class d { /* renamed from: a, reason: collision with root package name */ int[] f2350a; /* renamed from: b, reason: collision with root package name */ List f2351b; d() { } private int i(int i10) { if (this.f2351b == null) { return -1; } a f10 = f(i10); if (f10 != null) { this.f2351b.remove(f10); } int size = this.f2351b.size(); int i11 = 0; while (true) { if (i11 >= size) { i11 = -1; break; } if (((a) this.f2351b.get(i11)).f2352a >= i10) { break; } i11++; } if (i11 == -1) { return -1; } a aVar = (a) this.f2351b.get(i11); this.f2351b.remove(i11); return aVar.f2352a; } private void l(int i10, int i11) { List list = this.f2351b; if (list == null) { return; } for (int size = list.size() - 1; size >= 0; size--) { a aVar = (a) this.f2351b.get(size); int i12 = aVar.f2352a; if (i12 >= i10) { aVar.f2352a = i12 + i11; } } } private void m(int i10, int i11) { List list = this.f2351b; if (list == null) { return; } int i12 = i10 + i11; for (int size = list.size() - 1; size >= 0; size--) { a aVar = (a) this.f2351b.get(size); int i13 = aVar.f2352a; if (i13 >= i10) { if (i13 < i12) { this.f2351b.remove(size); } else { aVar.f2352a = i13 - i11; } } } } public void a(a aVar) { if (this.f2351b == null) { this.f2351b = new ArrayList(); } int size = this.f2351b.size(); for (int i10 = 0; i10 < size; i10++) { a aVar2 = (a) this.f2351b.get(i10); if (aVar2.f2352a == aVar.f2352a) { this.f2351b.remove(i10); } if (aVar2.f2352a >= aVar.f2352a) { this.f2351b.add(i10, aVar); return; } } this.f2351b.add(aVar); } void b() { int[] iArr = this.f2350a; if (iArr != null) { Arrays.fill(iArr, -1); } this.f2351b = null; } void c(int i10) { int[] iArr = this.f2350a; if (iArr == null) { int[] iArr2 = new int[Math.max(i10, 10) + 1]; this.f2350a = iArr2; Arrays.fill(iArr2, -1); } else if (i10 >= iArr.length) { int[] iArr3 = new int[o(i10)]; this.f2350a = iArr3; System.arraycopy(iArr, 0, iArr3, 0, iArr.length); int[] iArr4 = this.f2350a; Arrays.fill(iArr4, iArr.length, iArr4.length, -1); } } int d(int i10) { List list = this.f2351b; if (list != null) { for (int size = list.size() - 1; size >= 0; size--) { if (((a) this.f2351b.get(size)).f2352a >= i10) { this.f2351b.remove(size); } } } return h(i10); } public a e(int i10, int i11, int i12, boolean z10) { List list = this.f2351b; if (list == null) { return null; } int size = list.size(); for (int i13 = 0; i13 < size; i13++) { a aVar = (a) this.f2351b.get(i13); int i14 = aVar.f2352a; if (i14 >= i11) { return null; } if (i14 >= i10 && (i12 == 0 || aVar.f2353b == i12 || (z10 && aVar.f2355d))) { return aVar; } } return null; } public a f(int i10) { List list = this.f2351b; if (list == null) { return null; } for (int size = list.size() - 1; size >= 0; size--) { a aVar = (a) this.f2351b.get(size); if (aVar.f2352a == i10) { return aVar; } } return null; } int g(int i10) { int[] iArr = this.f2350a; if (iArr == null || i10 >= iArr.length) { return -1; } return iArr[i10]; } int h(int i10) { int[] iArr = this.f2350a; if (iArr == null || i10 >= iArr.length) { return -1; } int i11 = i(i10); if (i11 == -1) { int[] iArr2 = this.f2350a; Arrays.fill(iArr2, i10, iArr2.length, -1); return this.f2350a.length; } int i12 = i11 + 1; Arrays.fill(this.f2350a, i10, i12, -1); return i12; } void j(int i10, int i11) { int[] iArr = this.f2350a; if (iArr == null || i10 >= iArr.length) { return; } int i12 = i10 + i11; c(i12); int[] iArr2 = this.f2350a; System.arraycopy(iArr2, i10, iArr2, i12, (iArr2.length - i10) - i11); Arrays.fill(this.f2350a, i10, i12, -1); l(i10, i11); } void k(int i10, int i11) { int[] iArr = this.f2350a; if (iArr == null || i10 >= iArr.length) { return; } int i12 = i10 + i11; c(i12); int[] iArr2 = this.f2350a; System.arraycopy(iArr2, i12, iArr2, i10, (iArr2.length - i10) - i11); int[] iArr3 = this.f2350a; Arrays.fill(iArr3, iArr3.length - i11, iArr3.length, -1); m(i10, i11); } void n(int i10, f fVar) { c(i10); this.f2350a[i10] = fVar.f2370e; } int o(int i10) { int length = this.f2350a.length; while (length <= i10) { length *= 2; } return length; } static class a implements Parcelable { public static final Parcelable.Creator CREATOR = new C0032a(); /* renamed from: a, reason: collision with root package name */ int f2352a; /* renamed from: b, reason: collision with root package name */ int f2353b; /* renamed from: c, reason: collision with root package name */ int[] f2354c; /* renamed from: d, reason: collision with root package name */ boolean f2355d; /* renamed from: androidx.recyclerview.widget.StaggeredGridLayoutManager$d$a$a, reason: collision with other inner class name */ static class C0032a implements Parcelable.Creator { C0032a() { } @Override // android.os.Parcelable.Creator /* renamed from: a, reason: merged with bridge method [inline-methods] */ public a createFromParcel(Parcel parcel) { return new a(parcel); } @Override // android.os.Parcelable.Creator /* renamed from: b, reason: merged with bridge method [inline-methods] */ public a[] newArray(int i10) { return new a[i10]; } } a(Parcel parcel) { this.f2352a = parcel.readInt(); this.f2353b = parcel.readInt(); this.f2355d = parcel.readInt() == 1; int readInt = parcel.readInt(); if (readInt > 0) { int[] iArr = new int[readInt]; this.f2354c = iArr; parcel.readIntArray(iArr); } } int a(int i10) { int[] iArr = this.f2354c; if (iArr == null) { return 0; } return iArr[i10]; } @Override // android.os.Parcelable public int describeContents() { return 0; } public String toString() { return "FullSpanItem{mPosition=" + this.f2352a + ", mGapDir=" + this.f2353b + ", mHasUnwantedGapAfter=" + this.f2355d + ", mGapPerSpan=" + Arrays.toString(this.f2354c) + '}'; } @Override // android.os.Parcelable public void writeToParcel(Parcel parcel, int i10) { parcel.writeInt(this.f2352a); parcel.writeInt(this.f2353b); parcel.writeInt(this.f2355d ? 1 : 0); int[] iArr = this.f2354c; if (iArr == null || iArr.length <= 0) { parcel.writeInt(0); } else { parcel.writeInt(iArr.length); parcel.writeIntArray(this.f2354c); } } a() { } } } }