discord-jadx/app/src/main/java/com/google/android/flexbox/FlexboxLayout.java

1250 lines
44 KiB
Java

package com.google.android.flexbox;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.AttributeSet;
import android.util.SparseIntArray;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.Nullable;
import androidx.core.view.ViewCompat;
import c.i.a.e.a;
import c.i.a.e.b;
import c.i.a.e.c;
import java.util.ArrayList;
import java.util.List;
public class FlexboxLayout extends ViewGroup implements a {
public int i;
public int j;
public int k;
public int l;
public int m;
public int n = -1;
@Nullable
public Drawable o;
@Nullable
public Drawable p;
public int q;
public int r;
/* renamed from: s reason: collision with root package name */
public int f2281s;
public int t;
public int[] u;
public SparseIntArray v;
public c w = new c(this);
/* renamed from: x reason: collision with root package name */
public List<b> f2282x = new ArrayList();
/* renamed from: y reason: collision with root package name */
public c.b f2283y = new c.b();
public static class LayoutParams extends ViewGroup.MarginLayoutParams implements FlexItem {
public static final Parcelable.Creator<LayoutParams> CREATOR = new a();
public int i = 1;
public float j = 0.0f;
public float k = 1.0f;
public int l = -1;
public float m = -1.0f;
public int n = -1;
public int o = -1;
public int p = 16777215;
public int q = 16777215;
public boolean r;
public static class a implements Parcelable.Creator<LayoutParams> {
/* 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(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R.a.FlexboxLayout_Layout);
this.i = obtainStyledAttributes.getInt(R.a.FlexboxLayout_Layout_layout_order, 1);
this.j = obtainStyledAttributes.getFloat(R.a.FlexboxLayout_Layout_layout_flexGrow, 0.0f);
this.k = obtainStyledAttributes.getFloat(R.a.FlexboxLayout_Layout_layout_flexShrink, 1.0f);
this.l = obtainStyledAttributes.getInt(R.a.FlexboxLayout_Layout_layout_alignSelf, -1);
this.m = obtainStyledAttributes.getFraction(R.a.FlexboxLayout_Layout_layout_flexBasisPercent, 1, 1, -1.0f);
this.n = obtainStyledAttributes.getDimensionPixelSize(R.a.FlexboxLayout_Layout_layout_minWidth, -1);
this.o = obtainStyledAttributes.getDimensionPixelSize(R.a.FlexboxLayout_Layout_layout_minHeight, -1);
this.p = obtainStyledAttributes.getDimensionPixelSize(R.a.FlexboxLayout_Layout_layout_maxWidth, 16777215);
this.q = obtainStyledAttributes.getDimensionPixelSize(R.a.FlexboxLayout_Layout_layout_maxHeight, 16777215);
this.r = obtainStyledAttributes.getBoolean(R.a.FlexboxLayout_Layout_layout_wrapBefore, false);
obtainStyledAttributes.recycle();
}
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public LayoutParams(Parcel parcel) {
super(0, 0);
boolean z2 = false;
this.i = parcel.readInt();
this.j = parcel.readFloat();
this.k = parcel.readFloat();
this.l = parcel.readInt();
this.m = parcel.readFloat();
this.n = parcel.readInt();
this.o = parcel.readInt();
this.p = parcel.readInt();
this.q = parcel.readInt();
this.r = parcel.readByte() != 0 ? true : z2;
((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();
}
public LayoutParams(ViewGroup.LayoutParams layoutParams) {
super(layoutParams);
}
public LayoutParams(ViewGroup.MarginLayoutParams marginLayoutParams) {
super(marginLayoutParams);
}
public LayoutParams(LayoutParams layoutParams) {
super((ViewGroup.MarginLayoutParams) layoutParams);
this.i = layoutParams.i;
this.j = layoutParams.j;
this.k = layoutParams.k;
this.l = layoutParams.l;
this.m = layoutParams.m;
this.n = layoutParams.n;
this.o = layoutParams.o;
this.p = layoutParams.p;
this.q = layoutParams.q;
this.r = layoutParams.r;
}
@Override // com.google.android.flexbox.FlexItem
public int C() {
return this.n;
}
@Override // com.google.android.flexbox.FlexItem
public void G(int i) {
this.n = 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.o = i;
}
@Override // com.google.android.flexbox.FlexItem
public float R() {
return this.j;
}
@Override // com.google.android.flexbox.FlexItem
public float V() {
return this.m;
}
@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.o;
}
@Override // com.google.android.flexbox.FlexItem
public int getHeight() {
return ((ViewGroup.MarginLayoutParams) this).height;
}
@Override // com.google.android.flexbox.FlexItem
public int getOrder() {
return this.i;
}
@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.r;
}
@Override // com.google.android.flexbox.FlexItem
public int l0() {
return this.q;
}
@Override // com.google.android.flexbox.FlexItem
public int s0() {
return this.p;
}
@Override // com.google.android.flexbox.FlexItem
public int t() {
return this.l;
}
@Override // com.google.android.flexbox.FlexItem
public float w() {
return this.k;
}
@Override // android.os.Parcelable
public void writeToParcel(Parcel parcel, int i) {
parcel.writeInt(this.i);
parcel.writeFloat(this.j);
parcel.writeFloat(this.k);
parcel.writeInt(this.l);
parcel.writeFloat(this.m);
parcel.writeInt(this.n);
parcel.writeInt(this.o);
parcel.writeInt(this.p);
parcel.writeInt(this.q);
parcel.writeByte(this.r ? (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 FlexboxLayout(Context context, AttributeSet attributeSet) {
super(context, attributeSet, 0);
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R.a.FlexboxLayout, 0, 0);
this.i = obtainStyledAttributes.getInt(R.a.FlexboxLayout_flexDirection, 0);
this.j = obtainStyledAttributes.getInt(R.a.FlexboxLayout_flexWrap, 0);
this.k = obtainStyledAttributes.getInt(R.a.FlexboxLayout_justifyContent, 0);
this.l = obtainStyledAttributes.getInt(R.a.FlexboxLayout_alignItems, 0);
this.m = obtainStyledAttributes.getInt(R.a.FlexboxLayout_alignContent, 0);
this.n = obtainStyledAttributes.getInt(R.a.FlexboxLayout_maxLine, -1);
Drawable drawable = obtainStyledAttributes.getDrawable(R.a.FlexboxLayout_dividerDrawable);
if (drawable != null) {
setDividerDrawableHorizontal(drawable);
setDividerDrawableVertical(drawable);
}
Drawable drawable2 = obtainStyledAttributes.getDrawable(R.a.FlexboxLayout_dividerDrawableHorizontal);
if (drawable2 != null) {
setDividerDrawableHorizontal(drawable2);
}
Drawable drawable3 = obtainStyledAttributes.getDrawable(R.a.FlexboxLayout_dividerDrawableVertical);
if (drawable3 != null) {
setDividerDrawableVertical(drawable3);
}
int i = obtainStyledAttributes.getInt(R.a.FlexboxLayout_showDivider, 0);
if (i != 0) {
this.r = i;
this.q = i;
}
int i2 = obtainStyledAttributes.getInt(R.a.FlexboxLayout_showDividerVertical, 0);
if (i2 != 0) {
this.r = i2;
}
int i3 = obtainStyledAttributes.getInt(R.a.FlexboxLayout_showDividerHorizontal, 0);
if (i3 != 0) {
this.q = i3;
}
obtainStyledAttributes.recycle();
}
@Override // c.i.a.e.a
public void a(View view, int i, int i2, b bVar) {
if (!p(i, i2)) {
return;
}
if (i()) {
int i3 = bVar.e;
int i4 = this.t;
bVar.e = i3 + i4;
bVar.f += i4;
return;
}
int i5 = bVar.e;
int i6 = this.f2281s;
bVar.e = i5 + i6;
bVar.f += i6;
}
@Override // android.view.ViewGroup
public void addView(View view, int i, ViewGroup.LayoutParams layoutParams) {
if (this.v == null) {
this.v = new SparseIntArray(getChildCount());
}
c cVar = this.w;
SparseIntArray sparseIntArray = this.v;
int flexItemCount = cVar.a.getFlexItemCount();
List<c.C0098c> f = cVar.f(flexItemCount);
c.C0098c cVar2 = new c.C0098c(null);
if (view == null || !(layoutParams instanceof FlexItem)) {
cVar2.j = 1;
} else {
cVar2.j = ((FlexItem) layoutParams).getOrder();
}
if (i == -1 || i == flexItemCount) {
cVar2.i = flexItemCount;
} else if (i < cVar.a.getFlexItemCount()) {
cVar2.i = i;
for (int i2 = i; i2 < flexItemCount; i2++) {
((c.C0098c) ((ArrayList) f).get(i2)).i++;
}
} else {
cVar2.i = flexItemCount;
}
((ArrayList) f).add(cVar2);
this.u = cVar.x(flexItemCount + 1, f, sparseIntArray);
super.addView(view, i, layoutParams);
}
@Override // c.i.a.e.a
public void b(b bVar) {
if (i()) {
if ((this.r & 4) > 0) {
int i = bVar.e;
int i2 = this.t;
bVar.e = i + i2;
bVar.f += i2;
}
} else if ((this.q & 4) > 0) {
int i3 = bVar.e;
int i4 = this.f2281s;
bVar.e = i3 + i4;
bVar.f += i4;
}
}
@Override // c.i.a.e.a
public View c(int i) {
return o(i);
}
@Override // android.view.ViewGroup
public boolean checkLayoutParams(ViewGroup.LayoutParams layoutParams) {
return layoutParams instanceof LayoutParams;
}
@Override // c.i.a.e.a
public int d(int i, int i2, int i3) {
return ViewGroup.getChildMeasureSpec(i, i2, i3);
}
@Override // c.i.a.e.a
public void e(int i, View view) {
}
@Override // c.i.a.e.a
public View f(int i) {
return getChildAt(i);
}
@Override // c.i.a.e.a
public int g(View view, int i, int i2) {
int i3;
int i4 = 0;
if (i()) {
if (p(i, i2)) {
i4 = 0 + this.t;
}
if ((this.r & 4) <= 0) {
return i4;
}
i3 = this.t;
} else {
if (p(i, i2)) {
i4 = 0 + this.f2281s;
}
if ((this.q & 4) <= 0) {
return i4;
}
i3 = this.f2281s;
}
return i4 + i3;
}
@Override // android.view.ViewGroup
public ViewGroup.LayoutParams generateLayoutParams(AttributeSet attributeSet) {
return new LayoutParams(getContext(), attributeSet);
}
@Override // android.view.ViewGroup
public ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams layoutParams) {
return layoutParams instanceof LayoutParams ? new LayoutParams((LayoutParams) layoutParams) : layoutParams instanceof ViewGroup.MarginLayoutParams ? new LayoutParams((ViewGroup.MarginLayoutParams) layoutParams) : new LayoutParams(layoutParams);
}
@Override // c.i.a.e.a
public int getAlignContent() {
return this.m;
}
@Override // c.i.a.e.a
public int getAlignItems() {
return this.l;
}
@Nullable
public Drawable getDividerDrawableHorizontal() {
return this.o;
}
@Nullable
public Drawable getDividerDrawableVertical() {
return this.p;
}
@Override // c.i.a.e.a
public int getFlexDirection() {
return this.i;
}
@Override // c.i.a.e.a
public int getFlexItemCount() {
return getChildCount();
}
public List<b> getFlexLines() {
ArrayList arrayList = new ArrayList(this.f2282x.size());
for (b bVar : this.f2282x) {
if (bVar.a() != 0) {
arrayList.add(bVar);
}
}
return arrayList;
}
@Override // c.i.a.e.a
public List<b> getFlexLinesInternal() {
return this.f2282x;
}
@Override // c.i.a.e.a
public int getFlexWrap() {
return this.j;
}
public int getJustifyContent() {
return this.k;
}
@Override // c.i.a.e.a
public int getLargestMainSize() {
int i = Integer.MIN_VALUE;
for (b bVar : this.f2282x) {
i = Math.max(i, bVar.e);
}
return i;
}
@Override // c.i.a.e.a
public int getMaxLine() {
return this.n;
}
public int getShowDividerHorizontal() {
return this.q;
}
public int getShowDividerVertical() {
return this.r;
}
@Override // c.i.a.e.a
public int getSumOfCrossSize() {
int size = this.f2282x.size();
int i = 0;
for (int i2 = 0; i2 < size; i2++) {
b bVar = this.f2282x.get(i2);
if (q(i2)) {
i += i() ? this.f2281s : this.t;
}
if (r(i2)) {
i += i() ? this.f2281s : this.t;
}
i += bVar.g;
}
return i;
}
@Override // c.i.a.e.a
public int h(int i, int i2, int i3) {
return ViewGroup.getChildMeasureSpec(i, i2, i3);
}
@Override // c.i.a.e.a
public boolean i() {
int i = this.i;
return i == 0 || i == 1;
}
@Override // c.i.a.e.a
public int j(View view) {
return 0;
}
public final void k(Canvas canvas, boolean z2, boolean z3) {
int paddingLeft = getPaddingLeft();
int max = Math.max(0, (getWidth() - getPaddingRight()) - paddingLeft);
int size = this.f2282x.size();
for (int i = 0; i < size; i++) {
b bVar = this.f2282x.get(i);
for (int i2 = 0; i2 < bVar.h; i2++) {
int i3 = bVar.o + i2;
View o = o(i3);
if (!(o == null || o.getVisibility() == 8)) {
LayoutParams layoutParams = (LayoutParams) o.getLayoutParams();
if (p(i3, i2)) {
n(canvas, z2 ? o.getRight() + ((ViewGroup.MarginLayoutParams) layoutParams).rightMargin : (o.getLeft() - ((ViewGroup.MarginLayoutParams) layoutParams).leftMargin) - this.t, bVar.b, bVar.g);
}
if (i2 == bVar.h - 1 && (this.r & 4) > 0) {
n(canvas, z2 ? (o.getLeft() - ((ViewGroup.MarginLayoutParams) layoutParams).leftMargin) - this.t : o.getRight() + ((ViewGroup.MarginLayoutParams) layoutParams).rightMargin, bVar.b, bVar.g);
}
}
}
if (q(i)) {
m(canvas, paddingLeft, z3 ? bVar.d : bVar.b - this.f2281s, max);
}
if (r(i) && (this.q & 4) > 0) {
m(canvas, paddingLeft, z3 ? bVar.b - this.f2281s : bVar.d, max);
}
}
}
public final void l(Canvas canvas, boolean z2, boolean z3) {
int paddingTop = getPaddingTop();
int max = Math.max(0, (getHeight() - getPaddingBottom()) - paddingTop);
int size = this.f2282x.size();
for (int i = 0; i < size; i++) {
b bVar = this.f2282x.get(i);
for (int i2 = 0; i2 < bVar.h; i2++) {
int i3 = bVar.o + i2;
View o = o(i3);
if (!(o == null || o.getVisibility() == 8)) {
LayoutParams layoutParams = (LayoutParams) o.getLayoutParams();
if (p(i3, i2)) {
m(canvas, bVar.a, z3 ? o.getBottom() + ((ViewGroup.MarginLayoutParams) layoutParams).bottomMargin : (o.getTop() - ((ViewGroup.MarginLayoutParams) layoutParams).topMargin) - this.f2281s, bVar.g);
}
if (i2 == bVar.h - 1 && (this.q & 4) > 0) {
m(canvas, bVar.a, z3 ? (o.getTop() - ((ViewGroup.MarginLayoutParams) layoutParams).topMargin) - this.f2281s : o.getBottom() + ((ViewGroup.MarginLayoutParams) layoutParams).bottomMargin, bVar.g);
}
}
}
if (q(i)) {
n(canvas, z2 ? bVar.f1017c : bVar.a - this.t, paddingTop, max);
}
if (r(i) && (this.r & 4) > 0) {
n(canvas, z2 ? bVar.a - this.t : bVar.f1017c, paddingTop, max);
}
}
}
public final void m(Canvas canvas, int i, int i2, int i3) {
Drawable drawable = this.o;
if (drawable != null) {
drawable.setBounds(i, i2, i3 + i, this.f2281s + i2);
this.o.draw(canvas);
}
}
public final void n(Canvas canvas, int i, int i2, int i3) {
Drawable drawable = this.p;
if (drawable != null) {
drawable.setBounds(i, i2, this.t + i, i3 + i2);
this.p.draw(canvas);
}
}
public View o(int i) {
if (i < 0) {
return null;
}
int[] iArr = this.u;
if (i >= iArr.length) {
return null;
}
return getChildAt(iArr[i]);
}
@Override // android.view.View
public void onDraw(Canvas canvas) {
if (this.p != null || this.o != null) {
if (this.q != 0 || this.r != 0) {
int layoutDirection = ViewCompat.getLayoutDirection(this);
int i = this.i;
boolean z2 = false;
boolean z3 = true;
if (i == 0) {
boolean z4 = layoutDirection == 1;
if (this.j == 2) {
z2 = true;
}
k(canvas, z4, z2);
} else if (i == 1) {
boolean z5 = layoutDirection != 1;
if (this.j == 2) {
z2 = true;
}
k(canvas, z5, z2);
} else if (i == 2) {
if (layoutDirection != 1) {
z3 = false;
}
if (this.j == 2) {
z3 = !z3;
}
l(canvas, z3, false);
} else if (i == 3) {
if (layoutDirection == 1) {
z2 = true;
}
if (this.j == 2) {
z2 = !z2;
}
l(canvas, z2, true);
}
}
}
}
@Override // android.view.ViewGroup, android.view.View
public void onLayout(boolean z2, int i, int i2, int i3, int i4) {
int layoutDirection = ViewCompat.getLayoutDirection(this);
int i5 = this.i;
boolean z3 = false;
if (i5 == 0) {
s(layoutDirection == 1, i, i2, i3, i4);
} else if (i5 == 1) {
s(layoutDirection != 1, i, i2, i3, i4);
} else if (i5 == 2) {
if (layoutDirection == 1) {
z3 = true;
}
if (this.j == 2) {
z3 = !z3;
}
t(z3, false, i, i2, i3, i4);
} else if (i5 == 3) {
if (layoutDirection == 1) {
z3 = true;
}
if (this.j == 2) {
z3 = !z3;
}
t(z3, true, i, i2, i3, i4);
} else {
StringBuilder L = c.d.b.a.a.L("Invalid flex direction is set: ");
L.append(this.i);
throw new IllegalStateException(L.toString());
}
}
/* JADX WARNING: Removed duplicated region for block: B:15:0x004a */
/* JADX WARNING: Removed duplicated region for block: B:26:0x00ec */
@Override // android.view.View
public void onMeasure(int i, int i2) {
boolean z2;
int i3;
if (this.v == null) {
this.v = new SparseIntArray(getChildCount());
}
c cVar = this.w;
SparseIntArray sparseIntArray = this.v;
int flexItemCount = cVar.a.getFlexItemCount();
if (sparseIntArray.size() == flexItemCount) {
int i4 = 0;
while (true) {
if (i4 >= flexItemCount) {
z2 = false;
break;
}
View f = cVar.a.f(i4);
if (!(f == null || ((FlexItem) f.getLayoutParams()).getOrder() == sparseIntArray.get(i4))) {
break;
}
i4++;
}
if (z2) {
c cVar2 = this.w;
SparseIntArray sparseIntArray2 = this.v;
int flexItemCount2 = cVar2.a.getFlexItemCount();
this.u = cVar2.x(flexItemCount2, cVar2.f(flexItemCount2), sparseIntArray2);
}
i3 = this.i;
if (i3 != 0 || i3 == 1) {
this.f2282x.clear();
this.f2283y.a();
this.w.b(this.f2283y, i, i2, Integer.MAX_VALUE, 0, -1, null);
this.f2282x = this.f2283y.a;
this.w.h(i, i2, 0);
if (this.l == 3) {
for (b bVar : this.f2282x) {
int i5 = Integer.MIN_VALUE;
for (int i6 = 0; i6 < bVar.h; i6++) {
View o = o(bVar.o + i6);
if (!(o == null || o.getVisibility() == 8)) {
LayoutParams layoutParams = (LayoutParams) o.getLayoutParams();
i5 = this.j != 2 ? Math.max(i5, o.getMeasuredHeight() + Math.max(bVar.l - o.getBaseline(), ((ViewGroup.MarginLayoutParams) layoutParams).topMargin) + ((ViewGroup.MarginLayoutParams) layoutParams).bottomMargin) : Math.max(i5, o.getMeasuredHeight() + ((ViewGroup.MarginLayoutParams) layoutParams).topMargin + Math.max(o.getBaseline() + (bVar.l - o.getMeasuredHeight()), ((ViewGroup.MarginLayoutParams) layoutParams).bottomMargin));
}
}
bVar.g = i5;
}
}
this.w.g(i, i2, getPaddingBottom() + getPaddingTop());
this.w.A(0);
u(this.i, i, i2, this.f2283y.b);
} else if (i3 == 2 || i3 == 3) {
this.f2282x.clear();
this.f2283y.a();
this.w.b(this.f2283y, i2, i, Integer.MAX_VALUE, 0, -1, null);
this.f2282x = this.f2283y.a;
this.w.h(i, i2, 0);
this.w.g(i, i2, getPaddingRight() + getPaddingLeft());
this.w.A(0);
u(this.i, i, i2, this.f2283y.b);
return;
} else {
StringBuilder L = c.d.b.a.a.L("Invalid value for the flex direction is set: ");
L.append(this.i);
throw new IllegalStateException(L.toString());
}
}
z2 = true;
if (z2) {
}
i3 = this.i;
if (i3 != 0) {
}
this.f2282x.clear();
this.f2283y.a();
this.w.b(this.f2283y, i, i2, Integer.MAX_VALUE, 0, -1, null);
this.f2282x = this.f2283y.a;
this.w.h(i, i2, 0);
if (this.l == 3) {
}
this.w.g(i, i2, getPaddingBottom() + getPaddingTop());
this.w.A(0);
u(this.i, i, i2, this.f2283y.b);
}
public final boolean p(int i, int i2) {
boolean z2;
int i3 = 1;
while (true) {
if (i3 > i2) {
z2 = true;
break;
}
View o = o(i - i3);
if (o != null && o.getVisibility() != 8) {
z2 = false;
break;
}
i3++;
}
return z2 ? i() ? (this.r & 1) != 0 : (this.q & 1) != 0 : i() ? (this.r & 2) != 0 : (this.q & 2) != 0;
}
public final boolean q(int i) {
boolean z2;
if (i < 0 || i >= this.f2282x.size()) {
return false;
}
int i2 = 0;
while (true) {
if (i2 >= i) {
z2 = true;
break;
} else if (this.f2282x.get(i2).a() > 0) {
z2 = false;
break;
} else {
i2++;
}
}
return z2 ? i() ? (this.q & 1) != 0 : (this.r & 1) != 0 : i() ? (this.q & 2) != 0 : (this.r & 2) != 0;
}
public final boolean r(int i) {
if (i < 0 || i >= this.f2282x.size()) {
return false;
}
for (int i2 = i + 1; i2 < this.f2282x.size(); i2++) {
if (this.f2282x.get(i2).a() > 0) {
return false;
}
}
return i() ? (this.q & 4) != 0 : (this.r & 4) != 0;
}
/* JADX WARNING: Removed duplicated region for block: B:39:0x00d9 */
public final void s(boolean z2, int i, int i2, int i3, int i4) {
float f;
float f2;
float f3;
int i5;
int i6;
int i7;
int i8;
float f4;
float f5;
LayoutParams layoutParams;
int paddingLeft = getPaddingLeft();
int paddingRight = getPaddingRight();
int i9 = i3 - i;
int paddingBottom = (i4 - i2) - getPaddingBottom();
int paddingTop = getPaddingTop();
int size = this.f2282x.size();
int i10 = 0;
while (i10 < size) {
b bVar = this.f2282x.get(i10);
if (q(i10)) {
int i11 = this.f2281s;
paddingBottom -= i11;
paddingTop += i11;
}
int i12 = this.k;
int i13 = 1;
if (i12 == 0) {
f3 = (float) paddingLeft;
f = (float) (i9 - paddingRight);
} else if (i12 == 1) {
int i14 = bVar.e;
f = (float) (i14 - paddingLeft);
f3 = (float) ((i9 - i14) + paddingRight);
} else if (i12 != 2) {
if (i12 == 3) {
f3 = (float) paddingLeft;
int a = bVar.a();
f2 = ((float) (i9 - bVar.e)) / (a != 1 ? (float) (a - 1) : 1.0f);
f = (float) (i9 - paddingRight);
} else if (i12 == 4) {
int a2 = bVar.a();
f2 = a2 != 0 ? ((float) (i9 - bVar.e)) / ((float) a2) : 0.0f;
float f6 = f2 / 2.0f;
f3 = ((float) paddingLeft) + f6;
f = ((float) (i9 - paddingRight)) - f6;
} else if (i12 == 5) {
int a3 = bVar.a();
f2 = a3 != 0 ? ((float) (i9 - bVar.e)) / ((float) (a3 + 1)) : 0.0f;
f3 = ((float) paddingLeft) + f2;
f = ((float) (i9 - paddingRight)) - f2;
} else {
StringBuilder L = c.d.b.a.a.L("Invalid justifyContent is set: ");
L.append(this.k);
throw new IllegalStateException(L.toString());
}
float max = Math.max(f2, 0.0f);
i5 = 0;
while (i5 < bVar.h) {
int i15 = bVar.o + i5;
View o = o(i15);
if (o == null || o.getVisibility() == 8) {
i6 = paddingLeft;
i7 = i5;
} else {
LayoutParams layoutParams2 = (LayoutParams) o.getLayoutParams();
float f7 = f3 + ((float) ((ViewGroup.MarginLayoutParams) layoutParams2).leftMargin);
float f8 = f - ((float) ((ViewGroup.MarginLayoutParams) layoutParams2).rightMargin);
if (p(i15, i5)) {
int i16 = this.t;
float f9 = (float) i16;
f5 = f7 + f9;
i8 = i16;
f4 = f8 - f9;
} else {
f5 = f7;
f4 = f8;
i8 = 0;
}
int i17 = (i5 != bVar.h - i13 || (this.r & 4) <= 0) ? 0 : this.t;
if (this.j != 2) {
i6 = paddingLeft;
layoutParams = layoutParams2;
i7 = i5;
if (z2) {
this.w.u(o, bVar, Math.round(f4) - o.getMeasuredWidth(), paddingTop, Math.round(f4), o.getMeasuredHeight() + paddingTop);
} else {
this.w.u(o, bVar, Math.round(f5), paddingTop, o.getMeasuredWidth() + Math.round(f5), o.getMeasuredHeight() + paddingTop);
}
} else if (z2) {
i6 = paddingLeft;
layoutParams = layoutParams2;
i7 = i5;
this.w.u(o, bVar, Math.round(f4) - o.getMeasuredWidth(), paddingBottom - o.getMeasuredHeight(), Math.round(f4), paddingBottom);
} else {
i6 = paddingLeft;
layoutParams = layoutParams2;
i7 = i5;
this.w.u(o, bVar, Math.round(f5), paddingBottom - o.getMeasuredHeight(), o.getMeasuredWidth() + Math.round(f5), paddingBottom);
}
float measuredWidth = ((float) o.getMeasuredWidth()) + max + ((float) ((ViewGroup.MarginLayoutParams) layoutParams).rightMargin) + f5;
float measuredWidth2 = f4 - ((((float) o.getMeasuredWidth()) + max) + ((float) ((ViewGroup.MarginLayoutParams) layoutParams).leftMargin));
if (z2) {
bVar.b(o, i17, 0, i8, 0);
} else {
bVar.b(o, i8, 0, i17, 0);
}
f3 = measuredWidth;
f = measuredWidth2;
}
i5 = i7 + 1;
i13 = 1;
paddingLeft = i6;
}
int i18 = bVar.g;
paddingTop += i18;
paddingBottom -= i18;
i10++;
paddingLeft = paddingLeft;
} else {
int i19 = bVar.e;
f = ((float) (i9 - paddingRight)) - (((float) (i9 - i19)) / 2.0f);
f3 = (((float) (i9 - i19)) / 2.0f) + ((float) paddingLeft);
}
f2 = 0.0f;
float max = Math.max(f2, 0.0f);
i5 = 0;
while (i5 < bVar.h) {
}
int i18 = bVar.g;
paddingTop += i18;
paddingBottom -= i18;
i10++;
paddingLeft = paddingLeft;
}
}
public void setAlignContent(int i) {
if (this.m != i) {
this.m = i;
requestLayout();
}
}
public void setAlignItems(int i) {
if (this.l != i) {
this.l = i;
requestLayout();
}
}
public void setDividerDrawable(Drawable drawable) {
setDividerDrawableHorizontal(drawable);
setDividerDrawableVertical(drawable);
}
public void setDividerDrawableHorizontal(@Nullable Drawable drawable) {
if (drawable != this.o) {
this.o = drawable;
if (drawable != null) {
this.f2281s = drawable.getIntrinsicHeight();
} else {
this.f2281s = 0;
}
if (this.o == null && this.p == null) {
setWillNotDraw(true);
} else {
setWillNotDraw(false);
}
requestLayout();
}
}
public void setDividerDrawableVertical(@Nullable Drawable drawable) {
if (drawable != this.p) {
this.p = drawable;
if (drawable != null) {
this.t = drawable.getIntrinsicWidth();
} else {
this.t = 0;
}
if (this.o == null && this.p == null) {
setWillNotDraw(true);
} else {
setWillNotDraw(false);
}
requestLayout();
}
}
public void setFlexDirection(int i) {
if (this.i != i) {
this.i = i;
requestLayout();
}
}
@Override // c.i.a.e.a
public void setFlexLines(List<b> list) {
this.f2282x = list;
}
public void setFlexWrap(int i) {
if (this.j != i) {
this.j = i;
requestLayout();
}
}
public void setJustifyContent(int i) {
if (this.k != i) {
this.k = i;
requestLayout();
}
}
public void setMaxLine(int i) {
if (this.n != i) {
this.n = i;
requestLayout();
}
}
public void setShowDivider(int i) {
setShowDividerVertical(i);
setShowDividerHorizontal(i);
}
public void setShowDividerHorizontal(int i) {
if (i != this.q) {
this.q = i;
requestLayout();
}
}
public void setShowDividerVertical(int i) {
if (i != this.r) {
this.r = i;
requestLayout();
}
}
/* JADX WARNING: Removed duplicated region for block: B:40:0x00d7 */
public final void t(boolean z2, boolean z3, int i, int i2, int i3, int i4) {
float f;
float f2;
float f3;
int i5;
int i6;
int i7;
float f4;
float f5;
LayoutParams layoutParams;
float f6;
int i8;
int paddingTop = getPaddingTop();
int paddingBottom = getPaddingBottom();
int paddingRight = getPaddingRight();
int paddingLeft = getPaddingLeft();
int i9 = i4 - i2;
int i10 = (i3 - i) - paddingRight;
int size = this.f2282x.size();
for (int i11 = 0; i11 < size; i11++) {
b bVar = this.f2282x.get(i11);
if (q(i11)) {
int i12 = this.t;
paddingLeft += i12;
i10 -= i12;
}
int i13 = this.k;
if (i13 == 0) {
f6 = (float) paddingTop;
i8 = i9 - paddingBottom;
} else if (i13 == 1) {
int i14 = bVar.e;
f6 = (float) ((i9 - i14) + paddingBottom);
i8 = i14 - paddingTop;
} else if (i13 != 2) {
if (i13 == 3) {
f3 = (float) paddingTop;
int a = bVar.a();
f2 = ((float) (i9 - bVar.e)) / (a != 1 ? (float) (a - 1) : 1.0f);
f = (float) (i9 - paddingBottom);
} else if (i13 == 4) {
int a2 = bVar.a();
f2 = a2 != 0 ? ((float) (i9 - bVar.e)) / ((float) a2) : 0.0f;
float f7 = f2 / 2.0f;
f3 = ((float) paddingTop) + f7;
f = ((float) (i9 - paddingBottom)) - f7;
} else if (i13 == 5) {
int a3 = bVar.a();
f2 = a3 != 0 ? ((float) (i9 - bVar.e)) / ((float) (a3 + 1)) : 0.0f;
f3 = ((float) paddingTop) + f2;
f = ((float) (i9 - paddingBottom)) - f2;
} else {
StringBuilder L = c.d.b.a.a.L("Invalid justifyContent is set: ");
L.append(this.k);
throw new IllegalStateException(L.toString());
}
float max = Math.max(f2, 0.0f);
i5 = 0;
while (i5 < bVar.h) {
int i15 = bVar.o + i5;
View o = o(i15);
if (o == null || o.getVisibility() == 8) {
i6 = i5;
} else {
LayoutParams layoutParams2 = (LayoutParams) o.getLayoutParams();
float f8 = f3 + ((float) ((ViewGroup.MarginLayoutParams) layoutParams2).topMargin);
float f9 = f - ((float) ((ViewGroup.MarginLayoutParams) layoutParams2).bottomMargin);
if (p(i15, i5)) {
int i16 = this.f2281s;
float f10 = (float) i16;
f5 = f8 + f10;
i7 = i16;
f4 = f9 - f10;
} else {
f5 = f8;
f4 = f9;
i7 = 0;
}
int i17 = (i5 != bVar.h + -1 || (this.q & 4) <= 0) ? 0 : this.f2281s;
if (!z2) {
layoutParams = layoutParams2;
i6 = i5;
if (z3) {
this.w.v(o, bVar, false, paddingLeft, Math.round(f4) - o.getMeasuredHeight(), o.getMeasuredWidth() + paddingLeft, Math.round(f4));
} else {
this.w.v(o, bVar, false, paddingLeft, Math.round(f5), o.getMeasuredWidth() + paddingLeft, o.getMeasuredHeight() + Math.round(f5));
}
} else if (z3) {
layoutParams = layoutParams2;
i6 = i5;
this.w.v(o, bVar, true, i10 - o.getMeasuredWidth(), Math.round(f4) - o.getMeasuredHeight(), i10, Math.round(f4));
} else {
layoutParams = layoutParams2;
i6 = i5;
this.w.v(o, bVar, true, i10 - o.getMeasuredWidth(), Math.round(f5), i10, o.getMeasuredHeight() + Math.round(f5));
}
float measuredHeight = ((float) o.getMeasuredHeight()) + max + ((float) ((ViewGroup.MarginLayoutParams) layoutParams).bottomMargin) + f5;
float measuredHeight2 = f4 - ((((float) o.getMeasuredHeight()) + max) + ((float) ((ViewGroup.MarginLayoutParams) layoutParams).topMargin));
if (z3) {
bVar.b(o, 0, i17, 0, i7);
} else {
bVar.b(o, 0, i7, 0, i17);
}
f3 = measuredHeight;
f = measuredHeight2;
}
i5 = i6 + 1;
}
int i18 = bVar.g;
paddingLeft += i18;
i10 -= i18;
} else {
int i19 = bVar.e;
f = ((float) (i9 - paddingBottom)) - (((float) (i9 - i19)) / 2.0f);
f3 = (((float) (i9 - i19)) / 2.0f) + ((float) paddingTop);
f2 = 0.0f;
float max = Math.max(f2, 0.0f);
i5 = 0;
while (i5 < bVar.h) {
}
int i18 = bVar.g;
paddingLeft += i18;
i10 -= i18;
}
f = (float) i8;
f3 = f6;
f2 = 0.0f;
float max = Math.max(f2, 0.0f);
i5 = 0;
while (i5 < bVar.h) {
}
int i18 = bVar.g;
paddingLeft += i18;
i10 -= i18;
}
}
public final void u(int i, int i2, int i3, int i4) {
int i5;
int i6;
int i7;
int i8;
int mode = View.MeasureSpec.getMode(i2);
int size = View.MeasureSpec.getSize(i2);
int mode2 = View.MeasureSpec.getMode(i3);
int size2 = View.MeasureSpec.getSize(i3);
if (i == 0 || i == 1) {
i5 = getPaddingBottom() + getPaddingTop() + getSumOfCrossSize();
i6 = getLargestMainSize();
} else if (i == 2 || i == 3) {
i5 = getLargestMainSize();
i6 = getPaddingRight() + getPaddingLeft() + getSumOfCrossSize();
} else {
throw new IllegalArgumentException(c.d.b.a.a.k("Invalid flex direction: ", i));
}
if (mode == Integer.MIN_VALUE) {
if (size < i6) {
i4 = View.combineMeasuredStates(i4, 16777216);
} else {
size = i6;
}
i7 = View.resolveSizeAndState(size, i2, i4);
} else if (mode == 0) {
i7 = View.resolveSizeAndState(i6, i2, i4);
} else if (mode == 1073741824) {
if (size < i6) {
i4 = View.combineMeasuredStates(i4, 16777216);
}
i7 = View.resolveSizeAndState(size, i2, i4);
} else {
throw new IllegalStateException(c.d.b.a.a.k("Unknown width mode is set: ", mode));
}
if (mode2 == Integer.MIN_VALUE) {
if (size2 < i5) {
i4 = View.combineMeasuredStates(i4, 256);
} else {
size2 = i5;
}
i8 = View.resolveSizeAndState(size2, i3, i4);
} else if (mode2 == 0) {
i8 = View.resolveSizeAndState(i5, i3, i4);
} else if (mode2 == 1073741824) {
if (size2 < i5) {
i4 = View.combineMeasuredStates(i4, 256);
}
i8 = View.resolveSizeAndState(size2, i3, i4);
} else {
throw new IllegalStateException(c.d.b.a.a.k("Unknown height mode is set: ", mode2));
}
setMeasuredDimension(i7, i8);
}
}