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.annotation.NonNull; import androidx.recyclerview.widget.LinearSmoothScroller; import androidx.recyclerview.widget.OrientationHelper; import androidx.recyclerview.widget.RecyclerView; import c.i.a.e.c; import java.util.ArrayList; import java.util.List; public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements c.i.a.e.a, RecyclerView.SmoothScroller.ScrollVectorProvider { public static final Rect i = new Rect(); public int A = Integer.MIN_VALUE; public int B = Integer.MIN_VALUE; public SparseArray C = new SparseArray<>(); public final Context D; public View E; public int F = -1; public c.b G = new c.b(); public int j; public int k; public int l; public int m = -1; public boolean n; public boolean o; public List p = new ArrayList(); public final c.i.a.e.c q = new c.i.a.e.c(this); public RecyclerView.Recycler r; /* renamed from: s reason: collision with root package name */ public RecyclerView.State f2284s; public c t; public b u = new b(null); public OrientationHelper v; public OrientationHelper w; /* renamed from: x reason: collision with root package name */ public SavedState f2285x; /* renamed from: y reason: collision with root package name */ public int f2286y = -1; /* renamed from: z reason: collision with root package name */ public int f2287z = Integer.MIN_VALUE; public static class LayoutParams extends RecyclerView.LayoutParams implements FlexItem { public static final Parcelable.Creator CREATOR = new a(); public float i = 0.0f; public float j = 1.0f; public int k = -1; public float l = -1.0f; public int m; public int n; public int o = 16777215; public int p = 16777215; public boolean q; public static class a implements Parcelable.Creator { /* Return type fixed from 'java.lang.Object' to match base method */ @Override // android.os.Parcelable.Creator public LayoutParams createFromParcel(Parcel parcel) { return new LayoutParams(parcel); } /* Return type fixed from 'java.lang.Object[]' to match base method */ @Override // android.os.Parcelable.Creator public LayoutParams[] newArray(int i) { return new LayoutParams[i]; } } public LayoutParams(int i, int i2) { super(i, i2); } public LayoutParams(Context context, AttributeSet attributeSet) { super(context, attributeSet); } public LayoutParams(Parcel parcel) { super(-2, -2); this.i = parcel.readFloat(); this.j = parcel.readFloat(); this.k = parcel.readInt(); this.l = parcel.readFloat(); this.m = parcel.readInt(); this.n = parcel.readInt(); this.o = parcel.readInt(); this.p = parcel.readInt(); this.q = 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.MarginLayoutParams) this).height = parcel.readInt(); ((ViewGroup.MarginLayoutParams) this).width = parcel.readInt(); } @Override // com.google.android.flexbox.FlexItem public int C() { return this.m; } @Override // com.google.android.flexbox.FlexItem public void G(int i) { this.m = i; } @Override // com.google.android.flexbox.FlexItem public int H() { return ((ViewGroup.MarginLayoutParams) this).bottomMargin; } @Override // com.google.android.flexbox.FlexItem public int I() { return ((ViewGroup.MarginLayoutParams) this).leftMargin; } @Override // com.google.android.flexbox.FlexItem public int M() { return ((ViewGroup.MarginLayoutParams) this).topMargin; } @Override // com.google.android.flexbox.FlexItem public void N(int i) { this.n = i; } @Override // com.google.android.flexbox.FlexItem public float R() { return this.i; } @Override // com.google.android.flexbox.FlexItem public float V() { return this.l; } @Override // com.google.android.flexbox.FlexItem public int c0() { return ((ViewGroup.MarginLayoutParams) this).rightMargin; } @Override // android.os.Parcelable public int describeContents() { return 0; } @Override // com.google.android.flexbox.FlexItem public int e0() { return this.n; } @Override // com.google.android.flexbox.FlexItem public int getHeight() { return ((ViewGroup.MarginLayoutParams) this).height; } @Override // com.google.android.flexbox.FlexItem public int getOrder() { return 1; } @Override // com.google.android.flexbox.FlexItem public int getWidth() { return ((ViewGroup.MarginLayoutParams) this).width; } @Override // com.google.android.flexbox.FlexItem public boolean i0() { return this.q; } @Override // com.google.android.flexbox.FlexItem public int l0() { return this.p; } @Override // com.google.android.flexbox.FlexItem public int s0() { return this.o; } @Override // com.google.android.flexbox.FlexItem public int t() { return this.k; } @Override // com.google.android.flexbox.FlexItem public float w() { return this.j; } @Override // android.os.Parcelable public void writeToParcel(Parcel parcel, int i) { parcel.writeFloat(this.i); parcel.writeFloat(this.j); parcel.writeInt(this.k); parcel.writeFloat(this.l); parcel.writeInt(this.m); parcel.writeInt(this.n); parcel.writeInt(this.o); parcel.writeInt(this.p); parcel.writeByte(this.q ? (byte) 1 : 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.MarginLayoutParams) this).height); parcel.writeInt(((ViewGroup.MarginLayoutParams) this).width); } } public static class SavedState implements Parcelable { public static final Parcelable.Creator CREATOR = new a(); public int i; public int j; public static class a implements Parcelable.Creator { /* Return type fixed from 'java.lang.Object' to match base method */ @Override // android.os.Parcelable.Creator public SavedState createFromParcel(Parcel parcel) { return new SavedState(parcel, (a) null); } /* Return type fixed from 'java.lang.Object[]' to match base method */ @Override // android.os.Parcelable.Creator public SavedState[] newArray(int i) { return new SavedState[i]; } } public SavedState() { } public SavedState(Parcel parcel, a aVar) { this.i = parcel.readInt(); this.j = parcel.readInt(); } public SavedState(SavedState savedState, a aVar) { this.i = savedState.i; this.j = savedState.j; } @Override // android.os.Parcelable public int describeContents() { return 0; } @Override // java.lang.Object public String toString() { StringBuilder L = c.d.b.a.a.L("SavedState{mAnchorPosition="); L.append(this.i); L.append(", mAnchorOffset="); return c.d.b.a.a.w(L, this.j, '}'); } @Override // android.os.Parcelable public void writeToParcel(Parcel parcel, int i) { parcel.writeInt(this.i); parcel.writeInt(this.j); } } public class b { public int a; public int b; /* renamed from: c reason: collision with root package name */ public int f2288c; public int d = 0; public boolean e; public boolean f; public boolean g; public b(a aVar) { } public static void a(b bVar) { if (!FlexboxLayoutManager.this.i()) { FlexboxLayoutManager flexboxLayoutManager = FlexboxLayoutManager.this; if (flexboxLayoutManager.n) { bVar.f2288c = bVar.e ? flexboxLayoutManager.v.getEndAfterPadding() : flexboxLayoutManager.getWidth() - FlexboxLayoutManager.this.v.getStartAfterPadding(); return; } } bVar.f2288c = bVar.e ? FlexboxLayoutManager.this.v.getEndAfterPadding() : FlexboxLayoutManager.this.v.getStartAfterPadding(); } public static void b(b bVar) { bVar.a = -1; bVar.b = -1; bVar.f2288c = Integer.MIN_VALUE; boolean z2 = false; bVar.f = false; bVar.g = false; if (FlexboxLayoutManager.this.i()) { FlexboxLayoutManager flexboxLayoutManager = FlexboxLayoutManager.this; int i = flexboxLayoutManager.k; if (i == 0) { if (flexboxLayoutManager.j == 1) { z2 = true; } bVar.e = z2; return; } if (i == 2) { z2 = true; } bVar.e = z2; return; } FlexboxLayoutManager flexboxLayoutManager2 = FlexboxLayoutManager.this; int i2 = flexboxLayoutManager2.k; if (i2 == 0) { if (flexboxLayoutManager2.j == 3) { z2 = true; } bVar.e = z2; return; } if (i2 == 2) { z2 = true; } bVar.e = z2; } public String toString() { StringBuilder L = c.d.b.a.a.L("AnchorInfo{mPosition="); L.append(this.a); L.append(", mFlexLinePosition="); L.append(this.b); L.append(", mCoordinate="); L.append(this.f2288c); L.append(", mPerpendicularCoordinate="); L.append(this.d); L.append(", mLayoutFromEnd="); L.append(this.e); L.append(", mValid="); L.append(this.f); L.append(", mAssignedFromSavedState="); L.append(this.g); L.append('}'); return L.toString(); } } public static class c { public int a; public boolean b; /* renamed from: c reason: collision with root package name */ public int f2289c; public int d; public int e; public int f; public int g; public int h = 1; public int i = 1; public boolean j; public c(a aVar) { } public String toString() { StringBuilder L = c.d.b.a.a.L("LayoutState{mAvailable="); L.append(this.a); L.append(", mFlexLinePosition="); L.append(this.f2289c); L.append(", mPosition="); L.append(this.d); L.append(", mOffset="); L.append(this.e); L.append(", mScrollingOffset="); L.append(this.f); L.append(", mLastScrollDelta="); L.append(this.g); L.append(", mItemDirection="); L.append(this.h); L.append(", mLayoutDirection="); return c.d.b.a.a.w(L, this.i, '}'); } } public FlexboxLayoutManager(Context context, AttributeSet attributeSet, int i2, int i3) { RecyclerView.LayoutManager.Properties properties = RecyclerView.LayoutManager.getProperties(context, attributeSet, i2, i3); int i4 = properties.orientation; if (i4 != 0) { if (i4 == 1) { if (properties.reverseLayout) { x(3); } else { x(2); } } } else if (properties.reverseLayout) { x(1); } else { x(0); } int i5 = this.k; if (i5 != 1) { if (i5 == 0) { removeAllViews(); k(); } this.k = 1; this.v = null; this.w = null; requestLayout(); } if (this.l != 4) { removeAllViews(); k(); this.l = 4; requestLayout(); } setAutoMeasureEnabled(true); this.D = context; } public static boolean isMeasurementUpToDate(int i2, int i3, int i4) { int mode = View.MeasureSpec.getMode(i3); int size = View.MeasureSpec.getSize(i3); if (i4 > 0 && i2 != i4) { return false; } if (mode == Integer.MIN_VALUE) { return size >= i2; } if (mode != 0) { return mode == 1073741824 && size == i2; } return true; } private boolean shouldMeasureChild(View view, int i2, int i3, RecyclerView.LayoutParams layoutParams) { return view.isLayoutRequested() || !isMeasurementCacheEnabled() || !isMeasurementUpToDate(view.getWidth(), i2, ((ViewGroup.MarginLayoutParams) layoutParams).width) || !isMeasurementUpToDate(view.getHeight(), i3, ((ViewGroup.MarginLayoutParams) layoutParams).height); } public final void A(b bVar, boolean z2, boolean z3) { int i2; if (z3) { w(); } else { this.t.b = false; } if (i() || !this.n) { this.t.a = bVar.f2288c - this.v.getStartAfterPadding(); } else { this.t.a = (this.E.getWidth() - bVar.f2288c) - this.v.getStartAfterPadding(); } c cVar = this.t; cVar.d = bVar.a; cVar.h = 1; cVar.i = -1; cVar.e = bVar.f2288c; cVar.f = Integer.MIN_VALUE; int i3 = bVar.b; cVar.f2289c = i3; if (z2 && i3 > 0 && this.p.size() > (i2 = bVar.b)) { c cVar2 = this.t; cVar2.f2289c--; cVar2.d -= this.p.get(i2).h; } } @Override // c.i.a.e.a public void a(View view, int i2, int i3, c.i.a.e.b bVar) { calculateItemDecorationsForChild(view, i); if (i()) { int rightDecorationWidth = getRightDecorationWidth(view) + getLeftDecorationWidth(view); bVar.e += rightDecorationWidth; bVar.f += rightDecorationWidth; return; } int bottomDecorationHeight = getBottomDecorationHeight(view) + getTopDecorationHeight(view); bVar.e += bottomDecorationHeight; bVar.f += bottomDecorationHeight; } @Override // c.i.a.e.a public void b(c.i.a.e.b bVar) { } @Override // c.i.a.e.a public View c(int i2) { return f(i2); } @Override // androidx.recyclerview.widget.RecyclerView.LayoutManager public boolean canScrollHorizontally() { if (this.k == 0) { return i(); } if (i()) { int width = getWidth(); View view = this.E; if (width <= (view != null ? view.getWidth() : 0)) { return false; } } return true; } @Override // androidx.recyclerview.widget.RecyclerView.LayoutManager public boolean canScrollVertically() { if (this.k == 0) { return !i(); } if (i()) { return true; } int height = getHeight(); View view = this.E; return height > (view != null ? view.getHeight() : 0); } @Override // androidx.recyclerview.widget.RecyclerView.LayoutManager public boolean checkLayoutParams(RecyclerView.LayoutParams layoutParams) { return layoutParams instanceof LayoutParams; } @Override // androidx.recyclerview.widget.RecyclerView.LayoutManager public int computeHorizontalScrollExtent(RecyclerView.State state) { return computeScrollExtent(state); } @Override // androidx.recyclerview.widget.RecyclerView.LayoutManager public int computeHorizontalScrollOffset(RecyclerView.State state) { return computeScrollOffset(state); } @Override // androidx.recyclerview.widget.RecyclerView.LayoutManager public int computeHorizontalScrollRange(RecyclerView.State state) { return computeScrollRange(state); } public final int computeScrollExtent(RecyclerView.State state) { if (getChildCount() == 0) { return 0; } int itemCount = state.getItemCount(); l(); View n = n(itemCount); View p = p(itemCount); if (state.getItemCount() == 0 || n == null || p == null) { return 0; } return Math.min(this.v.getTotalSpace(), this.v.getDecoratedEnd(p) - this.v.getDecoratedStart(n)); } public final int computeScrollOffset(RecyclerView.State state) { if (getChildCount() == 0) { return 0; } int itemCount = state.getItemCount(); View n = n(itemCount); View p = p(itemCount); if (!(state.getItemCount() == 0 || n == null || p == null)) { int position = getPosition(n); int position2 = getPosition(p); int abs = Math.abs(this.v.getDecoratedEnd(p) - this.v.getDecoratedStart(n)); int[] iArr = this.q.f1018c; int i2 = iArr[position]; if (!(i2 == 0 || i2 == -1)) { return Math.round((((float) i2) * (((float) abs) / ((float) ((iArr[position2] - i2) + 1)))) + ((float) (this.v.getStartAfterPadding() - this.v.getDecoratedStart(n)))); } } return 0; } public final int computeScrollRange(RecyclerView.State state) { if (getChildCount() == 0) { return 0; } int itemCount = state.getItemCount(); View n = n(itemCount); View p = p(itemCount); if (state.getItemCount() == 0 || n == null || p == null) { return 0; } View r = r(0, getChildCount(), false); return (int) ((((float) Math.abs(this.v.getDecoratedEnd(p) - this.v.getDecoratedStart(n))) / ((float) ((findLastVisibleItemPosition() - (r == null ? -1 : getPosition(r))) + 1))) * ((float) state.getItemCount())); } @Override // androidx.recyclerview.widget.RecyclerView.SmoothScroller.ScrollVectorProvider public PointF computeScrollVectorForPosition(int i2) { if (getChildCount() == 0) { return null; } int i3 = i2 < getPosition(getChildAt(0)) ? -1 : 1; return i() ? new PointF(0.0f, (float) i3) : new PointF((float) i3, 0.0f); } @Override // androidx.recyclerview.widget.RecyclerView.LayoutManager public int computeVerticalScrollExtent(RecyclerView.State state) { return computeScrollExtent(state); } @Override // androidx.recyclerview.widget.RecyclerView.LayoutManager public int computeVerticalScrollOffset(RecyclerView.State state) { return computeScrollOffset(state); } @Override // androidx.recyclerview.widget.RecyclerView.LayoutManager public int computeVerticalScrollRange(RecyclerView.State state) { return computeScrollRange(state); } @Override // c.i.a.e.a public int d(int i2, int i3, int i4) { return RecyclerView.LayoutManager.getChildMeasureSpec(getWidth(), getWidthMode(), i3, i4, canScrollHorizontally()); } @Override // c.i.a.e.a public void e(int i2, View view) { this.C.put(i2, view); } @Override // c.i.a.e.a public View f(int i2) { View view = this.C.get(i2); return view != null ? view : this.r.getViewForPosition(i2); } public int findLastVisibleItemPosition() { View r = r(getChildCount() - 1, -1, false); if (r == null) { return -1; } return getPosition(r); } public final int fixLayoutEndGap(int i2, RecyclerView.Recycler recycler, RecyclerView.State state, boolean z2) { int i3; int endAfterPadding; if (!i() && this.n) { int startAfterPadding = i2 - this.v.getStartAfterPadding(); if (startAfterPadding <= 0) { return 0; } i3 = t(startAfterPadding, recycler, state); } else { int endAfterPadding2 = this.v.getEndAfterPadding() - i2; if (endAfterPadding2 <= 0) { return 0; } i3 = -t(-endAfterPadding2, recycler, state); } int i4 = i2 + i3; if (!z2 || (endAfterPadding = this.v.getEndAfterPadding() - i4) <= 0) { return i3; } this.v.offsetChildren(endAfterPadding); return endAfterPadding + i3; } public final int fixLayoutStartGap(int i2, RecyclerView.Recycler recycler, RecyclerView.State state, boolean z2) { int i3; int startAfterPadding; if (i() || !this.n) { int startAfterPadding2 = i2 - this.v.getStartAfterPadding(); if (startAfterPadding2 <= 0) { return 0; } i3 = -t(startAfterPadding2, recycler, state); } else { int endAfterPadding = this.v.getEndAfterPadding() - i2; if (endAfterPadding <= 0) { return 0; } i3 = t(-endAfterPadding, recycler, state); } int i4 = i2 + i3; if (!z2 || (startAfterPadding = i4 - this.v.getStartAfterPadding()) <= 0) { return i3; } this.v.offsetChildren(-startAfterPadding); return i3 - startAfterPadding; } @Override // c.i.a.e.a public int g(View view, int i2, int i3) { int topDecorationHeight; int bottomDecorationHeight; if (i()) { topDecorationHeight = getLeftDecorationWidth(view); bottomDecorationHeight = getRightDecorationWidth(view); } else { topDecorationHeight = getTopDecorationHeight(view); bottomDecorationHeight = getBottomDecorationHeight(view); } return bottomDecorationHeight + topDecorationHeight; } @Override // androidx.recyclerview.widget.RecyclerView.LayoutManager public RecyclerView.LayoutParams generateDefaultLayoutParams() { return new LayoutParams(-2, -2); } @Override // androidx.recyclerview.widget.RecyclerView.LayoutManager public RecyclerView.LayoutParams generateLayoutParams(Context context, AttributeSet attributeSet) { return new LayoutParams(context, attributeSet); } @Override // c.i.a.e.a public int getAlignContent() { return 5; } @Override // c.i.a.e.a public int getAlignItems() { return this.l; } @Override // c.i.a.e.a public int getFlexDirection() { return this.j; } @Override // c.i.a.e.a public int getFlexItemCount() { return this.f2284s.getItemCount(); } @Override // c.i.a.e.a public List getFlexLinesInternal() { return this.p; } @Override // c.i.a.e.a public int getFlexWrap() { return this.k; } @Override // c.i.a.e.a public int getLargestMainSize() { if (this.p.size() == 0) { return 0; } int i2 = Integer.MIN_VALUE; int size = this.p.size(); for (int i3 = 0; i3 < size; i3++) { i2 = Math.max(i2, this.p.get(i3).e); } return i2; } @Override // c.i.a.e.a public int getMaxLine() { return this.m; } @Override // c.i.a.e.a public int getSumOfCrossSize() { int size = this.p.size(); int i2 = 0; for (int i3 = 0; i3 < size; i3++) { i2 += this.p.get(i3).g; } return i2; } @Override // c.i.a.e.a public int h(int i2, int i3, int i4) { return RecyclerView.LayoutManager.getChildMeasureSpec(getHeight(), getHeightMode(), i3, i4, canScrollVertically()); } @Override // c.i.a.e.a public boolean i() { int i2 = this.j; return i2 == 0 || i2 == 1; } @Override // c.i.a.e.a public int j(View view) { int i2; int i3; if (i()) { i3 = getTopDecorationHeight(view); i2 = getBottomDecorationHeight(view); } else { i3 = getLeftDecorationWidth(view); i2 = getRightDecorationWidth(view); } return i2 + i3; } public final void k() { this.p.clear(); b.b(this.u); this.u.d = 0; } public final void l() { if (this.v == null) { if (i()) { if (this.k == 0) { this.v = OrientationHelper.createHorizontalHelper(this); this.w = OrientationHelper.createVerticalHelper(this); return; } this.v = OrientationHelper.createVerticalHelper(this); this.w = OrientationHelper.createHorizontalHelper(this); } else if (this.k == 0) { this.v = OrientationHelper.createVerticalHelper(this); this.w = OrientationHelper.createHorizontalHelper(this); } else { this.v = OrientationHelper.createHorizontalHelper(this); this.w = OrientationHelper.createVerticalHelper(this); } } } public final int m(RecyclerView.Recycler recycler, RecyclerView.State state, c cVar) { int i2; int i3; int i4; int i5; int i6; int i7; int i8; int i9; int i10; int i11; int i12; int i13; int i14; int i15; int i16; int i17 = cVar.f; if (i17 != Integer.MIN_VALUE) { int i18 = cVar.a; if (i18 < 0) { cVar.f = i17 + i18; } v(recycler, cVar); } int i19 = cVar.a; boolean i20 = i(); int i21 = i19; int i22 = 0; while (true) { if (i21 <= 0 && !this.t.b) { break; } List list = this.p; int i23 = cVar.d; if (!(i23 >= 0 && i23 < state.getItemCount() && (i16 = cVar.f2289c) >= 0 && i16 < list.size())) { break; } c.i.a.e.b bVar = this.p.get(cVar.f2289c); cVar.d = bVar.o; if (i()) { int paddingLeft = getPaddingLeft(); int paddingRight = getPaddingRight(); int width = getWidth(); int i24 = cVar.e; if (cVar.i == -1) { i24 -= bVar.g; } int i25 = cVar.d; float f = (float) this.u.d; float f2 = ((float) paddingLeft) - f; float f3 = ((float) (width - paddingRight)) - f; float max = Math.max(0.0f, 0.0f); int i26 = bVar.h; int i27 = i25; int i28 = 0; while (i27 < i25 + i26) { View f4 = f(i27); if (f4 == null) { i14 = i19; i15 = i25; i13 = i27; i12 = i26; } else { i15 = i25; if (cVar.i == 1) { calculateItemDecorationsForChild(f4, i); addView(f4); } else { calculateItemDecorationsForChild(f4, i); addView(f4, i28); i28++; } c.i.a.e.c cVar2 = this.q; i14 = i19; long j = cVar2.d[i27]; int i29 = (int) j; int m = cVar2.m(j); LayoutParams layoutParams = (LayoutParams) f4.getLayoutParams(); if (shouldMeasureChild(f4, i29, m, layoutParams)) { f4.measure(i29, m); } float leftDecorationWidth = f2 + ((float) (getLeftDecorationWidth(f4) + ((ViewGroup.MarginLayoutParams) layoutParams).leftMargin)); float rightDecorationWidth = f3 - ((float) (getRightDecorationWidth(f4) + ((ViewGroup.MarginLayoutParams) layoutParams).rightMargin)); int topDecorationHeight = getTopDecorationHeight(f4) + i24; if (this.n) { i13 = i27; i12 = i26; this.q.u(f4, bVar, Math.round(rightDecorationWidth) - f4.getMeasuredWidth(), topDecorationHeight, Math.round(rightDecorationWidth), f4.getMeasuredHeight() + topDecorationHeight); } else { i13 = i27; i12 = i26; this.q.u(f4, bVar, Math.round(leftDecorationWidth), topDecorationHeight, f4.getMeasuredWidth() + Math.round(leftDecorationWidth), f4.getMeasuredHeight() + topDecorationHeight); } float rightDecorationWidth2 = ((float) (getRightDecorationWidth(f4) + f4.getMeasuredWidth() + ((ViewGroup.MarginLayoutParams) layoutParams).rightMargin)) + max + leftDecorationWidth; f3 = rightDecorationWidth - (((float) (getLeftDecorationWidth(f4) + (f4.getMeasuredWidth() + ((ViewGroup.MarginLayoutParams) layoutParams).leftMargin))) + max); f2 = rightDecorationWidth2; i28 = i28; } i27 = i13 + 1; i25 = i15; i19 = i14; i26 = i12; } i3 = i19; cVar.f2289c += this.t.i; i5 = bVar.g; i4 = i21; i2 = i22; } else { i3 = i19; int paddingTop = getPaddingTop(); int paddingBottom = getPaddingBottom(); int height = getHeight(); int i30 = cVar.e; if (cVar.i == -1) { int i31 = bVar.g; int i32 = i30 - i31; i6 = i30 + i31; i30 = i32; } else { i6 = i30; } int i33 = cVar.d; float f5 = (float) (height - paddingBottom); float f6 = (float) this.u.d; float f7 = ((float) paddingTop) - f6; float f8 = f5 - f6; float max2 = Math.max(0.0f, 0.0f); int i34 = bVar.h; int i35 = i33; int i36 = 0; while (i35 < i33 + i34) { View f9 = f(i35); if (f9 == null) { i11 = i21; i10 = i22; i9 = i35; i8 = i34; i7 = i33; } else { c.i.a.e.c cVar3 = this.q; i11 = i21; i10 = i22; long j2 = cVar3.d[i35]; int i37 = (int) j2; int m2 = cVar3.m(j2); LayoutParams layoutParams2 = (LayoutParams) f9.getLayoutParams(); if (shouldMeasureChild(f9, i37, m2, layoutParams2)) { f9.measure(i37, m2); } float topDecorationHeight2 = f7 + ((float) (getTopDecorationHeight(f9) + ((ViewGroup.MarginLayoutParams) layoutParams2).topMargin)); float bottomDecorationHeight = f8 - ((float) (getBottomDecorationHeight(f9) + ((ViewGroup.MarginLayoutParams) layoutParams2).rightMargin)); if (cVar.i == 1) { calculateItemDecorationsForChild(f9, i); addView(f9); } else { calculateItemDecorationsForChild(f9, i); addView(f9, i36); i36++; } int leftDecorationWidth2 = getLeftDecorationWidth(f9) + i30; int rightDecorationWidth3 = i6 - getRightDecorationWidth(f9); boolean z2 = this.n; if (!z2) { i9 = i35; i8 = i34; i7 = i33; if (this.o) { this.q.v(f9, bVar, z2, leftDecorationWidth2, Math.round(bottomDecorationHeight) - f9.getMeasuredHeight(), f9.getMeasuredWidth() + leftDecorationWidth2, Math.round(bottomDecorationHeight)); } else { this.q.v(f9, bVar, z2, leftDecorationWidth2, Math.round(topDecorationHeight2), f9.getMeasuredWidth() + leftDecorationWidth2, f9.getMeasuredHeight() + Math.round(topDecorationHeight2)); } } else if (this.o) { i9 = i35; i8 = i34; i7 = i33; this.q.v(f9, bVar, z2, rightDecorationWidth3 - f9.getMeasuredWidth(), Math.round(bottomDecorationHeight) - f9.getMeasuredHeight(), rightDecorationWidth3, Math.round(bottomDecorationHeight)); } else { i9 = i35; i8 = i34; i7 = i33; this.q.v(f9, bVar, z2, rightDecorationWidth3 - f9.getMeasuredWidth(), Math.round(topDecorationHeight2), rightDecorationWidth3, f9.getMeasuredHeight() + Math.round(topDecorationHeight2)); } float bottomDecorationHeight2 = ((float) (getBottomDecorationHeight(f9) + f9.getMeasuredHeight() + ((ViewGroup.MarginLayoutParams) layoutParams2).topMargin)) + max2 + topDecorationHeight2; f8 = bottomDecorationHeight - (((float) (getTopDecorationHeight(f9) + (f9.getMeasuredHeight() + ((ViewGroup.MarginLayoutParams) layoutParams2).bottomMargin))) + max2); f7 = bottomDecorationHeight2; i36 = i36; } i35 = i9 + 1; i21 = i11; i22 = i10; i34 = i8; i33 = i7; } i4 = i21; i2 = i22; cVar.f2289c += this.t.i; i5 = bVar.g; } i22 = i2 + i5; if (i20 || !this.n) { cVar.e = (bVar.g * cVar.i) + cVar.e; } else { cVar.e -= bVar.g * cVar.i; } i21 = i4 - bVar.g; i19 = i3; } int i38 = cVar.a - i22; cVar.a = i38; int i39 = cVar.f; if (i39 != Integer.MIN_VALUE) { int i40 = i39 + i22; cVar.f = i40; if (i38 < 0) { cVar.f = i40 + i38; } v(recycler, cVar); } return i19 - cVar.a; } public final View n(int i2) { int i3; View s2 = s(0, getChildCount(), i2); if (s2 == null || (i3 = this.q.f1018c[getPosition(s2)]) == -1) { return null; } return o(s2, this.p.get(i3)); } public final View o(View view, c.i.a.e.b bVar) { boolean i2 = i(); int i3 = bVar.h; for (int i4 = 1; i4 < i3; i4++) { View childAt = getChildAt(i4); if (!(childAt == null || childAt.getVisibility() == 8)) { if (!this.n || i2) { if (this.v.getDecoratedStart(view) <= this.v.getDecoratedStart(childAt)) { } } else if (this.v.getDecoratedEnd(view) >= this.v.getDecoratedEnd(childAt)) { } view = childAt; } } return view; } @Override // androidx.recyclerview.widget.RecyclerView.LayoutManager public void onAdapterChanged(RecyclerView.Adapter adapter, RecyclerView.Adapter adapter2) { removeAllViews(); } @Override // androidx.recyclerview.widget.RecyclerView.LayoutManager public void onAttachedToWindow(RecyclerView recyclerView) { super.onAttachedToWindow(recyclerView); this.E = (View) recyclerView.getParent(); } @Override // androidx.recyclerview.widget.RecyclerView.LayoutManager public void onDetachedFromWindow(RecyclerView recyclerView, RecyclerView.Recycler recycler) { super.onDetachedFromWindow(recyclerView, recycler); } @Override // androidx.recyclerview.widget.RecyclerView.LayoutManager public void onItemsAdded(@NonNull RecyclerView recyclerView, int i2, int i3) { super.onItemsAdded(recyclerView, i2, i3); y(i2); } @Override // androidx.recyclerview.widget.RecyclerView.LayoutManager public void onItemsMoved(@NonNull RecyclerView recyclerView, int i2, int i3, int i4) { super.onItemsMoved(recyclerView, i2, i3, i4); y(Math.min(i2, i3)); } @Override // androidx.recyclerview.widget.RecyclerView.LayoutManager public void onItemsRemoved(@NonNull RecyclerView recyclerView, int i2, int i3) { super.onItemsRemoved(recyclerView, i2, i3); y(i2); } @Override // androidx.recyclerview.widget.RecyclerView.LayoutManager public void onItemsUpdated(@NonNull RecyclerView recyclerView, int i2, int i3) { super.onItemsUpdated(recyclerView, i2, i3); y(i2); } @Override // androidx.recyclerview.widget.RecyclerView.LayoutManager public void onItemsUpdated(@NonNull RecyclerView recyclerView, int i2, int i3, Object obj) { super.onItemsUpdated(recyclerView, i2, i3, obj); y(i2); } /* JADX WARNING: Removed duplicated region for block: B:111:0x01b6 */ /* JADX WARNING: Removed duplicated region for block: B:162:0x0294 */ @Override // androidx.recyclerview.widget.RecyclerView.LayoutManager public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) { int i2; boolean z2; int i3; int i4; boolean z3; boolean z4; int i5; this.r = recycler; this.f2284s = state; int itemCount = state.getItemCount(); if (itemCount != 0 || !state.isPreLayout()) { int layoutDirection = getLayoutDirection(); int i6 = this.j; if (i6 == 0) { this.n = layoutDirection == 1; this.o = this.k == 2; } else if (i6 == 1) { this.n = layoutDirection != 1; this.o = this.k == 2; } else if (i6 == 2) { boolean z5 = layoutDirection == 1; this.n = z5; if (this.k == 2) { this.n = !z5; } this.o = false; } else if (i6 != 3) { this.n = false; this.o = false; } else { boolean z6 = layoutDirection == 1; this.n = z6; if (this.k == 2) { this.n = !z6; } this.o = true; } l(); if (this.t == null) { this.t = new c(null); } this.q.j(itemCount); this.q.k(itemCount); this.q.i(itemCount); this.t.j = false; SavedState savedState = this.f2285x; if (savedState != null) { int i7 = savedState.i; if (i7 >= 0 && i7 < itemCount) { this.f2286y = i7; } } b bVar = this.u; if (!(bVar.f && this.f2286y == -1 && savedState == null)) { b.b(bVar); b bVar2 = this.u; SavedState savedState2 = this.f2285x; if (!state.isPreLayout() && (i5 = this.f2286y) != -1) { if (i5 < 0 || i5 >= state.getItemCount()) { this.f2286y = -1; this.f2287z = Integer.MIN_VALUE; } else { int i8 = this.f2286y; bVar2.a = i8; bVar2.b = this.q.f1018c[i8]; SavedState savedState3 = this.f2285x; if (savedState3 != null) { int itemCount2 = state.getItemCount(); int i9 = savedState3.i; if (i9 >= 0 && i9 < itemCount2) { bVar2.f2288c = this.v.getStartAfterPadding() + savedState2.j; bVar2.g = true; bVar2.b = -1; z3 = true; if (!z3) { if (getChildCount() != 0) { View p = bVar2.e ? p(state.getItemCount()) : n(state.getItemCount()); if (p != null) { FlexboxLayoutManager flexboxLayoutManager = FlexboxLayoutManager.this; OrientationHelper orientationHelper = flexboxLayoutManager.k == 0 ? flexboxLayoutManager.w : flexboxLayoutManager.v; if (flexboxLayoutManager.i() || !FlexboxLayoutManager.this.n) { if (bVar2.e) { bVar2.f2288c = orientationHelper.getTotalSpaceChange() + orientationHelper.getDecoratedEnd(p); } else { bVar2.f2288c = orientationHelper.getDecoratedStart(p); } } else if (bVar2.e) { bVar2.f2288c = orientationHelper.getTotalSpaceChange() + orientationHelper.getDecoratedStart(p); } else { bVar2.f2288c = orientationHelper.getDecoratedEnd(p); } int position = FlexboxLayoutManager.this.getPosition(p); bVar2.a = position; bVar2.g = false; FlexboxLayoutManager flexboxLayoutManager2 = FlexboxLayoutManager.this; int[] iArr = flexboxLayoutManager2.q.f1018c; if (position == -1) { position = 0; } int i10 = iArr[position]; if (i10 == -1) { i10 = 0; } bVar2.b = i10; int size = flexboxLayoutManager2.p.size(); int i11 = bVar2.b; if (size > i11) { bVar2.a = FlexboxLayoutManager.this.p.get(i11).o; } if (!state.isPreLayout() && supportsPredictiveItemAnimations()) { if (this.v.getDecoratedStart(p) >= this.v.getEndAfterPadding() || this.v.getDecoratedEnd(p) < this.v.getStartAfterPadding()) { bVar2.f2288c = bVar2.e ? this.v.getEndAfterPadding() : this.v.getStartAfterPadding(); } } z4 = true; if (!z4) { b.a(bVar2); bVar2.a = 0; bVar2.b = 0; } } } z4 = false; if (!z4) { } } this.u.f = true; } } if (this.f2287z == Integer.MIN_VALUE) { View findViewByPosition = findViewByPosition(this.f2286y); if (findViewByPosition == null) { if (getChildCount() > 0) { bVar2.e = this.f2286y < getPosition(getChildAt(0)); } b.a(bVar2); } else if (this.v.getDecoratedMeasurement(findViewByPosition) > this.v.getTotalSpace()) { b.a(bVar2); } else if (this.v.getDecoratedStart(findViewByPosition) - this.v.getStartAfterPadding() < 0) { bVar2.f2288c = this.v.getStartAfterPadding(); bVar2.e = false; } else if (this.v.getEndAfterPadding() - this.v.getDecoratedEnd(findViewByPosition) < 0) { bVar2.f2288c = this.v.getEndAfterPadding(); bVar2.e = true; } else { bVar2.f2288c = bVar2.e ? this.v.getTotalSpaceChange() + this.v.getDecoratedEnd(findViewByPosition) : this.v.getDecoratedStart(findViewByPosition); } } else if (i() || !this.n) { bVar2.f2288c = this.v.getStartAfterPadding() + this.f2287z; } else { bVar2.f2288c = this.f2287z - this.v.getEndPadding(); } z3 = true; if (!z3) { } this.u.f = true; } } z3 = false; if (!z3) { } this.u.f = true; } detachAndScrapAttachedViews(recycler); b bVar3 = this.u; if (bVar3.e) { A(bVar3, false, true); } else { z(bVar3, false, true); } int makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(getWidth(), getWidthMode()); int makeMeasureSpec2 = View.MeasureSpec.makeMeasureSpec(getHeight(), getHeightMode()); int width = getWidth(); int height = getHeight(); if (i()) { int i12 = this.A; z2 = (i12 == Integer.MIN_VALUE || i12 == width) ? false : true; c cVar = this.t; i2 = cVar.b ? this.D.getResources().getDisplayMetrics().heightPixels : cVar.a; } else { int i13 = this.B; z2 = (i13 == Integer.MIN_VALUE || i13 == height) ? false : true; c cVar2 = this.t; i2 = cVar2.b ? this.D.getResources().getDisplayMetrics().widthPixels : cVar2.a; } this.A = width; this.B = height; int i14 = this.F; if (i14 != -1 || (this.f2286y == -1 && !z2)) { int min = i14 != -1 ? Math.min(i14, this.u.a) : this.u.a; this.G.a(); if (i()) { if (this.p.size() > 0) { this.q.d(this.p, min); this.q.b(this.G, makeMeasureSpec, makeMeasureSpec2, i2, min, this.u.a, this.p); } else { this.q.i(itemCount); this.q.b(this.G, makeMeasureSpec, makeMeasureSpec2, i2, 0, -1, this.p); } } else if (this.p.size() > 0) { this.q.d(this.p, min); this.q.b(this.G, makeMeasureSpec2, makeMeasureSpec, i2, min, this.u.a, this.p); } else { this.q.i(itemCount); this.q.b(this.G, makeMeasureSpec2, makeMeasureSpec, i2, 0, -1, this.p); } this.p = this.G.a; this.q.h(makeMeasureSpec, makeMeasureSpec2, min); this.q.A(min); } else if (!this.u.e) { this.p.clear(); this.G.a(); if (i()) { this.q.b(this.G, makeMeasureSpec, makeMeasureSpec2, i2, 0, this.u.a, this.p); } else { this.q.b(this.G, makeMeasureSpec2, makeMeasureSpec, i2, 0, this.u.a, this.p); } this.p = this.G.a; this.q.h(makeMeasureSpec, makeMeasureSpec2, 0); this.q.A(0); b bVar4 = this.u; int i15 = this.q.f1018c[bVar4.a]; bVar4.b = i15; this.t.f2289c = i15; } if (this.u.e) { m(recycler, state, this.t); i4 = this.t.e; z(this.u, true, false); m(recycler, state, this.t); i3 = this.t.e; } else { m(recycler, state, this.t); i3 = this.t.e; A(this.u, true, false); m(recycler, state, this.t); i4 = this.t.e; } if (getChildCount() <= 0) { return; } if (this.u.e) { fixLayoutStartGap(fixLayoutEndGap(i3, recycler, state, true) + i4, recycler, state, false); } else { fixLayoutEndGap(fixLayoutStartGap(i4, recycler, state, true) + i3, recycler, state, false); } } } @Override // androidx.recyclerview.widget.RecyclerView.LayoutManager public void onLayoutCompleted(RecyclerView.State state) { super.onLayoutCompleted(state); this.f2285x = null; this.f2286y = -1; this.f2287z = Integer.MIN_VALUE; this.F = -1; b.b(this.u); this.C.clear(); } @Override // androidx.recyclerview.widget.RecyclerView.LayoutManager public void onRestoreInstanceState(Parcelable parcelable) { if (parcelable instanceof SavedState) { this.f2285x = (SavedState) parcelable; requestLayout(); } } @Override // androidx.recyclerview.widget.RecyclerView.LayoutManager public Parcelable onSaveInstanceState() { SavedState savedState = this.f2285x; if (savedState != null) { return new SavedState(savedState, (a) null); } SavedState savedState2 = new SavedState(); if (getChildCount() > 0) { View childAt = getChildAt(0); savedState2.i = getPosition(childAt); savedState2.j = this.v.getDecoratedStart(childAt) - this.v.getStartAfterPadding(); } else { savedState2.i = -1; } return savedState2; } public final View p(int i2) { View s2 = s(getChildCount() - 1, -1, i2); if (s2 == null) { return null; } return q(s2, this.p.get(this.q.f1018c[getPosition(s2)])); } public final View q(View view, c.i.a.e.b bVar) { boolean i2 = i(); int childCount = (getChildCount() - bVar.h) - 1; for (int childCount2 = getChildCount() - 2; childCount2 > childCount; childCount2--) { View childAt = getChildAt(childCount2); if (!(childAt == null || childAt.getVisibility() == 8)) { if (!this.n || i2) { if (this.v.getDecoratedEnd(view) >= this.v.getDecoratedEnd(childAt)) { } } else if (this.v.getDecoratedStart(view) <= this.v.getDecoratedStart(childAt)) { } view = childAt; } } return view; } public final View r(int i2, int i3, boolean z2) { int i4 = i2; int i5 = i3 > i4 ? 1 : -1; while (i4 != i3) { View childAt = getChildAt(i4); int paddingLeft = getPaddingLeft(); int paddingTop = getPaddingTop(); int width = getWidth() - getPaddingRight(); int height = getHeight() - getPaddingBottom(); int decoratedLeft = getDecoratedLeft(childAt) - ((ViewGroup.MarginLayoutParams) ((RecyclerView.LayoutParams) childAt.getLayoutParams())).leftMargin; int decoratedTop = getDecoratedTop(childAt) - ((ViewGroup.MarginLayoutParams) ((RecyclerView.LayoutParams) childAt.getLayoutParams())).topMargin; int decoratedRight = getDecoratedRight(childAt) + ((ViewGroup.MarginLayoutParams) ((RecyclerView.LayoutParams) childAt.getLayoutParams())).rightMargin; int decoratedBottom = getDecoratedBottom(childAt) + ((ViewGroup.MarginLayoutParams) ((RecyclerView.LayoutParams) childAt.getLayoutParams())).bottomMargin; boolean z3 = false; boolean z4 = paddingLeft <= decoratedLeft && width >= decoratedRight; boolean z5 = decoratedLeft >= width || decoratedRight >= paddingLeft; boolean z6 = paddingTop <= decoratedTop && height >= decoratedBottom; boolean z7 = decoratedTop >= height || decoratedBottom >= paddingTop; if (!z2 ? !(!z5 || !z7) : !(!z4 || !z6)) { z3 = true; } if (z3) { return childAt; } i4 += i5; } return null; } public final View s(int i2, int i3, int i4) { l(); View view = null; if (this.t == null) { this.t = new c(null); } int startAfterPadding = this.v.getStartAfterPadding(); int endAfterPadding = this.v.getEndAfterPadding(); int i5 = i3 > i2 ? 1 : -1; View view2 = null; while (i2 != i3) { View childAt = getChildAt(i2); int position = getPosition(childAt); if (position >= 0 && position < i4) { if (((RecyclerView.LayoutParams) childAt.getLayoutParams()).isItemRemoved()) { if (view2 == null) { view2 = childAt; } } else if (this.v.getDecoratedStart(childAt) >= startAfterPadding && this.v.getDecoratedEnd(childAt) <= endAfterPadding) { return childAt; } else { if (view == null) { view = childAt; } } } i2 += i5; } return view != null ? view : view2; } @Override // androidx.recyclerview.widget.RecyclerView.LayoutManager public int scrollHorizontallyBy(int i2, RecyclerView.Recycler recycler, RecyclerView.State state) { if (!i() || (this.k == 0 && i())) { int t = t(i2, recycler, state); this.C.clear(); return t; } int u = u(i2); this.u.d += u; this.w.offsetChildren(-u); return u; } @Override // androidx.recyclerview.widget.RecyclerView.LayoutManager public void scrollToPosition(int i2) { this.f2286y = i2; this.f2287z = Integer.MIN_VALUE; SavedState savedState = this.f2285x; if (savedState != null) { savedState.i = -1; } requestLayout(); } @Override // androidx.recyclerview.widget.RecyclerView.LayoutManager public int scrollVerticallyBy(int i2, RecyclerView.Recycler recycler, RecyclerView.State state) { if (i() || (this.k == 0 && !i())) { int t = t(i2, recycler, state); this.C.clear(); return t; } int u = u(i2); this.u.d += u; this.w.offsetChildren(-u); return u; } @Override // c.i.a.e.a public void setFlexLines(List list) { this.p = list; } @Override // androidx.recyclerview.widget.RecyclerView.LayoutManager public void smoothScrollToPosition(RecyclerView recyclerView, RecyclerView.State state, int i2) { LinearSmoothScroller linearSmoothScroller = new LinearSmoothScroller(recyclerView.getContext()); linearSmoothScroller.setTargetPosition(i2); startSmoothScroll(linearSmoothScroller); } public final int t(int i2, RecyclerView.Recycler recycler, RecyclerView.State state) { int i3; if (getChildCount() == 0 || i2 == 0) { return 0; } l(); this.t.j = true; boolean z2 = !i() && this.n; int i4 = (!z2 ? i2 <= 0 : i2 >= 0) ? -1 : 1; int abs = Math.abs(i2); this.t.i = i4; boolean i5 = i(); int makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(getWidth(), getWidthMode()); int makeMeasureSpec2 = View.MeasureSpec.makeMeasureSpec(getHeight(), getHeightMode()); boolean z3 = !i5 && this.n; if (i4 == 1) { View childAt = getChildAt(getChildCount() - 1); this.t.e = this.v.getDecoratedEnd(childAt); int position = getPosition(childAt); View q = q(childAt, this.p.get(this.q.f1018c[position])); c cVar = this.t; cVar.h = 1; int i6 = position + 1; cVar.d = i6; int[] iArr = this.q.f1018c; if (iArr.length <= i6) { cVar.f2289c = -1; } else { cVar.f2289c = iArr[i6]; } if (z3) { cVar.e = this.v.getDecoratedStart(q); this.t.f = this.v.getStartAfterPadding() + (-this.v.getDecoratedStart(q)); c cVar2 = this.t; int i7 = cVar2.f; if (i7 < 0) { i7 = 0; } cVar2.f = i7; } else { cVar.e = this.v.getDecoratedEnd(q); this.t.f = this.v.getDecoratedEnd(q) - this.v.getEndAfterPadding(); } int i8 = this.t.f2289c; if ((i8 == -1 || i8 > this.p.size() - 1) && this.t.d <= getFlexItemCount()) { int i9 = abs - this.t.f; this.G.a(); if (i9 > 0) { if (i5) { this.q.b(this.G, makeMeasureSpec, makeMeasureSpec2, i9, this.t.d, -1, this.p); } else { this.q.b(this.G, makeMeasureSpec2, makeMeasureSpec, i9, this.t.d, -1, this.p); } this.q.h(makeMeasureSpec, makeMeasureSpec2, this.t.d); this.q.A(this.t.d); } } } else { View childAt2 = getChildAt(0); this.t.e = this.v.getDecoratedStart(childAt2); int position2 = getPosition(childAt2); View o = o(childAt2, this.p.get(this.q.f1018c[position2])); c cVar3 = this.t; cVar3.h = 1; int i10 = this.q.f1018c[position2]; if (i10 == -1) { i10 = 0; } if (i10 > 0) { this.t.d = position2 - this.p.get(i10 - 1).h; } else { cVar3.d = -1; } c cVar4 = this.t; cVar4.f2289c = i10 > 0 ? i10 - 1 : 0; if (z3) { cVar4.e = this.v.getDecoratedEnd(o); this.t.f = this.v.getDecoratedEnd(o) - this.v.getEndAfterPadding(); c cVar5 = this.t; int i11 = cVar5.f; if (i11 < 0) { i11 = 0; } cVar5.f = i11; } else { cVar4.e = this.v.getDecoratedStart(o); this.t.f = this.v.getStartAfterPadding() + (-this.v.getDecoratedStart(o)); } } c cVar6 = this.t; int i12 = cVar6.f; cVar6.a = abs - i12; int m = m(recycler, state, cVar6) + i12; if (m < 0) { return 0; } if (z2) { if (abs > m) { i3 = (-i4) * m; this.v.offsetChildren(-i3); this.t.g = i3; return i3; } } else if (abs > m) { i3 = i4 * m; this.v.offsetChildren(-i3); this.t.g = i3; return i3; } i3 = i2; this.v.offsetChildren(-i3); this.t.g = i3; return i3; } public final int u(int i2) { int i3; boolean z2 = false; if (getChildCount() == 0 || i2 == 0) { return 0; } l(); boolean i4 = i(); View view = this.E; int width = i4 ? view.getWidth() : view.getHeight(); int width2 = i4 ? getWidth() : getHeight(); if (getLayoutDirection() == 1) { z2 = true; } if (z2) { int abs = Math.abs(i2); if (i2 < 0) { return -Math.min((width2 + this.u.d) - width, abs); } i3 = this.u.d; if (i3 + i2 <= 0) { return i2; } } else if (i2 > 0) { return Math.min((width2 - this.u.d) - width, i2); } else { i3 = this.u.d; if (i3 + i2 >= 0) { return i2; } } return -i3; } public final void v(RecyclerView.Recycler recycler, c cVar) { int childCount; if (cVar.j) { int i2 = -1; if (cVar.i == -1) { if (cVar.f >= 0) { this.v.getEnd(); int childCount2 = getChildCount(); if (childCount2 != 0) { int i3 = childCount2 - 1; int i4 = this.q.f1018c[getPosition(getChildAt(i3))]; if (i4 != -1) { c.i.a.e.b bVar = this.p.get(i4); int i5 = i3; while (true) { if (i5 < 0) { break; } View childAt = getChildAt(i5); int i6 = cVar.f; if (!(i() || !this.n ? this.v.getDecoratedStart(childAt) >= this.v.getEnd() - i6 : this.v.getDecoratedEnd(childAt) <= i6)) { break; } if (bVar.o == getPosition(childAt)) { if (i4 <= 0) { childCount2 = i5; break; } i4 += cVar.i; bVar = this.p.get(i4); childCount2 = i5; } i5--; } while (i3 >= childCount2) { removeAndRecycleViewAt(i3, recycler); i3--; } } } } } else if (cVar.f >= 0 && (childCount = getChildCount()) != 0) { int i7 = this.q.f1018c[getPosition(getChildAt(0))]; if (i7 != -1) { c.i.a.e.b bVar2 = this.p.get(i7); int i8 = 0; while (true) { if (i8 >= childCount) { break; } View childAt2 = getChildAt(i8); int i9 = cVar.f; if (!(i() || !this.n ? this.v.getDecoratedEnd(childAt2) <= i9 : this.v.getEnd() - this.v.getDecoratedStart(childAt2) <= i9)) { break; } if (bVar2.p == getPosition(childAt2)) { if (i7 >= this.p.size() - 1) { i2 = i8; break; } i7 += cVar.i; bVar2 = this.p.get(i7); i2 = i8; } i8++; } while (i2 >= 0) { removeAndRecycleViewAt(i2, recycler); i2--; } } } } } public final void w() { int heightMode = i() ? getHeightMode() : getWidthMode(); this.t.b = heightMode == 0 || heightMode == Integer.MIN_VALUE; } public void x(int i2) { if (this.j != i2) { removeAllViews(); this.j = i2; this.v = null; this.w = null; k(); requestLayout(); } } public final void y(int i2) { if (i2 < findLastVisibleItemPosition()) { int childCount = getChildCount(); this.q.j(childCount); this.q.k(childCount); this.q.i(childCount); if (i2 < this.q.f1018c.length) { this.F = i2; View childAt = getChildAt(0); if (childAt != null) { this.f2286y = getPosition(childAt); if (i() || !this.n) { this.f2287z = this.v.getDecoratedStart(childAt) - this.v.getStartAfterPadding(); return; } this.f2287z = this.v.getEndPadding() + this.v.getDecoratedEnd(childAt); } } } } public final void z(b bVar, boolean z2, boolean z3) { int i2; if (z3) { w(); } else { this.t.b = false; } if (i() || !this.n) { this.t.a = this.v.getEndAfterPadding() - bVar.f2288c; } else { this.t.a = bVar.f2288c - getPaddingRight(); } c cVar = this.t; cVar.d = bVar.a; cVar.h = 1; cVar.i = 1; cVar.e = bVar.f2288c; cVar.f = Integer.MIN_VALUE; cVar.f2289c = bVar.b; if (z2 && this.p.size() > 1 && (i2 = bVar.b) >= 0 && i2 < this.p.size() - 1) { c cVar2 = this.t; cVar2.f2289c++; cVar2.d += this.p.get(bVar.b).h; } } }