package com.google.android.flexbox; 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.util.SparseArray; import android.view.View; import android.view.ViewGroup; import androidx.core.view.ViewCompat; import androidx.recyclerview.widget.RecyclerView; import com.airbnb.deeplinkdispatch.UrlTreeKt; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import java.util.ArrayList; import java.util.List; import o.C11786els; import o.C3223atU; import o.DNa; import o.EiS; import o.MSs; import o.rqd; import org.bouncycastle.asn1.cmp.PKIFailureInfo; /* loaded from: classes.dex */ public class FlexboxLayoutManager extends RecyclerView.tOB implements DNa, RecyclerView.CeN.RVV { private static final Rect a = new Rect(); private boolean C; private int D; private View G; private LWm H; private HBt I; private RecyclerView.AcL K; private boolean L; private RecyclerView.huo M; private MSs R; int b; MSs c; boolean d; int e; private final Context i; private int j; private int F = -1; private List h = new ArrayList(); private EiS z = new EiS(this); private RVV f = new RVV(this, 0); private int N = -1; private int J = PKIFailureInfo.systemUnavail; private int E = PKIFailureInfo.systemUnavail; private int A = PKIFailureInfo.systemUnavail; private SparseArray Q = new SparseArray<>(); private int g = -1; private EiS.RVV B = new EiS.RVV(); @Override // o.DNa public final int b() { return 5; } @Override // o.DNa public final void b(C3223atU c3223atU) { } public FlexboxLayoutManager(Context context, AttributeSet attributeSet, int i, int i2) { RecyclerView.tOB.IeS Ai_ = Ai_(context, attributeSet, i, i2); int i3 = Ai_.a; if (i3 != 0) { if (i3 == 1) { if (Ai_.c) { n(3); } else { n(2); } } } else if (Ai_.c) { n(1); } else { n(0); } int i4 = this.b; if (i4 != 1) { if (i4 == 0) { for (int i_ = i_() - 1; i_ >= 0; i_--) { this.k.e(i_); } this.h.clear(); this.f.c(); this.f.b = 0; } this.b = 1; this.c = null; this.R = null; RecyclerView recyclerView = this.s; if (recyclerView != null) { recyclerView.requestLayout(); } } if (this.j != 4) { for (int i_2 = i_() - 1; i_2 >= 0; i_2--) { this.k.e(i_2); } this.h.clear(); this.f.c(); this.f.b = 0; this.j = 4; RecyclerView recyclerView2 = this.s; if (recyclerView2 != null) { recyclerView2.requestLayout(); } } this.n = true; this.i = context; } @Override // o.DNa public final void d(View view, int i, int i2, C3223atU c3223atU) { Rect rect = a; RecyclerView recyclerView = this.s; if (recyclerView == null) { rect.set(0, 0, 0, 0); } else { rect.set(recyclerView.Ab_(view)); } int i3 = this.e; if (i3 != 0 && i3 != 1) { int i4 = ((RecyclerView.saX) view.getLayoutParams()).d.top + ((RecyclerView.saX) view.getLayoutParams()).d.bottom; c3223atU.i += i4; c3223atU.d += i4; } else { int i5 = ((RecyclerView.saX) view.getLayoutParams()).d.left + ((RecyclerView.saX) view.getLayoutParams()).d.right; c3223atU.i += i5; c3223atU.d += i5; } } @Override // o.DNa public final View d(int i) { View view = this.Q.get(i); return view != null ? view : this.M.d(i); } @Override // o.DNa public final View c(int i) { View view = this.Q.get(i); return view != null ? view : this.M.d(i); } @Override // o.DNa public final int f() { if (this.h.size() == 0) { return 0; } int size = this.h.size(); int i = PKIFailureInfo.systemUnavail; for (int i2 = 0; i2 < size; i2++) { i = Math.max(i, this.h.get(i2).i); } return i; } @Override // o.DNa public final int o() { int size = this.h.size(); int i = 0; for (int i2 = 0; i2 < size; i2++) { i += this.h.get(i2).b; } return i; } @Override // o.DNa public final void c(int i, View view) { this.Q.put(i, view); } @Override // androidx.recyclerview.widget.RecyclerView.CeN.RVV public final PointF Hy_(int i) { if (i_() == 0) { return null; } int i2 = i < ((RecyclerView.saX) f(0).getLayoutParams()).g.getLayoutPosition() ? -1 : 1; int i3 = this.e; if (i3 == 0 || i3 == 1) { return new PointF(BitmapDescriptorFactory.HUE_RED, i2); } return new PointF(i2, BitmapDescriptorFactory.HUE_RED); } @Override // androidx.recyclerview.widget.RecyclerView.tOB public final RecyclerView.saX e() { return new Sts(); } @Override // androidx.recyclerview.widget.RecyclerView.tOB public final RecyclerView.saX Hz_(Context context, AttributeSet attributeSet) { return new Sts(context, attributeSet); } @Override // androidx.recyclerview.widget.RecyclerView.tOB public final boolean b(RecyclerView.saX sax) { return sax instanceof Sts; } @Override // androidx.recyclerview.widget.RecyclerView.tOB public final Parcelable HB_() { byte b = 0; if (this.H != null) { return new LWm(this.H, b); } LWm lWm = new LWm(); if (i_() <= 0) { lWm.c = -1; } else { View f = f(0); lWm.c = ((RecyclerView.saX) f.getLayoutParams()).g.getLayoutPosition(); lWm.a = this.c.c(f) - this.c.i(); } return lWm; } @Override // androidx.recyclerview.widget.RecyclerView.tOB public final void HA_(Parcelable parcelable) { if (parcelable instanceof LWm) { this.H = (LWm) parcelable; RecyclerView recyclerView = this.s; if (recyclerView != null) { recyclerView.requestLayout(); } } } @Override // androidx.recyclerview.widget.RecyclerView.tOB public final void d(RecyclerView recyclerView, int i, int i2) { super.d(recyclerView, i, i2); m(i); } @Override // androidx.recyclerview.widget.RecyclerView.tOB public final void a(RecyclerView recyclerView, int i, int i2, Object obj) { super.a(recyclerView, i, i2, obj); m(i); } @Override // androidx.recyclerview.widget.RecyclerView.tOB public final void b(RecyclerView recyclerView, int i, int i2) { super.b(recyclerView, i, i2); m(i); } @Override // androidx.recyclerview.widget.RecyclerView.tOB public final void c(RecyclerView recyclerView, int i, int i2) { super.c(recyclerView, i, i2); m(i); } @Override // androidx.recyclerview.widget.RecyclerView.tOB public final void b(RecyclerView recyclerView, int i, int i2, int i3) { super.b(recyclerView, i, i2, i3); m(Math.min(i, i2)); } @Override // androidx.recyclerview.widget.RecyclerView.tOB public final void d(RecyclerView.AcL acL) { super.d(acL); this.H = null; this.N = -1; this.J = PKIFailureInfo.systemUnavail; this.g = -1; this.f.c(); this.Q.clear(); } private View e(int i) { View d = d(0, i_(), i); if (d == null) { return null; } int i2 = this.z.b[((RecyclerView.saX) d.getLayoutParams()).g.getLayoutPosition()]; if (i2 == -1) { return null; } return e(d, this.h.get(i2)); } private View h(int i) { View d = d(i_() - 1, -1, i); if (d == null) { return null; } return b(d, this.h.get(this.z.b[((RecyclerView.saX) d.getLayoutParams()).g.getLayoutPosition()])); } private View d(int i, int i2, int i3) { s(); if (this.I == null) { this.I = new HBt((byte) 0); } int i4 = this.c.i(); int d = this.c.d(); int i5 = i2 > i ? 1 : -1; View view = null; View view2 = null; while (i != i2) { View f = f(i); int layoutPosition = ((RecyclerView.saX) f.getLayoutParams()).g.getLayoutPosition(); if (layoutPosition >= 0 && layoutPosition < i3) { if (((RecyclerView.saX) f.getLayoutParams()).g.isRemoved()) { if (view2 == null) { view2 = f; } } else { if (this.c.c(f) >= i4 && this.c.a(f) <= d) { return f; } if (view == null) { view = f; } } } i += i5; } return view == null ? view2 : view; } private void e(RVV rvv, boolean z, boolean z2) { if (z2) { w(); } else { this.I.c = false; } int i = this.e; if (i == 0 || i == 1 || !this.d) { this.I.b = this.c.d() - rvv.d; } else { this.I.b = rvv.d - getPaddingRight(); } this.I.i = rvv.g; this.I.e = 1; this.I.h = 1; this.I.j = rvv.d; this.I.f = PKIFailureInfo.systemUnavail; this.I.a = rvv.c; if (!z || this.h.size() <= 1 || rvv.c < 0 || rvv.c >= this.h.size() - 1) { return; } C3223atU c3223atU = this.h.get(rvv.c); this.I.a++; this.I.i += c3223atU.h; } private void c(RVV rvv, boolean z, boolean z2) { if (z2) { w(); } else { this.I.c = false; } int i = this.e; if (i == 0 || i == 1 || !this.d) { this.I.b = rvv.d - this.c.i(); } else { this.I.b = (this.G.getWidth() - rvv.d) - this.c.i(); } this.I.i = rvv.g; this.I.e = 1; this.I.h = -1; this.I.j = rvv.d; this.I.f = PKIFailureInfo.systemUnavail; this.I.a = rvv.c; if (!z || rvv.c <= 0 || this.h.size() <= rvv.c) { return; } C3223atU c3223atU = this.h.get(rvv.c); this.I.a--; this.I.i -= c3223atU.h; } @Override // androidx.recyclerview.widget.RecyclerView.tOB public final void d(RecyclerView recyclerView, int i) { C11786els c11786els = new C11786els(recyclerView.getContext()); c11786els.f = i; b(c11786els); } @Override // androidx.recyclerview.widget.RecyclerView.tOB public final void c(RecyclerView recyclerView) { super.c(recyclerView); this.G = (View) recyclerView.getParent(); } @Override // androidx.recyclerview.widget.RecyclerView.tOB public final void e(RecyclerView recyclerView, RecyclerView.huo huoVar) { super.e(recyclerView, huoVar); } private int d(int i, RecyclerView.huo huoVar, RecyclerView.AcL acL) { if (i_() == 0 || i == 0) { return 0; } s(); int i2 = 1; this.I.g = true; int i3 = this.e; boolean z = (i3 == 0 || i3 == 1 || !this.d) ? false : true; if (!z ? i <= 0 : i >= 0) { i2 = -1; } int abs = Math.abs(i); b(i2, abs); int c = this.I.f + c(huoVar, acL, this.I); if (c < 0) { return 0; } if (z) { if (abs > c) { i = (-i2) * c; } } else if (abs > c) { i = i2 * c; } this.c.c(-i); this.I.d = i; return i; } private int l(int i) { int i2; int i3; if (i_() == 0 || i == 0) { return 0; } s(); int i4 = this.e; boolean z = i4 == 0 || i4 == 1; View view = this.G; int width = z ? view.getWidth() : view.getHeight(); if (z) { i2 = this.w; } else { i2 = this.l; } if (ViewCompat.m(this.s) == 1) { int abs = Math.abs(i); if (i < 0) { i3 = Math.min((i2 + this.f.b) - width, abs); } else { if (this.f.b + i <= 0) { return i; } i3 = this.f.b; } } else { if (i > 0) { return Math.min((i2 - this.f.b) - width, i); } if (this.f.b + i >= 0) { return i; } i3 = this.f.b; } return -i3; } @Override // androidx.recyclerview.widget.RecyclerView.tOB public final int f(RecyclerView.AcL acL) { return g(acL); } @Override // androidx.recyclerview.widget.RecyclerView.tOB public final int j(RecyclerView.AcL acL) { return g(acL); } private int g(RecyclerView.AcL acL) { if (i_() == 0) { return 0; } int i = acL.c ? acL.i - acL.b : acL.h; s(); View e = e(i); View h = h(i); if ((acL.c ? acL.i - acL.b : acL.h) == 0 || e == null || h == null) { return 0; } return Math.min(this.c.h(), this.c.a(h) - this.c.c(e)); } @Override // androidx.recyclerview.widget.RecyclerView.tOB public final int b(RecyclerView.AcL acL) { i(acL); return i(acL); } @Override // androidx.recyclerview.widget.RecyclerView.tOB public final int c(RecyclerView.AcL acL) { return i(acL); } private int i(RecyclerView.AcL acL) { if (i_() == 0) { return 0; } int i = acL.c ? acL.i - acL.b : acL.h; View e = e(i); View h = h(i); if ((acL.c ? acL.i - acL.b : acL.h) != 0 && e != null && h != null) { int layoutPosition = ((RecyclerView.saX) e.getLayoutParams()).g.getLayoutPosition(); int layoutPosition2 = ((RecyclerView.saX) h.getLayoutParams()).g.getLayoutPosition(); int abs = Math.abs(this.c.a(h) - this.c.c(e)); int i2 = this.z.b[layoutPosition]; if (i2 != 0 && i2 != -1) { return Math.round((i2 * (abs / ((this.z.b[layoutPosition2] - i2) + 1))) + (this.c.i() - this.c.c(e))); } } return 0; } @Override // androidx.recyclerview.widget.RecyclerView.tOB public final int e(RecyclerView.AcL acL) { return h(acL); } @Override // androidx.recyclerview.widget.RecyclerView.tOB public final int a(RecyclerView.AcL acL) { return h(acL); } private int h(RecyclerView.AcL acL) { if (i_() == 0) { return 0; } int i = acL.c ? acL.i - acL.b : acL.h; View e = e(i); View h = h(i); if ((acL.c ? acL.i - acL.b : acL.h) == 0 || e == null || h == null) { return 0; } View c = c(0, i_()); int layoutPosition = c == null ? -1 : ((RecyclerView.saX) c.getLayoutParams()).g.getLayoutPosition(); return (int) ((Math.abs(this.c.a(h) - this.c.c(e)) / (((c(i_() - 1, -1) != null ? ((RecyclerView.saX) r4.getLayoutParams()).g.getLayoutPosition() : -1) - layoutPosition) + 1)) * (acL.c ? acL.i - acL.b : acL.h)); } private boolean e(View view, int i, int i2, RecyclerView.saX sax) { return (!view.isLayoutRequested() && p() && b(view.getWidth(), i, ((ViewGroup.LayoutParams) sax).width) && b(view.getHeight(), i2, ((ViewGroup.LayoutParams) sax).height)) ? false : true; } private static boolean b(int i, int i2, int i3) { int mode = View.MeasureSpec.getMode(i2); int size = View.MeasureSpec.getSize(i2); if (i3 > 0 && i != i3) { return false; } if (mode == Integer.MIN_VALUE) { return size >= i; } if (mode != 0) { return mode == 1073741824 && size == i; } return true; } private View c(int i, int i2) { int i3 = i2 > i ? 1 : -1; while (i != i2) { View f = f(i); int paddingLeft = getPaddingLeft(); int paddingTop = getPaddingTop(); int paddingRight = this.w - getPaddingRight(); int paddingBottom = this.l - getPaddingBottom(); int left = (f.getLeft() - ((RecyclerView.saX) f.getLayoutParams()).d.left) - ((ViewGroup.MarginLayoutParams) ((RecyclerView.saX) f.getLayoutParams())).leftMargin; int top = (f.getTop() - ((RecyclerView.saX) f.getLayoutParams()).d.top) - ((ViewGroup.MarginLayoutParams) ((RecyclerView.saX) f.getLayoutParams())).topMargin; int right = f.getRight() + ((RecyclerView.saX) f.getLayoutParams()).d.right + ((ViewGroup.MarginLayoutParams) ((RecyclerView.saX) f.getLayoutParams())).rightMargin; int bottom = f.getBottom() + ((RecyclerView.saX) f.getLayoutParams()).d.bottom + ((ViewGroup.MarginLayoutParams) ((RecyclerView.saX) f.getLayoutParams())).bottomMargin; boolean z = left >= paddingRight || right >= paddingLeft; boolean z2 = top >= paddingBottom || bottom >= paddingTop; if (z && z2) { return f; } i += i3; } return null; } /* loaded from: classes.dex */ public static class Sts extends RecyclerView.saX implements rqd { public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { // from class: com.google.android.flexbox.FlexboxLayoutManager.Sts.1 @Override // android.os.Parcelable.Creator public final /* synthetic */ Sts createFromParcel(Parcel parcel) { return new Sts(parcel); } @Override // android.os.Parcelable.Creator public final /* bridge */ /* synthetic */ Sts[] newArray(int i) { return new Sts[i]; } }; private int a; private float c; private float f; private int h; private int i; private float j; private int k; private boolean n; /* renamed from: o, reason: collision with root package name */ private int f6463o; @Override // android.os.Parcelable public final int describeContents() { return 0; } @Override // o.rqd public final int m() { return 1; } @Override // o.rqd public final int l() { return ((ViewGroup.LayoutParams) this).width; } @Override // o.rqd public final int d() { return ((ViewGroup.LayoutParams) this).height; } @Override // o.rqd public final int f() { return ((ViewGroup.MarginLayoutParams) this).leftMargin; } @Override // o.rqd public final int i() { return ((ViewGroup.MarginLayoutParams) this).topMargin; } @Override // o.rqd public final int h() { return ((ViewGroup.MarginLayoutParams) this).rightMargin; } @Override // o.rqd public final int g() { return ((ViewGroup.MarginLayoutParams) this).bottomMargin; } public Sts(Context context, AttributeSet attributeSet) { super(context, attributeSet); this.f = BitmapDescriptorFactory.HUE_RED; this.j = 1.0f; this.a = -1; this.c = -1.0f; this.h = 16777215; this.i = 16777215; } public Sts() { super(-2, -2); this.f = BitmapDescriptorFactory.HUE_RED; this.j = 1.0f; this.a = -1; this.c = -1.0f; this.h = 16777215; this.i = 16777215; } @Override // android.os.Parcelable public final void writeToParcel(Parcel parcel, int i) { parcel.writeFloat(this.f); parcel.writeFloat(this.j); parcel.writeInt(this.a); parcel.writeFloat(this.c); parcel.writeInt(this.k); parcel.writeInt(this.f6463o); parcel.writeInt(this.h); parcel.writeInt(this.i); parcel.writeByte(this.n ? (byte) 1 : (byte) 0); parcel.writeInt(((ViewGroup.MarginLayoutParams) this).bottomMargin); parcel.writeInt(((ViewGroup.MarginLayoutParams) this).leftMargin); parcel.writeInt(((ViewGroup.MarginLayoutParams) this).rightMargin); parcel.writeInt(((ViewGroup.MarginLayoutParams) this).topMargin); parcel.writeInt(((ViewGroup.LayoutParams) this).height); parcel.writeInt(((ViewGroup.LayoutParams) this).width); } protected Sts(Parcel parcel) { super(-2, -2); this.f = BitmapDescriptorFactory.HUE_RED; this.j = 1.0f; this.a = -1; this.c = -1.0f; this.h = 16777215; this.i = 16777215; this.f = parcel.readFloat(); this.j = parcel.readFloat(); this.a = parcel.readInt(); this.c = parcel.readFloat(); this.k = parcel.readInt(); this.f6463o = parcel.readInt(); this.h = parcel.readInt(); this.i = parcel.readInt(); this.n = parcel.readByte() != 0; ((ViewGroup.MarginLayoutParams) this).bottomMargin = parcel.readInt(); ((ViewGroup.MarginLayoutParams) this).leftMargin = parcel.readInt(); ((ViewGroup.MarginLayoutParams) this).rightMargin = parcel.readInt(); ((ViewGroup.MarginLayoutParams) this).topMargin = parcel.readInt(); ((ViewGroup.LayoutParams) this).height = parcel.readInt(); ((ViewGroup.LayoutParams) this).width = parcel.readInt(); } @Override // o.rqd public final boolean p() { return this.n; } @Override // o.rqd public final int o() { return this.k; } @Override // o.rqd public final int k() { return this.f6463o; } @Override // o.rqd public final int n() { return this.h; } @Override // o.rqd public final int j() { return this.i; } @Override // o.rqd public final float e() { return this.j; } @Override // o.rqd public final float b() { return this.f; } @Override // o.rqd public final float c() { return this.c; } @Override // o.rqd public final int a() { return this.a; } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes.dex */ public class RVV { boolean a; int b; int c; int d; boolean e; int g; final FlexboxLayoutManager h; boolean j; private RVV(FlexboxLayoutManager flexboxLayoutManager) { this.h = flexboxLayoutManager; this.b = 0; } /* synthetic */ RVV(FlexboxLayoutManager flexboxLayoutManager, byte b) { this(flexboxLayoutManager); } public final String toString() { StringBuilder sb = new StringBuilder("AnchorInfo{mPosition="); sb.append(this.g); sb.append(", mFlexLinePosition="); sb.append(this.c); sb.append(", mCoordinate="); sb.append(this.d); sb.append(", mPerpendicularCoordinate="); sb.append(this.b); sb.append(", mLayoutFromEnd="); sb.append(this.e); sb.append(", mValid="); sb.append(this.j); sb.append(", mAssignedFromSavedState="); sb.append(this.a); sb.append(UrlTreeKt.componentParamSuffixChar); return sb.toString(); } final void d() { int i; int i2; int i3 = this.h.e; if (i3 == 0 || i3 == 1 || !this.h.d) { if (this.e) { i = this.h.c.d(); } else { i = this.h.c.i(); } this.d = i; return; } if (this.e) { i2 = this.h.c.d(); } else { i2 = this.h.w - this.h.c.i(); } this.d = i2; } final void c() { this.g = -1; this.c = -1; this.d = PKIFailureInfo.systemUnavail; this.j = false; this.a = false; int i = this.h.e; if (i == 0 || i == 1) { if (this.h.b == 0) { this.e = this.h.e == 1; return; } else { this.e = this.h.b == 2; return; } } if (this.h.b == 0) { this.e = this.h.e == 3; } else { this.e = this.h.b == 2; } } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes.dex */ public static class HBt { int a; int b; boolean c; int d; int e; int f; boolean g; int h; int i; int j; private HBt() { this.e = 1; this.h = 1; } /* synthetic */ HBt(byte b) { this(); } public final String toString() { StringBuilder sb = new StringBuilder("LayoutState{mAvailable="); sb.append(this.b); sb.append(", mFlexLinePosition="); sb.append(this.a); sb.append(", mPosition="); sb.append(this.i); sb.append(", mOffset="); sb.append(this.j); sb.append(", mScrollingOffset="); sb.append(this.f); sb.append(", mLastScrollDelta="); sb.append(this.d); sb.append(", mItemDirection="); sb.append(this.e); sb.append(", mLayoutDirection="); sb.append(this.h); sb.append(UrlTreeKt.componentParamSuffixChar); return sb.toString(); } } /* loaded from: classes.dex */ static class LWm implements Parcelable { public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { // from class: com.google.android.flexbox.FlexboxLayoutManager.LWm.1 @Override // android.os.Parcelable.Creator public final /* synthetic */ LWm createFromParcel(Parcel parcel) { return new LWm(parcel, (byte) 0); } @Override // android.os.Parcelable.Creator public final /* bridge */ /* synthetic */ LWm[] newArray(int i) { return new LWm[i]; } }; int a; int c; @Override // android.os.Parcelable public final int describeContents() { return 0; } /* synthetic */ LWm(Parcel parcel, byte b) { this(parcel); } /* synthetic */ LWm(LWm lWm, byte b) { this(lWm); } @Override // android.os.Parcelable public final void writeToParcel(Parcel parcel, int i) { parcel.writeInt(this.c); parcel.writeInt(this.a); } LWm() { } private LWm(Parcel parcel) { this.c = parcel.readInt(); this.a = parcel.readInt(); } private LWm(LWm lWm) { this.c = lWm.c; this.a = lWm.a; } public final String toString() { StringBuilder sb = new StringBuilder("SavedState{mAnchorPosition="); sb.append(this.c); sb.append(", mAnchorOffset="); sb.append(this.a); sb.append(UrlTreeKt.componentParamSuffixChar); return sb.toString(); } } private boolean a(View view, int i) { int i2 = this.e; return ((i2 == 0 || i2 == 1) || !this.d) ? this.c.c(view) >= this.c.c() - i : this.c.a(view) <= i; } private boolean e(View view, int i) { int i2 = this.e; return ((i2 == 0 || i2 == 1) || !this.d) ? this.c.a(view) <= i : this.c.c() - this.c.c(view) <= i; } private void s() { if (this.c != null) { return; } int i = this.e; if (i == 0 || i == 1) { if (this.b == 0) { this.c = new MSs.AnonymousClass4(this); this.R = new MSs.AnonymousClass3(this); return; } else { this.c = new MSs.AnonymousClass3(this); this.R = new MSs.AnonymousClass4(this); return; } } if (this.b == 0) { this.c = new MSs.AnonymousClass3(this); this.R = new MSs.AnonymousClass4(this); } else { this.c = new MSs.AnonymousClass4(this); this.R = new MSs.AnonymousClass3(this); } } private View e(View view, C3223atU c3223atU) { int i = this.e; boolean z = i == 0 || i == 1; int i2 = c3223atU.h; for (int i3 = 1; i3 < i2; i3++) { View f = f(i3); if (f != null && f.getVisibility() != 8) { if (this.d && !z) { if (this.c.a(view) >= this.c.a(f)) { } view = f; } else { if (this.c.c(view) <= this.c.c(f)) { } view = f; } } } return view; } private View b(View view, C3223atU c3223atU) { int i = this.e; boolean z = i == 0 || i == 1; int i_ = i_(); int i2 = c3223atU.h; for (int i_2 = i_() - 2; i_2 > (i_ - i2) - 1; i_2--) { View f = f(i_2); if (f != null && f.getVisibility() != 8) { if (this.d && !z) { if (this.c.c(view) <= this.c.c(f)) { } view = f; } else { if (this.c.a(view) >= this.c.a(f)) { } view = f; } } } return view; } private int b(int i, RecyclerView.huo huoVar, RecyclerView.AcL acL, boolean z) { int i2; int d; int i3 = this.e; if (i3 != 0 && i3 != 1 && this.d) { int i4 = i - this.c.i(); if (i4 <= 0) { return 0; } i2 = d(i4, huoVar, acL); } else { int d2 = this.c.d() - i; if (d2 <= 0) { return 0; } i2 = -d(-d2, huoVar, acL); } if (!z || (d = this.c.d() - (i + i2)) <= 0) { return i2; } this.c.c(d); return d + i2; } private int a(int i, RecyclerView.huo huoVar, RecyclerView.AcL acL, boolean z) { int i2; int i3; int i4 = this.e; if (i4 != 0 && i4 != 1 && this.d) { int d = this.c.d() - i; if (d <= 0) { return 0; } i2 = d(-d, huoVar, acL); } else { int i5 = i - this.c.i(); if (i5 <= 0) { return 0; } i2 = -d(i5, huoVar, acL); } if (!z || (i3 = (i + i2) - this.c.i()) <= 0) { return i2; } this.c.c(-i3); return i2 - i3; } private void w() { int i; int i2 = this.e; boolean z = true; if (i2 == 0 || i2 == 1) { i = this.m; } else { i = this.x; } HBt hBt = this.I; if (i != 0 && i != Integer.MIN_VALUE) { z = false; } hBt.c = z; } @Override // androidx.recyclerview.widget.RecyclerView.tOB public final boolean d() { int i = this.e; return !(i == 0 || i == 1) || this.w > this.G.getWidth(); } @Override // androidx.recyclerview.widget.RecyclerView.tOB public final boolean c() { int i = this.e; return i == 0 || i == 1 || this.l > this.G.getHeight(); } @Override // o.DNa public final int c(int i, int i2, int i3) { return d(this.l, this.m, i2, i3, c()); } @Override // o.DNa public final int e(int i, int i2, int i3) { return d(this.w, this.x, i2, i3, d()); } @Override // o.DNa public final int d(View view) { int i; int i2; int i3 = this.e; if (i3 == 0 || i3 == 1) { i = ((RecyclerView.saX) view.getLayoutParams()).d.top; i2 = ((RecyclerView.saX) view.getLayoutParams()).d.bottom; } else { i = ((RecyclerView.saX) view.getLayoutParams()).d.left; i2 = ((RecyclerView.saX) view.getLayoutParams()).d.right; } return i + i2; } @Override // o.DNa public final int e(View view, int i, int i2) { int i3; int i4; int i5 = this.e; if (i5 != 0 && i5 != 1) { i3 = ((RecyclerView.saX) view.getLayoutParams()).d.top; i4 = ((RecyclerView.saX) view.getLayoutParams()).d.bottom; } else { i3 = ((RecyclerView.saX) view.getLayoutParams()).d.left; i4 = ((RecyclerView.saX) view.getLayoutParams()).d.right; } return i3 + i4; } @Override // o.DNa public final int j() { RecyclerView.AcL acL = this.K; return acL.c ? acL.i - acL.b : acL.h; } /* JADX WARN: Code restructure failed: missing block: B:235:0x005f, code lost: if (r18.b == 2) goto L42; */ /* JADX WARN: Code restructure failed: missing block: B:236:0x006f, code lost: r4 = false; */ /* JADX WARN: Code restructure failed: missing block: B:238:0x006d, code lost: r4 = true; */ /* JADX WARN: Code restructure failed: missing block: B:243:0x006b, code lost: if (r18.b == 2) goto L42; */ /* JADX WARN: Removed duplicated region for block: B:100:0x02f7 */ /* JADX WARN: Removed duplicated region for block: B:103:0x00c1 */ /* JADX WARN: Removed duplicated region for block: B:106:0x00c7 */ /* JADX WARN: Removed duplicated region for block: B:162:0x01d5 */ /* JADX WARN: Removed duplicated region for block: B:19:0x0079 */ /* JADX WARN: Removed duplicated region for block: B:22:0x0097 */ /* JADX WARN: Removed duplicated region for block: B:28:0x00ac */ /* JADX WARN: Removed duplicated region for block: B:34:0x02f1 */ /* JADX WARN: Removed duplicated region for block: B:37:0x0314 A[ADDED_TO_REGION] */ /* JADX WARN: Removed duplicated region for block: B:40:0x031c */ /* JADX WARN: Removed duplicated region for block: B:49:0x0368 */ /* JADX WARN: Removed duplicated region for block: B:62:0x047c */ /* JADX WARN: Removed duplicated region for block: B:65:0x04b1 */ /* JADX WARN: Removed duplicated region for block: B:71:? A[RETURN, SYNTHETIC] */ /* JADX WARN: Removed duplicated region for block: B:72:0x0494 */ /* JADX WARN: Removed duplicated region for block: B:74:0x03d9 */ /* JADX WARN: Removed duplicated region for block: B:77:0x03f0 A[ADDED_TO_REGION] */ /* JADX WARN: Removed duplicated region for block: B:85:0x0435 */ /* JADX WARN: Removed duplicated region for block: B:86:0x0451 */ /* JADX WARN: Removed duplicated region for block: B:87:0x03e2 */ /* JADX WARN: Removed duplicated region for block: B:90:0x033d */ @Override // androidx.recyclerview.widget.RecyclerView.tOB /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public final void e(androidx.recyclerview.widget.RecyclerView.huo r19, androidx.recyclerview.widget.RecyclerView.AcL r20) { /* Method dump skipped, instructions count: 1225 To view this dump add '--comments-level debug' option */ throw new UnsupportedOperationException("Method not decompiled: com.google.android.flexbox.FlexboxLayoutManager.e(androidx.recyclerview.widget.RecyclerView$huo, androidx.recyclerview.widget.RecyclerView$AcL):void"); } @Override // androidx.recyclerview.widget.RecyclerView.tOB public final int b(int i, RecyclerView.huo huoVar, RecyclerView.AcL acL) { int i2 = this.e; if (i2 != 0 && i2 != 1) { int d = d(i, huoVar, acL); this.Q.clear(); return d; } int l = l(i); this.f.b += l; this.R.c(-l); return l; } @Override // androidx.recyclerview.widget.RecyclerView.tOB public final void b(int i) { this.N = i; this.J = PKIFailureInfo.systemUnavail; LWm lWm = this.H; if (lWm != null) { lWm.c = -1; } RecyclerView recyclerView = this.s; if (recyclerView != null) { recyclerView.requestLayout(); } } @Override // androidx.recyclerview.widget.RecyclerView.tOB public final int c(int i, RecyclerView.huo huoVar, RecyclerView.AcL acL) { int i2 = this.e; if (i2 == 0 || i2 == 1) { int d = d(i, huoVar, acL); this.Q.clear(); return d; } int l = l(i); this.f.b += l; this.R.c(-l); return l; } private void m(int i) { View c = c(0, i_()); int layoutPosition = c == null ? -1 : ((RecyclerView.saX) c.getLayoutParams()).g.getLayoutPosition(); View c2 = c(i_() - 1, -1); int layoutPosition2 = c2 != null ? ((RecyclerView.saX) c2.getLayoutParams()).g.getLayoutPosition() : -1; if (i >= layoutPosition2) { return; } int i_ = i_(); this.z.c(i_); this.z.d(i_); this.z.a(i_); if (i >= this.z.b.length) { return; } this.g = i; View f = f(0); if (f == null) { return; } if (layoutPosition > i || i > layoutPosition2) { this.N = ((RecyclerView.saX) f.getLayoutParams()).g.getLayoutPosition(); int i2 = this.e; if (i2 != 0 && i2 != 1 && this.d) { this.J = this.c.a(f) + this.c.b(); } else { this.J = this.c.c(f) - this.c.i(); } } } private int c(RecyclerView.huo huoVar, RecyclerView.AcL acL, HBt hBt) { int i; int i2; int i3; boolean z; int i4; int i5; int i6; Sts sts; int i7; boolean z2; int i8; int i9; int i10; RecyclerView.AcL acL2 = acL; int i11 = -1; if (hBt.f != Integer.MIN_VALUE) { if (hBt.b < 0) { hBt.f += hBt.b; } if (hBt.g) { if (hBt.h == -1) { a(huoVar, hBt); } else { e(huoVar, hBt); } } } int i12 = hBt.b; int i13 = hBt.b; int i14 = this.e; int i15 = 1; boolean z3 = i14 == 0 || i14 == 1; int i16 = 0; while (true) { if (i13 <= 0 && !this.I.c) { break; } List list = this.h; int i17 = hBt.i; if (i17 >= 0) { if (i17 >= (acL2.c ? acL2.i - acL2.b : acL2.h) || (i = hBt.a) < 0 || i >= list.size()) { break; } C3223atU c3223atU = this.h.get(hBt.a); hBt.i = c3223atU.e; int i18 = this.e; if (i18 == 0 || i18 == i15) { i2 = i12; i3 = i13; z = z3; int paddingLeft = getPaddingLeft(); int paddingRight = getPaddingRight(); int i19 = this.w; int i20 = hBt.j; if (hBt.h == -1) { i20 -= c3223atU.b; } int i21 = hBt.i; float f = paddingLeft - this.f.b; float f2 = (i19 - paddingRight) - this.f.b; float max = Math.max(BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED); int i22 = c3223atU.h; int i23 = i21; int i24 = 0; while (i23 < i21 + i22) { View view = this.Q.get(i23); if (view == null) { view = this.M.d(i23); } if (view != null) { if (hBt.h == 1) { Rect rect = a; RecyclerView recyclerView = this.s; if (recyclerView == null) { i6 = i21; rect.set(0, 0, 0, 0); } else { i6 = i21; rect.set(recyclerView.Ab_(view)); } a_(view); } else { i6 = i21; Rect rect2 = a; RecyclerView recyclerView2 = this.s; if (recyclerView2 == null) { rect2.set(0, 0, 0, 0); } else { rect2.set(recyclerView2.Ab_(view)); } d(view, i24); i24++; } int i25 = i24; long j = this.z.e[i23]; int i26 = (int) j; int i27 = (int) (j >> 32); Sts sts2 = (Sts) view.getLayoutParams(); if (e(view, i26, i27, sts2)) { view.measure(i26, i27); } float f3 = f + ((ViewGroup.MarginLayoutParams) sts2).leftMargin + ((RecyclerView.saX) view.getLayoutParams()).d.left; float f4 = f2 - (((ViewGroup.MarginLayoutParams) sts2).rightMargin + ((RecyclerView.saX) view.getLayoutParams()).d.right); int i28 = i20 + ((RecyclerView.saX) view.getLayoutParams()).d.top; if (this.d) { sts = sts2; this.z.d(view, c3223atU, Math.round(f4) - view.getMeasuredWidth(), i28, Math.round(f4), i28 + view.getMeasuredHeight()); } else { sts = sts2; this.z.d(view, c3223atU, Math.round(f3), i28, Math.round(f3) + view.getMeasuredWidth(), i28 + view.getMeasuredHeight()); } f = f3 + view.getMeasuredWidth() + ((ViewGroup.MarginLayoutParams) sts).rightMargin + ((RecyclerView.saX) view.getLayoutParams()).d.right + max; f2 = f4 - (((view.getMeasuredWidth() + ((ViewGroup.MarginLayoutParams) sts).leftMargin) + ((RecyclerView.saX) view.getLayoutParams()).d.left) + max); i24 = i25; } else { i6 = i21; } i23++; i21 = i6; } i4 = 1; hBt.a += this.I.h; i5 = c3223atU.b; } else { int paddingTop = getPaddingTop(); int paddingBottom = getPaddingBottom(); int i29 = this.l; int i30 = hBt.j; int i31 = hBt.j; if (hBt.h == i11) { i30 -= c3223atU.b; i31 += c3223atU.b; } int i32 = hBt.i; float f5 = paddingTop - this.f.b; float f6 = (i29 - paddingBottom) - this.f.b; float max2 = Math.max(BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED); int i33 = c3223atU.h; i2 = i12; int i34 = i32; int i35 = 0; while (i34 < i32 + i33) { View view2 = this.Q.get(i34); if (view2 == null) { view2 = this.M.d(i34); } if (view2 != null) { int i36 = i32; i7 = i13; z2 = z3; long j2 = this.z.e[i34]; int i37 = (int) j2; int i38 = (int) (j2 >> 32); Sts sts3 = (Sts) view2.getLayoutParams(); if (e(view2, i37, i38, sts3)) { view2.measure(i37, i38); } float f7 = ((ViewGroup.MarginLayoutParams) sts3).topMargin + ((RecyclerView.saX) view2.getLayoutParams()).d.top + f5; float f8 = f6 - (((ViewGroup.MarginLayoutParams) sts3).rightMargin + ((RecyclerView.saX) view2.getLayoutParams()).d.bottom); if (hBt.h == 1) { Rect rect3 = a; RecyclerView recyclerView3 = this.s; if (recyclerView3 == null) { i10 = i33; rect3.set(0, 0, 0, 0); } else { i10 = i33; rect3.set(recyclerView3.Ab_(view2)); } a_(view2); } else { i10 = i33; Rect rect4 = a; RecyclerView recyclerView4 = this.s; if (recyclerView4 == null) { rect4.set(0, 0, 0, 0); } else { rect4.set(recyclerView4.Ab_(view2)); } d(view2, i35); i35++; } int i39 = i30 + ((RecyclerView.saX) view2.getLayoutParams()).d.left; int i40 = i31 - ((RecyclerView.saX) view2.getLayoutParams()).d.right; boolean z4 = this.d; if (!z4) { i8 = i36; i9 = i10; if (this.C) { this.z.a(view2, c3223atU, z4, i39, Math.round(f8) - view2.getMeasuredHeight(), i39 + view2.getMeasuredWidth(), Math.round(f8)); } else { this.z.a(view2, c3223atU, z4, i39, Math.round(f7), i39 + view2.getMeasuredWidth(), Math.round(f7) + view2.getMeasuredHeight()); } } else if (this.C) { i8 = i36; i9 = i10; this.z.a(view2, c3223atU, z4, i40 - view2.getMeasuredWidth(), Math.round(f8) - view2.getMeasuredHeight(), i40, Math.round(f8)); } else { i8 = i36; i9 = i10; this.z.a(view2, c3223atU, z4, i40 - view2.getMeasuredWidth(), Math.round(f7), i40, Math.round(f7) + view2.getMeasuredHeight()); } f6 = f8 - (((view2.getMeasuredHeight() + ((ViewGroup.MarginLayoutParams) sts3).bottomMargin) + ((RecyclerView.saX) view2.getLayoutParams()).d.top) + max2); f5 = f7 + view2.getMeasuredHeight() + ((ViewGroup.MarginLayoutParams) sts3).topMargin + ((RecyclerView.saX) view2.getLayoutParams()).d.bottom + max2; } else { i7 = i13; z2 = z3; i8 = i32; i9 = i33; } i34++; z3 = z2; i13 = i7; i32 = i8; i33 = i9; } i3 = i13; z = z3; hBt.a += this.I.h; i5 = c3223atU.b; i4 = 1; } i16 += i5; if (!z && this.d) { hBt.j -= c3223atU.b * hBt.h; } else { hBt.j += c3223atU.b * hBt.h; } i13 = i3 - c3223atU.b; acL2 = acL; i15 = i4; i12 = i2; z3 = z; i11 = -1; } else { break; } } int i41 = i12; hBt.b -= i16; if (hBt.f != Integer.MIN_VALUE) { hBt.f += i16; if (hBt.b < 0) { hBt.f += hBt.b; } if (hBt.g) { if (hBt.h == -1) { a(huoVar, hBt); } else { e(huoVar, hBt); } } } return i41 - hBt.b; } private void a(RecyclerView.huo huoVar, HBt hBt) { if (hBt.f < 0) { return; } this.c.c(); int i = hBt.f; int i_ = i_(); if (i_ == 0) { return; } int i2 = i_ - 1; int i3 = this.z.b[((RecyclerView.saX) f(i2).getLayoutParams()).g.getLayoutPosition()]; if (i3 == -1) { return; } C3223atU c3223atU = this.h.get(i3); int i4 = i2; while (true) { if (i4 < 0) { break; } View f = f(i4); if (!a(f, hBt.f)) { break; } if (c3223atU.e == ((RecyclerView.saX) f.getLayoutParams()).g.getLayoutPosition()) { if (i3 <= 0) { i_ = i4; break; } else { i3 += hBt.h; c3223atU = this.h.get(i3); i_ = i4; } } i4--; } while (i2 >= i_) { e(i2, huoVar); i2--; } } private void e(RecyclerView.huo huoVar, HBt hBt) { int i_; if (hBt.f >= 0 && (i_ = i_()) != 0) { int i = 0; int i2 = this.z.b[((RecyclerView.saX) f(0).getLayoutParams()).g.getLayoutPosition()]; int i3 = -1; if (i2 == -1) { return; } C3223atU c3223atU = this.h.get(i2); while (i < i_) { View f = f(i); if (!e(f, hBt.f)) { break; } if (c3223atU.f == ((RecyclerView.saX) f.getLayoutParams()).g.getLayoutPosition()) { if (i2 >= this.h.size() - 1) { break; } i2 += hBt.h; c3223atU = this.h.get(i2); i3 = i; } i++; } i = i3; while (i >= 0) { e(i, huoVar); i--; } } } private void b(int i, int i2) { this.I.h = i; int i3 = this.e; boolean z = i3 == 0 || i3 == 1; int makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(this.w, this.x); int makeMeasureSpec2 = View.MeasureSpec.makeMeasureSpec(this.l, this.m); boolean z2 = !z && this.d; if (i == 1) { View f = f(i_() - 1); this.I.j = this.c.a(f); int layoutPosition = ((RecyclerView.saX) f.getLayoutParams()).g.getLayoutPosition(); View b = b(f, this.h.get(this.z.b[layoutPosition])); this.I.e = 1; HBt hBt = this.I; hBt.i = layoutPosition + hBt.e; if (this.z.b.length <= this.I.i) { this.I.a = -1; } else { this.I.a = this.z.b[this.I.i]; } if (z2) { this.I.j = this.c.c(b); this.I.f = (-this.c.c(b)) + this.c.i(); HBt hBt2 = this.I; hBt2.f = hBt2.f >= 0 ? this.I.f : 0; } else { this.I.j = this.c.a(b); this.I.f = this.c.a(b) - this.c.d(); } if (this.I.a == -1 || this.I.a > this.h.size() - 1) { int i4 = this.I.i; RecyclerView.AcL acL = this.K; if (i4 <= (acL.c ? acL.i - acL.b : acL.h)) { int i5 = i2 - this.I.f; EiS.RVV rvv = this.B; rvv.d = null; rvv.a = 0; if (i5 > 0) { if (z) { this.z.b(this.B, makeMeasureSpec, makeMeasureSpec2, i5, this.I.i, -1, this.h); } else { this.z.b(this.B, makeMeasureSpec2, makeMeasureSpec, i5, this.I.i, -1, this.h); } this.z.e(makeMeasureSpec, makeMeasureSpec2, this.I.i); this.z.b(this.I.i); } } } } else { View f2 = f(0); this.I.j = this.c.c(f2); int layoutPosition2 = ((RecyclerView.saX) f2.getLayoutParams()).g.getLayoutPosition(); View e = e(f2, this.h.get(this.z.b[layoutPosition2])); this.I.e = 1; int i6 = this.z.b[layoutPosition2]; if (i6 == -1) { i6 = 0; } if (i6 > 0) { this.I.i = layoutPosition2 - this.h.get(i6 - 1).h; } else { this.I.i = -1; } this.I.a = i6 > 0 ? i6 - 1 : 0; if (z2) { this.I.j = this.c.a(e); this.I.f = this.c.a(e) - this.c.d(); HBt hBt3 = this.I; hBt3.f = hBt3.f >= 0 ? this.I.f : 0; } else { this.I.j = this.c.c(e); this.I.f = (-this.c.c(e)) + this.c.i(); } } HBt hBt4 = this.I; hBt4.b = i2 - hBt4.f; } @Override // androidx.recyclerview.widget.RecyclerView.tOB public final void t() { for (int i_ = i_() - 1; i_ >= 0; i_--) { this.k.e(i_); } } private void n(int i) { if (this.e != i) { for (int i_ = i_() - 1; i_ >= 0; i_--) { this.k.e(i_); } this.e = i; this.c = null; this.R = null; this.h.clear(); this.f.c(); this.f.b = 0; RecyclerView recyclerView = this.s; if (recyclerView != null) { recyclerView.requestLayout(); } } } @Override // o.DNa public void setFlexLines(List list) { this.h = list; } @Override // o.DNa public final boolean l() { int i = this.e; return i == 0 || i == 1; } @Override // o.DNa public final int n() { return this.F; } @Override // o.DNa public final int g() { return this.b; } @Override // o.DNa public final List h() { return this.h; } @Override // o.DNa public final int i() { return this.e; } @Override // o.DNa public final int a() { return this.j; } }