package androidx.gridlayout.widget; import android.content.Context; import android.content.res.TypedArray; import android.util.AttributeSet; import android.util.LogPrinter; import android.util.Pair; import android.util.Printer; import android.view.View; import android.view.ViewGroup; import androidx.core.view.ViewCompat; import androidx.legacy.widget.Space; import com.airbnb.deeplinkdispatch.UrlTreeKt; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import java.lang.reflect.Array; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.Iterator; import java.util.List; import o.Pgo; import o.QIQ; import org.bouncycastle.asn1.cmp.PKIFailureInfo; /* loaded from: classes.dex */ public class GridLayout extends ViewGroup { public static final RVV b; public static final RVV c; public static final RVV d; private static RVV h; private static RVV i; private static RVV m; private static RVV n; private static RVV s; private static RVV u; private boolean B; private int D; final HBt e; final HBt f; Printer g; private int v; private int w; private int x; private static Printer l = new LogPrinter(3, GridLayout.class.getName()); private static Printer t = new Printer() { // from class: androidx.gridlayout.widget.GridLayout.5 @Override // android.util.Printer public final void println(String str) { } }; private static final int r = Pgo.Sts.GridLayout_orientation; private static final int p = Pgo.Sts.GridLayout_rowCount; private static final int k = Pgo.Sts.GridLayout_columnCount; private static final int y = Pgo.Sts.GridLayout_useDefaultMargins; private static final int j = Pgo.Sts.GridLayout_alignmentMode; private static final int q = Pgo.Sts.GridLayout_rowOrderPreserved; /* renamed from: o, reason: collision with root package name */ private static final int f6390o = Pgo.Sts.GridLayout_columnOrderPreserved; static final RVV a = new RVV() { // from class: androidx.gridlayout.widget.GridLayout.4 @Override // androidx.gridlayout.widget.GridLayout.RVV final int b(View view, int i2) { return PKIFailureInfo.systemUnavail; } @Override // androidx.gridlayout.widget.GridLayout.RVV public final int e(View view, int i2, int i3) { return PKIFailureInfo.systemUnavail; } @Override // androidx.gridlayout.widget.GridLayout.RVV final String a() { return "UNDEFINED"; } }; static boolean b(int i2) { return (i2 & 2) != 0; } static { RVV rvv = new RVV() { // from class: androidx.gridlayout.widget.GridLayout.3 @Override // androidx.gridlayout.widget.GridLayout.RVV final int b(View view, int i2) { return 0; } @Override // androidx.gridlayout.widget.GridLayout.RVV public final int e(View view, int i2, int i3) { return 0; } @Override // androidx.gridlayout.widget.GridLayout.RVV final String a() { return "LEADING"; } }; RVV rvv2 = new RVV() { // from class: androidx.gridlayout.widget.GridLayout.1 @Override // androidx.gridlayout.widget.GridLayout.RVV final int b(View view, int i2) { return i2; } @Override // androidx.gridlayout.widget.GridLayout.RVV public final int e(View view, int i2, int i3) { return i2; } @Override // androidx.gridlayout.widget.GridLayout.RVV final String a() { return "TRAILING"; } }; u = rvv; h = rvv2; d = rvv; n = rvv2; m = new RVV(rvv, rvv2) { // from class: androidx.gridlayout.widget.GridLayout.2 final RVV c; final RVV d; { this.d = rvv; this.c = rvv2; } @Override // androidx.gridlayout.widget.GridLayout.RVV final int b(View view, int i2) { return (ViewCompat.m(view) == 1 ? this.c : this.d).b(view, i2); } @Override // androidx.gridlayout.widget.GridLayout.RVV public final int e(View view, int i2, int i3) { return (ViewCompat.m(view) == 1 ? this.c : this.d).e(view, i2, i3); } @Override // androidx.gridlayout.widget.GridLayout.RVV final String a() { StringBuilder sb = new StringBuilder("SWITCHING[L:"); sb.append(this.d.a()); sb.append(", R:"); sb.append(this.c.a()); sb.append("]"); return sb.toString(); } }; s = new RVV(rvv2, rvv) { // from class: androidx.gridlayout.widget.GridLayout.2 final RVV c; final RVV d; { this.d = rvv2; this.c = rvv; } @Override // androidx.gridlayout.widget.GridLayout.RVV final int b(View view, int i2) { return (ViewCompat.m(view) == 1 ? this.c : this.d).b(view, i2); } @Override // androidx.gridlayout.widget.GridLayout.RVV public final int e(View view, int i2, int i3) { return (ViewCompat.m(view) == 1 ? this.c : this.d).e(view, i2, i3); } @Override // androidx.gridlayout.widget.GridLayout.RVV final String a() { StringBuilder sb = new StringBuilder("SWITCHING[L:"); sb.append(this.d.a()); sb.append(", R:"); sb.append(this.c.a()); sb.append("]"); return sb.toString(); } }; i = new RVV() { // from class: androidx.gridlayout.widget.GridLayout.9 @Override // androidx.gridlayout.widget.GridLayout.RVV final int b(View view, int i2) { return i2 >> 1; } @Override // androidx.gridlayout.widget.GridLayout.RVV public final int e(View view, int i2, int i3) { return i2 >> 1; } @Override // androidx.gridlayout.widget.GridLayout.RVV final String a() { return "CENTER"; } }; c = new RVV() { // from class: androidx.gridlayout.widget.GridLayout.6 @Override // androidx.gridlayout.widget.GridLayout.RVV final int b(View view, int i2) { return 0; } @Override // androidx.gridlayout.widget.GridLayout.RVV public final int e(View view, int i2, int i3) { if (view.getVisibility() == 8) { return 0; } int baseline = view.getBaseline(); return baseline == -1 ? PKIFailureInfo.systemUnavail : baseline; } @Override // androidx.gridlayout.widget.GridLayout.RVV public final LWm e() { return new LWm(this) { // from class: androidx.gridlayout.widget.GridLayout.6.3 final AnonymousClass6 a; private int e; { this.a = this; } @Override // androidx.gridlayout.widget.GridLayout.LWm protected final void a() { super.a(); this.e = PKIFailureInfo.systemUnavail; } @Override // androidx.gridlayout.widget.GridLayout.LWm protected final void d(int i2, int i3) { super.d(i2, i3); this.e = Math.max(this.e, i2 + i3); } @Override // androidx.gridlayout.widget.GridLayout.LWm protected final int b(boolean z) { return Math.max(super.b(z), this.e); } @Override // androidx.gridlayout.widget.GridLayout.LWm protected final int e(GridLayout gridLayout, View view, RVV rvv3, int i2, boolean z) { return Math.max(0, super.e(gridLayout, view, rvv3, i2, z)); } }; } @Override // androidx.gridlayout.widget.GridLayout.RVV final String a() { return "BASELINE"; } }; b = new RVV() { // from class: androidx.gridlayout.widget.GridLayout.10 @Override // androidx.gridlayout.widget.GridLayout.RVV final int b(View view, int i2) { return 0; } @Override // androidx.gridlayout.widget.GridLayout.RVV public final int d(int i2, int i3) { return i3; } @Override // androidx.gridlayout.widget.GridLayout.RVV public final int e(View view, int i2, int i3) { return PKIFailureInfo.systemUnavail; } @Override // androidx.gridlayout.widget.GridLayout.RVV final String a() { return "FILL"; } }; } public GridLayout(Context context, AttributeSet attributeSet, int i2) { super(context, attributeSet, i2); this.e = new HBt(this, true); this.f = new HBt(this, false); this.D = 0; this.B = false; this.x = 1; this.w = 0; this.g = l; this.v = context.getResources().getDimensionPixelOffset(Pgo.HBt.default_gap); TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, Pgo.Sts.GridLayout); try { setRowCount(obtainStyledAttributes.getInt(p, PKIFailureInfo.systemUnavail)); setColumnCount(obtainStyledAttributes.getInt(k, PKIFailureInfo.systemUnavail)); setOrientation(obtainStyledAttributes.getInt(r, 0)); setUseDefaultMargins(obtainStyledAttributes.getBoolean(y, false)); setAlignmentMode(obtainStyledAttributes.getInt(j, 1)); setRowOrderPreserved(obtainStyledAttributes.getBoolean(q, true)); setColumnOrderPreserved(obtainStyledAttributes.getBoolean(f6390o, true)); } finally { obtainStyledAttributes.recycle(); } } public GridLayout(Context context, AttributeSet attributeSet) { this(context, attributeSet, 0); } public GridLayout(Context context) { this(context, null); } public void setOrientation(int i2) { if (this.D != i2) { this.D = i2; d(); requestLayout(); } } public void setRowCount(int i2) { this.f.d(i2); d(); requestLayout(); } public void setColumnCount(int i2) { this.e.d(i2); d(); requestLayout(); } public void setUseDefaultMargins(boolean z) { this.B = z; requestLayout(); } public void setAlignmentMode(int i2) { this.x = i2; requestLayout(); } public void setRowOrderPreserved(boolean z) { HBt hBt = this.f; hBt.h = z; hBt.e(); d(); requestLayout(); } public void setColumnOrderPreserved(boolean z) { HBt hBt = this.e; hBt.h = z; hBt.e(); d(); requestLayout(); } static int b(int[] iArr) { int i2 = -1; for (int i3 : iArr) { i2 = Math.max(i2, i3); } return i2; } static T[] b(T[] tArr, T[] tArr2) { T[] tArr3 = (T[]) ((Object[]) Array.newInstance(tArr.getClass().getComponentType(), tArr.length + tArr2.length)); System.arraycopy(tArr, 0, tArr3, 0, tArr.length); System.arraycopy(tArr2, 0, tArr3, tArr.length, tArr2.length); return tArr3; } private int a(View view, jbe jbeVar, boolean z, boolean z2) { if (!this.B) { return 0; } tOB tob = z ? jbeVar.b : jbeVar.a; HBt hBt = z ? this.e : this.f; saX sax = tob.a; if (!z || ViewCompat.m(this) != 1 ? z2 : !z2) { int i2 = sax.d; } else { int i3 = sax.b; int i4 = hBt.b; hBt.b(); } if (view.getClass() == Space.class || view.getClass() == android.widget.Space.class) { return 0; } return this.v / 2; } final int e(View view, boolean z, boolean z2) { int[] iArr; if (this.x == 1) { return a(view, z, z2); } HBt hBt = z ? this.e : this.f; if (z2) { if (hBt.c == null) { hBt.c = new int[Math.max(hBt.b, hBt.b()) + 1]; } if (!hBt.e) { hBt.e(true); hBt.e = true; } iArr = hBt.c; } else { if (hBt.i == null) { hBt.i = new int[Math.max(hBt.b, hBt.b()) + 1]; } if (!hBt.k) { hBt.e(false); hBt.k = true; } iArr = hBt.i; } jbe jbeVar = (jbe) view.getLayoutParams(); saX sax = (z ? jbeVar.b : jbeVar.a).a; return iArr[z2 ? sax.d : sax.b]; } private void d() { this.w = 0; HBt hBt = this.e; if (hBt != null) { hBt.e(); } HBt hBt2 = this.f; if (hBt2 != null) { hBt2.e(); } HBt hBt3 = this.e; if (hBt3 == null || this.f == null) { return; } hBt3.a(); this.f.a(); } static jbe c(View view) { return (jbe) view.getLayoutParams(); } static void e(String str) { StringBuilder sb = new StringBuilder(); sb.append(str); sb.append(". "); throw new IllegalArgumentException(sb.toString()); } private void d(jbe jbeVar, boolean z) { String str = z ? "column" : "row"; saX sax = (z ? jbeVar.b : jbeVar.a).a; if (sax.d != Integer.MIN_VALUE && sax.d < 0) { String concat = str.concat(" indices must be positive"); StringBuilder sb = new StringBuilder(); sb.append(concat); sb.append(". "); throw new IllegalArgumentException(sb.toString()); } int i2 = (z ? this.e : this.f).b; if (i2 != Integer.MIN_VALUE) { if (sax.b > i2) { StringBuilder sb2 = new StringBuilder(); sb2.append(str); sb2.append(" indices (start + span) mustn't exceed the "); sb2.append(str); sb2.append(" count"); String obj = sb2.toString(); StringBuilder sb3 = new StringBuilder(); sb3.append(obj); sb3.append(". "); throw new IllegalArgumentException(sb3.toString()); } if (sax.b - sax.d <= i2) { return; } StringBuilder sb4 = new StringBuilder(); sb4.append(str); sb4.append(" span mustn't exceed the "); sb4.append(str); sb4.append(" count"); String obj2 = sb4.toString(); StringBuilder sb5 = new StringBuilder(); sb5.append(obj2); sb5.append(". "); throw new IllegalArgumentException(sb5.toString()); } } @Override // android.view.ViewGroup protected boolean checkLayoutParams(ViewGroup.LayoutParams layoutParams) { if (!(layoutParams instanceof jbe)) { return false; } jbe jbeVar = (jbe) layoutParams; d(jbeVar, true); d(jbeVar, false); return true; } private int e() { int childCount = getChildCount(); int i2 = 1; for (int i3 = 0; i3 < childCount; i3++) { View childAt = getChildAt(i3); if (childAt.getVisibility() != 8) { i2 = (i2 * 31) + ((jbe) childAt.getLayoutParams()).hashCode(); } } return i2; } private void a() { while (true) { int i2 = this.w; if (i2 == 0) { boolean z = this.D == 0; HBt hBt = z ? this.e : this.f; int i3 = hBt.b != Integer.MIN_VALUE ? hBt.b : 0; int[] iArr = new int[i3]; int childCount = getChildCount(); int i4 = 0; int i5 = 0; for (int i6 = 0; i6 < childCount; i6++) { jbe jbeVar = (jbe) getChildAt(i6).getLayoutParams(); tOB tob = z ? jbeVar.a : jbeVar.b; saX sax = tob.a; boolean z2 = tob.b; int i7 = sax.b - sax.d; if (z2) { i4 = sax.d; } tOB tob2 = z ? jbeVar.b : jbeVar.a; saX sax2 = tob2.a; boolean z3 = tob2.b; int i8 = sax2.b - sax2.d; if (i3 != 0) { i8 = Math.min(i8, i3 - (z3 ? Math.min(sax2.d, i3) : 0)); } if (z3) { i5 = sax2.d; } if (i3 != 0) { if (!z2 || !z3) { while (true) { int i9 = i5 + i8; if (i9 <= i3) { for (int i10 = i5; i10 < i9; i10++) { if (iArr[i10] <= i4) { } } break; } if (z3) { i4++; } else if (i9 <= i3) { i5++; } else { i4++; i5 = 0; } } } Arrays.fill(iArr, Math.min(i5, i3), Math.min(i5 + i8, i3), i4 + i7); } if (z) { saX sax3 = new saX(i4, i7 + i4); tOB tob3 = jbeVar.a; jbeVar.a = new tOB(tob3.b, sax3, tob3.c, tob3.e); saX sax4 = new saX(i5, i8 + i5); tOB tob4 = jbeVar.b; jbeVar.b = new tOB(tob4.b, sax4, tob4.c, tob4.e); } else { saX sax5 = new saX(i5, i8 + i5); tOB tob5 = jbeVar.a; jbeVar.a = new tOB(tob5.b, sax5, tob5.c, tob5.e); saX sax6 = new saX(i4, i7 + i4); tOB tob6 = jbeVar.b; jbeVar.b = new tOB(tob6.b, sax6, tob6.c, tob6.e); } i5 += i8; } this.w = e(); return; } if (i2 == e()) { return; } this.g.println("The fields of some layout parameters were modified in between layout operations. Check the javadoc for GridLayout.LayoutParams#rowSpec."); d(); } } private void e(int i2, int i3, boolean z) { int childCount = getChildCount(); for (int i4 = 0; i4 < childCount; i4++) { View childAt = getChildAt(i4); if (childAt.getVisibility() != 8) { jbe jbeVar = (jbe) childAt.getLayoutParams(); if (z) { c(childAt, i2, i3, ((ViewGroup.LayoutParams) jbeVar).width, ((ViewGroup.LayoutParams) jbeVar).height); } else { boolean z2 = this.D == 0; tOB tob = z2 ? jbeVar.b : jbeVar.a; if (tob.c(z2) == b) { saX sax = tob.a; int[] c2 = (z2 ? this.e : this.f).c(); int e = (c2[sax.b] - c2[sax.d]) - (e(childAt, z2, true) + e(childAt, z2, false)); if (z2) { c(childAt, i2, i3, e, ((ViewGroup.LayoutParams) jbeVar).height); } else { c(childAt, i2, i3, ((ViewGroup.LayoutParams) jbeVar).width, e); } } } } } } @Override // android.view.View protected void onMeasure(int i2, int i3) { int e; int i4; a(); HBt hBt = this.e; if (hBt != null && this.f != null) { hBt.a(); this.f.a(); } int paddingLeft = getPaddingLeft() + getPaddingRight(); int paddingTop = getPaddingTop() + getPaddingBottom(); int makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(View.MeasureSpec.getSize((-paddingLeft) + i2), View.MeasureSpec.getMode(i2)); int makeMeasureSpec2 = View.MeasureSpec.makeMeasureSpec(View.MeasureSpec.getSize((-paddingTop) + i3), View.MeasureSpec.getMode(i3)); e(makeMeasureSpec, makeMeasureSpec2, true); if (this.D == 0) { e = this.e.e(makeMeasureSpec); e(makeMeasureSpec, makeMeasureSpec2, false); i4 = this.f.e(makeMeasureSpec2); } else { int e2 = this.f.e(makeMeasureSpec2); e(makeMeasureSpec, makeMeasureSpec2, false); e = this.e.e(makeMeasureSpec); i4 = e2; } setMeasuredDimension(View.resolveSizeAndState(Math.max(e + paddingLeft, getSuggestedMinimumWidth()), i2, 0), View.resolveSizeAndState(Math.max(i4 + paddingTop, getSuggestedMinimumHeight()), i3, 0)); } @Override // android.view.View, android.view.ViewParent public void requestLayout() { super.requestLayout(); d(); } @Override // android.view.ViewGroup, android.view.View protected void onLayout(boolean z, int i2, int i3, int i4, int i5) { boolean z2; int[] iArr; View view; GridLayout gridLayout = this; a(); int i6 = i4 - i2; int paddingLeft = getPaddingLeft(); int paddingTop = getPaddingTop(); int paddingRight = getPaddingRight(); int paddingBottom = getPaddingBottom(); HBt hBt = gridLayout.e; int i7 = (i6 - paddingLeft) - paddingRight; hBt.j.d = i7; hBt.g.d = -i7; boolean z3 = false; hBt.a = false; hBt.c(); HBt hBt2 = gridLayout.f; int i8 = ((i5 - i3) - paddingTop) - paddingBottom; hBt2.j.d = i8; hBt2.g.d = -i8; hBt2.a = false; hBt2.c(); int[] c2 = gridLayout.e.c(); int[] c3 = gridLayout.f.c(); int childCount = getChildCount(); int i9 = 0; while (i9 < childCount) { View childAt = gridLayout.getChildAt(i9); if (childAt.getVisibility() != 8) { jbe jbeVar = (jbe) childAt.getLayoutParams(); tOB tob = jbeVar.b; tOB tob2 = jbeVar.a; saX sax = tob.a; saX sax2 = tob2.a; int i10 = c2[sax.d]; int i11 = c3[sax2.d]; int i12 = c2[sax.b] - i10; int i13 = c3[sax2.b] - i11; int measuredWidth = childAt.getMeasuredWidth(); int measuredHeight = childAt.getMeasuredHeight(); RVV c4 = tob.c(true); RVV c5 = tob2.c(z3); ojQ d2 = gridLayout.e.d(); LWm lWm = d2.e[d2.c[i9]]; ojQ d3 = gridLayout.f.d(); LWm lWm2 = d3.e[d3.c[i9]]; iArr = c2; int b2 = c4.b(childAt, i12 - lWm.b(true)); int b3 = c5.b(childAt, i13 - lWm2.b(true)); int e = gridLayout.e(childAt, true, true); int e2 = gridLayout.e(childAt, false, true); int e3 = gridLayout.e(childAt, true, false); int i14 = e + e3; int e4 = e2 + gridLayout.e(childAt, false, false); z2 = false; int e5 = lWm.e(this, childAt, c4, measuredWidth + i14, true); int e6 = lWm2.e(this, childAt, c5, measuredHeight + e4, false); int d4 = c4.d(measuredWidth, i12 - i14); int d5 = c5.d(measuredHeight, i13 - e4); int i15 = i10 + b2 + e5; int i16 = ViewCompat.m(this) != 1 ? paddingLeft + e + i15 : (((i6 - d4) - paddingRight) - e3) - i15; int i17 = paddingTop + i11 + b3 + e6 + e2; if (d4 == childAt.getMeasuredWidth() && d5 == childAt.getMeasuredHeight()) { view = childAt; } else { view = childAt; view.measure(View.MeasureSpec.makeMeasureSpec(d4, 1073741824), View.MeasureSpec.makeMeasureSpec(d5, 1073741824)); } view.layout(i16, i17, d4 + i16, d5 + i17); } else { z2 = z3; iArr = c2; } i9++; gridLayout = this; c2 = iArr; z3 = z2; } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes.dex */ public final class HBt { public int[] c; public final boolean d; final GridLayout f; public int[] i; private ojQ l; private IeS[] m; private ojQ p; private int[] r; private ojQ s; private boolean u; private int[] y; public int b = PKIFailureInfo.systemUnavail; private int w = PKIFailureInfo.systemUnavail; private boolean q = false; private boolean t = false; /* renamed from: o, reason: collision with root package name */ private boolean f6391o = false; public boolean e = false; public boolean k = false; private boolean n = false; public boolean a = false; private boolean x = false; boolean h = true; ZqN j = new ZqN(0); ZqN g = new ZqN(-100000); HBt(GridLayout gridLayout, boolean z) { this.f = gridLayout; this.d = z; } final int b() { int i = this.w; int i2 = PKIFailureInfo.systemUnavail; if (i == Integer.MIN_VALUE) { int childCount = this.f.getChildCount(); int i3 = -1; for (int i4 = 0; i4 < childCount; i4++) { jbe c = GridLayout.c(this.f.getChildAt(i4)); saX sax = (this.d ? c.b : c.a).a; i3 = Math.max(Math.max(Math.max(i3, sax.d), sax.b), sax.b - sax.d); } if (i3 != -1) { i2 = i3; } this.w = Math.max(0, i2); } return this.w; } public final void d(int i) { if (i != Integer.MIN_VALUE && i < b()) { GridLayout.e((this.d ? "column" : "row").concat("Count must be greater than or equal to the maximum of all grid indices (and spans) defined in the LayoutParams of each child")); } this.b = i; } private ojQ g() { Sts sts = new Sts(tOB.class, LWm.class); int childCount = this.f.getChildCount(); for (int i = 0; i < childCount; i++) { jbe c = GridLayout.c(this.f.getChildAt(i)); tOB tob = this.d ? c.b : c.a; sts.add(Pair.create(tob, tob.c(this.d).e())); } return sts.d(); } private void i() { int measuredWidth; int i; for (LWm lWm : this.s.e) { lWm.a(); } int childCount = this.f.getChildCount(); for (int i2 = 0; i2 < childCount; i2++) { View childAt = this.f.getChildAt(i2); jbe c = GridLayout.c(childAt); tOB tob = this.d ? c.b : c.a; GridLayout gridLayout = this.f; boolean z = this.d; if (childAt.getVisibility() == 8) { measuredWidth = 0; } else { measuredWidth = (z ? childAt.getMeasuredWidth() : childAt.getMeasuredHeight()) + gridLayout.e(childAt, z, true) + gridLayout.e(childAt, z, false); } if (tob.e == BitmapDescriptorFactory.HUE_RED) { i = 0; } else { if (this.r == null) { this.r = new int[this.f.getChildCount()]; } i = this.r[i2]; } ojQ ojq = this.s; ojq.e[ojq.c[i2]].a(this.f, childAt, tob, this, measuredWidth + i); } } public final ojQ d() { if (this.s == null) { this.s = g(); } if (!this.q) { i(); this.q = true; } return this.s; } private ojQ c(boolean z) { saX sax; Sts sts = new Sts(saX.class, ZqN.class); tOB[] tobArr = d().a; int length = tobArr.length; for (int i = 0; i < length; i++) { if (z) { sax = tobArr[i].a; } else { saX sax2 = tobArr[i].a; sax = new saX(sax2.b, sax2.d); } sts.add(Pair.create(sax, new ZqN())); } return sts.d(); } private void b(ojQ ojq, boolean z) { for (ZqN zqN : ojq.e) { zqN.d = PKIFailureInfo.systemUnavail; } LWm[] lWmArr = d().e; for (int i = 0; i < lWmArr.length; i++) { int b = lWmArr[i].b(z); ZqN zqN2 = ojq.e[ojq.c[i]]; int i2 = zqN2.d; if (!z) { b = -b; } zqN2.d = Math.max(i2, b); } } private ojQ h() { if (this.p == null) { this.p = c(true); } if (!this.t) { b(this.p, true); this.t = true; } return this.p; } private ojQ j() { if (this.l == null) { this.l = c(false); } if (!this.f6391o) { b(this.l, false); this.f6391o = true; } return this.l; } /* JADX INFO: Access modifiers changed from: package-private */ /* renamed from: androidx.gridlayout.widget.GridLayout$HBt$4, reason: invalid class name */ /* loaded from: classes.dex */ public final class AnonymousClass4 { final HBt a; IeS[] b; final IeS[] c; IeS[][] d; private int e; private int[] f; AnonymousClass4(HBt hBt, IeS[] ieSArr) { this.a = hBt; this.c = ieSArr; int length = ieSArr.length; this.b = new IeS[length]; this.e = length - 1; int max = Math.max(hBt.b, hBt.b()) + 1; IeS[][] ieSArr2 = new IeS[max]; int[] iArr = new int[max]; for (IeS ieS : ieSArr) { int i = ieS.c.d; iArr[i] = iArr[i] + 1; } for (int i2 = 0; i2 < max; i2++) { ieSArr2[i2] = new IeS[iArr[i2]]; } Arrays.fill(iArr, 0); for (IeS ieS2 : ieSArr) { int i3 = ieS2.c.d; IeS[] ieSArr3 = ieSArr2[i3]; int i4 = iArr[i3]; iArr[i3] = i4 + 1; ieSArr3[i4] = ieS2; } this.d = ieSArr2; this.f = new int[Math.max(hBt.b, hBt.b()) + 1]; } final void d(int i) { int[] iArr = this.f; if (iArr[i] == 0) { iArr[i] = 1; for (IeS ieS : this.d[i]) { d(ieS.c.b); IeS[] ieSArr = this.b; int i2 = this.e; this.e = i2 - 1; ieSArr[i2] = ieS; } this.f[i] = 2; } } } private static void e(List list, ojQ ojq) { for (int i = 0; i < ojq.a.length; i++) { a(list, ojq.a[i], ojq.e[i], false); } } private IeS[] f() { ArrayList arrayList = new ArrayList(); ArrayList arrayList2 = new ArrayList(); e(arrayList, h()); e(arrayList2, j()); if (this.h) { int i = 0; while (i < Math.max(this.b, b())) { int i2 = i + 1; a(arrayList, new saX(i, i2), new ZqN(0), true); i = i2; } } int max = Math.max(this.b, b()); a(arrayList, new saX(0, max), this.j, false); a(arrayList2, new saX(max, 0), this.g, false); AnonymousClass4 anonymousClass4 = new AnonymousClass4(this, (IeS[]) arrayList.toArray(new IeS[arrayList.size()])); int length = anonymousClass4.d.length; for (int i3 = 0; i3 < length; i3++) { anonymousClass4.d(i3); } IeS[] ieSArr = anonymousClass4.b; AnonymousClass4 anonymousClass42 = new AnonymousClass4(this, (IeS[]) arrayList2.toArray(new IeS[arrayList2.size()])); int length2 = anonymousClass42.d.length; for (int i4 = 0; i4 < length2; i4++) { anonymousClass42.d(i4); } return (IeS[]) GridLayout.b(ieSArr, anonymousClass42.b); } private IeS[] m() { if (this.m == null) { this.m = f(); } if (!this.n) { h(); j(); this.n = true; } return this.m; } private static boolean c(int[] iArr, IeS ieS) { if (!ieS.e) { return false; } saX sax = ieS.c; int i = sax.d; int i2 = sax.b; int i3 = iArr[i] + ieS.b.d; if (i3 <= iArr[i2]) { return false; } iArr[i2] = i3; return true; } private String e(List list) { StringBuilder sb; String str = this.d ? "x" : "y"; StringBuilder sb2 = new StringBuilder(); boolean z = true; for (IeS ieS : list) { if (z) { z = false; } else { sb2.append(", "); } int i = ieS.c.d; int i2 = ieS.c.b; int i3 = ieS.b.d; if (i < i2) { sb = new StringBuilder(); sb.append(str); sb.append(i2); sb.append("-"); sb.append(str); sb.append(i); sb.append(">="); } else { sb = new StringBuilder(); sb.append(str); sb.append(i); sb.append("-"); sb.append(str); sb.append(i2); sb.append("<="); i3 = -i3; } sb.append(i3); sb2.append(sb.toString()); } return sb2.toString(); } private void e(String str, IeS[] ieSArr, boolean[] zArr) { ArrayList arrayList = new ArrayList(); ArrayList arrayList2 = new ArrayList(); for (int i = 0; i < ieSArr.length; i++) { IeS ieS = ieSArr[i]; if (zArr[i]) { arrayList.add(ieS); } if (!ieS.e) { arrayList2.add(ieS); } } Printer printer = this.f.g; StringBuilder sb = new StringBuilder(); sb.append(str); sb.append(" constraints: "); sb.append(e(arrayList)); sb.append(" are inconsistent; permanently removing: "); sb.append(e(arrayList2)); sb.append(". "); printer.println(sb.toString()); } private boolean d(IeS[] ieSArr, int[] iArr, boolean z) { String str = this.d ? "horizontal" : "vertical"; int max = Math.max(this.b, b()) + 1; boolean[] zArr = null; for (int i = 0; i < ieSArr.length; i++) { Arrays.fill(iArr, 0); for (int i2 = 0; i2 < max; i2++) { boolean z2 = false; for (IeS ieS : ieSArr) { z2 |= c(iArr, ieS); } if (!z2) { if (zArr != null) { e(str, ieSArr, zArr); } return true; } } if (!z) { return false; } boolean[] zArr2 = new boolean[ieSArr.length]; for (int i3 = 0; i3 < max; i3++) { int length = ieSArr.length; for (int i4 = 0; i4 < length; i4++) { zArr2[i4] = zArr2[i4] | c(iArr, ieSArr[i4]); } } if (i == 0) { zArr = zArr2; } int i5 = 0; while (true) { if (i5 >= ieSArr.length) { break; } if (zArr2[i5]) { IeS ieS2 = ieSArr[i5]; if (ieS2.c.d >= ieS2.c.b) { ieS2.e = false; break; } } i5++; } } return true; } final void e(boolean z) { int[] iArr = z ? this.c : this.i; int childCount = this.f.getChildCount(); for (int i = 0; i < childCount; i++) { View childAt = this.f.getChildAt(i); if (childAt.getVisibility() != 8) { jbe c = GridLayout.c(childAt); saX sax = (this.d ? c.b : c.a).a; int i2 = z ? sax.d : sax.b; iArr[i2] = Math.max(iArr[i2], this.f.a(childAt, this.d, z)); } } } private void a(int i, float f) { Arrays.fill(this.r, 0); int childCount = this.f.getChildCount(); for (int i2 = 0; i2 < childCount; i2++) { View childAt = this.f.getChildAt(i2); if (childAt.getVisibility() != 8) { jbe c = GridLayout.c(childAt); float f2 = (this.d ? c.b : c.a).e; if (f2 != BitmapDescriptorFactory.HUE_RED) { int round = Math.round((i * f2) / f); this.r[i2] = round; i -= round; f -= f2; } } } } private void a(int[] iArr) { boolean z; boolean z2 = this.x; float f = BitmapDescriptorFactory.HUE_RED; if (!z2) { int childCount = this.f.getChildCount(); int i = 0; while (true) { if (i >= childCount) { z = false; break; } View childAt = this.f.getChildAt(i); if (childAt.getVisibility() != 8) { jbe c = GridLayout.c(childAt); if ((this.d ? c.b : c.a).e != BitmapDescriptorFactory.HUE_RED) { z = true; break; } } i++; } this.u = z; this.x = true; } if (!this.u) { d(m(), iArr, true); } else { if (this.r == null) { this.r = new int[this.f.getChildCount()]; } Arrays.fill(this.r, 0); d(m(), iArr, true); int childCount2 = (this.j.d * this.f.getChildCount()) + 1; if (childCount2 >= 2) { int childCount3 = this.f.getChildCount(); for (int i2 = 0; i2 < childCount3; i2++) { View childAt2 = this.f.getChildAt(i2); if (childAt2.getVisibility() != 8) { jbe c2 = GridLayout.c(childAt2); f += (this.d ? c2.b : c2.a).e; } } int i3 = -1; int i4 = 0; boolean z3 = true; while (i4 < childCount2) { int i5 = (int) ((i4 + childCount2) / 2); a(); a(i5, f); boolean d = d(m(), iArr, false); if (d) { i4 = i5 + 1; i3 = i5; } else { childCount2 = i5; } z3 = d; } if (i3 > 0 && !z3) { a(); a(i3, f); d(m(), iArr, true); } } } if (this.h) { return; } int i6 = iArr[0]; int length = iArr.length; for (int i7 = 0; i7 < length; i7++) { iArr[i7] = iArr[i7] - i6; } } public final int[] c() { if (this.y == null) { this.y = new int[Math.max(this.b, b()) + 1]; } if (!this.a) { a(this.y); this.a = true; } return this.y; } private int c(int i, int i2) { this.j.d = i; this.g.d = -i2; this.a = false; return c()[Math.max(this.b, b())]; } public final int e(int i) { int mode = View.MeasureSpec.getMode(i); int size = View.MeasureSpec.getSize(i); if (mode == Integer.MIN_VALUE) { return c(0, size); } if (mode == 0) { return c(0, 100000); } if (mode != 1073741824) { return 0; } return c(size, size); } public final void e() { this.w = PKIFailureInfo.systemUnavail; this.s = null; this.p = null; this.l = null; this.c = null; this.i = null; this.m = null; this.y = null; this.r = null; this.x = false; a(); } private static void a(List list, saX sax, ZqN zqN, boolean z) { if (sax.b - sax.d == 0) { return; } if (z) { Iterator it = list.iterator(); while (it.hasNext()) { if (it.next().c.equals(sax)) { return; } } } list.add(new IeS(sax, zqN)); } public final void a() { this.q = false; this.t = false; this.f6391o = false; this.e = false; this.k = false; this.n = false; this.a = false; } } /* loaded from: classes.dex */ public static class jbe extends ViewGroup.MarginLayoutParams { private static final int c; private static final int d; private static final int e; private static final int f; private static final int g; private static final int h; private static final int i; private static final int j; private static final int k; private static final int l; private static final int m; private static final int n; /* renamed from: o, reason: collision with root package name */ private static final int f6392o; public tOB a; public tOB b; static { saX sax = new saX(PKIFailureInfo.systemUnavail, -2147483647); f = sax.b - sax.d; j = Pgo.Sts.GridLayout_Layout_android_layout_margin; h = Pgo.Sts.GridLayout_Layout_android_layout_marginLeft; f6392o = Pgo.Sts.GridLayout_Layout_android_layout_marginTop; l = Pgo.Sts.GridLayout_Layout_android_layout_marginRight; d = Pgo.Sts.GridLayout_Layout_android_layout_marginBottom; c = Pgo.Sts.GridLayout_Layout_layout_column; e = Pgo.Sts.GridLayout_Layout_layout_columnSpan; i = Pgo.Sts.GridLayout_Layout_layout_columnWeight; n = Pgo.Sts.GridLayout_Layout_layout_row; m = Pgo.Sts.GridLayout_Layout_layout_rowSpan; k = Pgo.Sts.GridLayout_Layout_layout_rowWeight; g = Pgo.Sts.GridLayout_Layout_layout_gravity; } private jbe(tOB tob, tOB tob2, byte b) { super(-2, -2); this.a = tOB.d; this.b = tOB.d; setMargins(PKIFailureInfo.systemUnavail, PKIFailureInfo.systemUnavail, PKIFailureInfo.systemUnavail, PKIFailureInfo.systemUnavail); this.a = tob; this.b = tob2; } private jbe(tOB tob, tOB tob2) { this(tob, tob2, (byte) 0); } /* JADX WARN: Illegal instructions before constructor call */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public jbe() { /* r1 = this; androidx.gridlayout.widget.GridLayout$tOB r0 = androidx.gridlayout.widget.GridLayout.tOB.d r1.(r0, r0) return */ throw new UnsupportedOperationException("Method not decompiled: androidx.gridlayout.widget.GridLayout.jbe.():void"); } public jbe(ViewGroup.LayoutParams layoutParams) { super(layoutParams); this.a = tOB.d; this.b = tOB.d; } public jbe(ViewGroup.MarginLayoutParams marginLayoutParams) { super(marginLayoutParams); this.a = tOB.d; this.b = tOB.d; } public jbe(jbe jbeVar) { super((ViewGroup.MarginLayoutParams) jbeVar); this.a = tOB.d; this.b = tOB.d; this.a = jbeVar.a; this.b = jbeVar.b; } public jbe(Context context, AttributeSet attributeSet) { super(context, attributeSet); this.a = tOB.d; this.b = tOB.d; TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, Pgo.Sts.GridLayout_Layout); try { int dimensionPixelSize = obtainStyledAttributes.getDimensionPixelSize(j, PKIFailureInfo.systemUnavail); ((ViewGroup.MarginLayoutParams) this).leftMargin = obtainStyledAttributes.getDimensionPixelSize(h, dimensionPixelSize); ((ViewGroup.MarginLayoutParams) this).topMargin = obtainStyledAttributes.getDimensionPixelSize(f6392o, dimensionPixelSize); ((ViewGroup.MarginLayoutParams) this).rightMargin = obtainStyledAttributes.getDimensionPixelSize(l, dimensionPixelSize); ((ViewGroup.MarginLayoutParams) this).bottomMargin = obtainStyledAttributes.getDimensionPixelSize(d, dimensionPixelSize); obtainStyledAttributes.recycle(); obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, Pgo.Sts.GridLayout_Layout); try { int i2 = obtainStyledAttributes.getInt(g, 0); int i3 = obtainStyledAttributes.getInt(c, PKIFailureInfo.systemUnavail); int i4 = e; int i5 = f; this.b = GridLayout.e(i3, obtainStyledAttributes.getInt(i4, i5), GridLayout.e(i2, true), obtainStyledAttributes.getFloat(i, BitmapDescriptorFactory.HUE_RED)); this.a = GridLayout.e(obtainStyledAttributes.getInt(n, PKIFailureInfo.systemUnavail), obtainStyledAttributes.getInt(m, i5), GridLayout.e(i2, false), obtainStyledAttributes.getFloat(k, BitmapDescriptorFactory.HUE_RED)); } finally { } } finally { } } @Override // android.view.ViewGroup.LayoutParams protected final void setBaseAttributes(TypedArray typedArray, int i2, int i3) { ((ViewGroup.LayoutParams) this).width = typedArray.getLayoutDimension(i2, -2); ((ViewGroup.LayoutParams) this).height = typedArray.getLayoutDimension(i3, -2); } public final boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } jbe jbeVar = (jbe) obj; return this.b.equals(jbeVar.b) && this.a.equals(jbeVar.a); } public final int hashCode() { return (this.a.hashCode() * 31) + this.b.hashCode(); } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes.dex */ public static final class IeS { public final ZqN b; public final saX c; public boolean e = true; public IeS(saX sax, ZqN zqN) { this.c = sax; this.b = zqN; } public final String toString() { StringBuilder sb = new StringBuilder(); sb.append(this.c); sb.append(" "); sb.append(!this.e ? "+>" : "->"); sb.append(" "); sb.append(this.b); return sb.toString(); } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes.dex */ public static final class ZqN { public int d; public ZqN() { this.d = PKIFailureInfo.systemUnavail; } public ZqN(int i) { this.d = i; } public final String toString() { return Integer.toString(this.d); } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes.dex */ public static final class Sts extends ArrayList> { private final Class b; private final Class e; Sts(Class cls, Class cls2) { this.b = cls; this.e = cls2; } public final ojQ d() { int size = size(); Object[] objArr = (Object[]) Array.newInstance((Class) this.b, size); Object[] objArr2 = (Object[]) Array.newInstance((Class) this.e, size); for (int i = 0; i < size; i++) { objArr[i] = get(i).first; objArr2[i] = get(i).second; } return new ojQ<>(objArr, objArr2); } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes.dex */ public static final class ojQ { public final K[] a; public final int[] c; public final V[] e; ojQ(K[] kArr, V[] vArr) { int length = kArr.length; int[] iArr = new int[length]; HashMap hashMap = new HashMap(); for (int i = 0; i < length; i++) { K k = kArr[i]; Integer num = (Integer) hashMap.get(k); if (num == null) { num = Integer.valueOf(hashMap.size()); hashMap.put(k, num); } iArr[i] = num.intValue(); } this.c = iArr; this.a = (K[]) e(kArr, iArr); this.e = (V[]) e(vArr, iArr); } private static K[] e(K[] kArr, int[] iArr) { int length = kArr.length; K[] kArr2 = (K[]) ((Object[]) Array.newInstance(kArr.getClass().getComponentType(), GridLayout.b(iArr) + 1)); for (int i = 0; i < length; i++) { kArr2[iArr[i]] = kArr[i]; } return kArr2; } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes.dex */ public static class LWm { private int b; private int c; private int d; LWm() { a(); } protected void d(int i, int i2) { this.b = Math.max(this.b, i); this.c = Math.max(this.c, i2); } protected int b(boolean z) { if (z || !GridLayout.b(this.d)) { return this.b + this.c; } return 100000; } protected int e(GridLayout gridLayout, View view, RVV rvv, int i, boolean z) { return this.b - rvv.e(view, i, QIQ.sW_(gridLayout)); } protected final void a(GridLayout gridLayout, View view, tOB tob, HBt hBt, int i) { this.d &= (tob.c == GridLayout.a && tob.e == BitmapDescriptorFactory.HUE_RED) ? 0 : 2; int e = tob.c(hBt.d).e(view, i, QIQ.sW_(gridLayout)); d(e, i - e); } public String toString() { StringBuilder sb = new StringBuilder("Bounds{before="); sb.append(this.b); sb.append(", after="); sb.append(this.c); sb.append(UrlTreeKt.componentParamSuffixChar); return sb.toString(); } protected void a() { this.b = PKIFailureInfo.systemUnavail; this.c = PKIFailureInfo.systemUnavail; this.d = 2; } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes.dex */ public static final class saX { public final int b; public final int d; public saX(int i, int i2) { this.d = i; this.b = i2; } public final boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } saX sax = (saX) obj; return this.b == sax.b && this.d == sax.d; } public final String toString() { StringBuilder sb = new StringBuilder("["); sb.append(this.d); sb.append(", "); sb.append(this.b); sb.append("]"); return sb.toString(); } public final int hashCode() { return (this.d * 31) + this.b; } } /* loaded from: classes.dex */ public static class tOB { static final tOB d = GridLayout.c(); final saX a; final boolean b; final RVV c; final float e; tOB(boolean z, saX sax, RVV rvv, float f) { this.b = z; this.a = sax; this.c = rvv; this.e = f; } tOB(boolean z, int i, int i2, RVV rvv, float f) { this(z, new saX(i, i2 + i), rvv, f); } public final RVV c(boolean z) { if (this.c != GridLayout.a) { return this.c; } if (this.e == BitmapDescriptorFactory.HUE_RED) { return z ? GridLayout.d : GridLayout.c; } return GridLayout.b; } public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } tOB tob = (tOB) obj; return this.c.equals(tob.c) && this.a.equals(tob.a); } public int hashCode() { return (this.a.hashCode() * 31) + this.c.hashCode(); } } public static tOB e(int i2, int i3, RVV rvv, float f) { return new tOB(i2 != Integer.MIN_VALUE, i2, i3, rvv, f); } public static tOB c() { return new tOB(false, PKIFailureInfo.systemUnavail, 1, a, BitmapDescriptorFactory.HUE_RED); } /* loaded from: classes.dex */ public static abstract class RVV { abstract String a(); abstract int b(View view, int i); int d(int i, int i2) { return i; } abstract int e(View view, int i, int i2); RVV() { } LWm e() { return new LWm(); } public String toString() { StringBuilder sb = new StringBuilder("Alignment:"); sb.append(a()); return sb.toString(); } } private void c(View view, int i2, int i3, int i4, int i5) { view.measure(getChildMeasureSpec(i2, e(view, true, true) + e(view, true, false), i4), getChildMeasureSpec(i3, e(view, false, true) + e(view, false, false), i5)); } @Override // android.view.ViewGroup protected /* synthetic */ ViewGroup.LayoutParams generateDefaultLayoutParams() { return new jbe(); } @Override // android.view.ViewGroup public /* synthetic */ ViewGroup.LayoutParams generateLayoutParams(AttributeSet attributeSet) { return new jbe(getContext(), attributeSet); } @Override // android.view.ViewGroup protected /* synthetic */ ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams layoutParams) { if (layoutParams instanceof jbe) { return new jbe((jbe) layoutParams); } if (layoutParams instanceof ViewGroup.MarginLayoutParams) { return new jbe((ViewGroup.MarginLayoutParams) layoutParams); } return new jbe(layoutParams); } final int a(View view, boolean z, boolean z2) { int i2; jbe jbeVar = (jbe) view.getLayoutParams(); if (z) { i2 = z2 ? ((ViewGroup.MarginLayoutParams) jbeVar).leftMargin : ((ViewGroup.MarginLayoutParams) jbeVar).rightMargin; } else { i2 = z2 ? ((ViewGroup.MarginLayoutParams) jbeVar).topMargin : ((ViewGroup.MarginLayoutParams) jbeVar).bottomMargin; } return i2 == Integer.MIN_VALUE ? a(view, jbeVar, z, z2) : i2; } public void setPrinter(Printer printer) { if (printer == null) { printer = t; } this.g = printer; } static RVV e(int i2, boolean z) { int i3 = (i2 & (z ? 7 : 112)) >> (z ? 0 : 4); return i3 != 1 ? i3 != 3 ? i3 != 5 ? i3 != 7 ? i3 != 8388611 ? i3 != 8388613 ? a : n : d : b : z ? s : h : z ? m : u : i; } }