package androidx.appcompat.widget;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
import android.widget.LinearLayout;
import defpackage.ema;
import defpackage.fp9;
import defpackage.go7;
import defpackage.m38;
import defpackage.nx3;
import defpackage.sia;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.WeakHashMap;

/* JADX INFO: loaded from: classes.dex */
public class h extends ViewGroup {
    private static final String ACCESSIBILITY_CLASS_NAME = "androidx.appcompat.widget.LinearLayoutCompat";
    public static final int HORIZONTAL = 0;
    private static final int INDEX_BOTTOM = 2;
    private static final int INDEX_CENTER_VERTICAL = 0;
    private static final int INDEX_FILL = 3;
    private static final int INDEX_TOP = 1;
    public static final int SHOW_DIVIDER_BEGINNING = 1;
    public static final int SHOW_DIVIDER_END = 4;
    public static final int SHOW_DIVIDER_MIDDLE = 2;
    public static final int SHOW_DIVIDER_NONE = 0;
    public static final int VERTICAL = 1;
    private static final int VERTICAL_GRAVITY_COUNT = 4;
    private boolean mBaselineAligned;
    private int mBaselineAlignedChildIndex;
    private int mBaselineChildTop;
    private Drawable mDivider;
    private int mDividerHeight;
    private int mDividerPadding;
    private int mDividerWidth;
    private int mGravity;
    private int[] mMaxAscent;
    private int[] mMaxDescent;
    private int mOrientation;
    private int mShowDividers;
    private int mTotalLength;
    private boolean mUseLargestChild;
    private float mWeightSum;

    @m38
    @Retention(RetentionPolicy.SOURCE)
    public @interface a {
    }

    public static class b extends LinearLayout.LayoutParams {
    }

    @m38
    @Retention(RetentionPolicy.SOURCE)
    public @interface c {
    }

    public h(Context context, AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
        this.mBaselineAligned = true;
        this.mBaselineAlignedChildIndex = -1;
        this.mBaselineChildTop = 0;
        this.mGravity = 8388659;
        int[] iArr = go7.m.o;
        fp9 fp9VarF = fp9.f(context, attributeSet, iArr, i, 0);
        sia.y(this, context, iArr, attributeSet, fp9VarF.b, i, 0);
        TypedArray typedArray = fp9VarF.b;
        int i2 = typedArray.getInt(1, -1);
        if (i2 >= 0) {
            setOrientation(i2);
        }
        int i3 = typedArray.getInt(0, -1);
        if (i3 >= 0) {
            setGravity(i3);
        }
        boolean z = typedArray.getBoolean(2, true);
        if (!z) {
            setBaselineAligned(z);
        }
        this.mWeightSum = typedArray.getFloat(4, -1.0f);
        this.mBaselineAlignedChildIndex = typedArray.getInt(3, -1);
        this.mUseLargestChild = typedArray.getBoolean(7, false);
        setDividerDrawable(fp9VarF.b(5));
        this.mShowDividers = typedArray.getInt(8, 0);
        this.mDividerPadding = typedArray.getDimensionPixelSize(6, 0);
        fp9VarF.g();
    }

    @Override // android.view.ViewGroup
    public boolean checkLayoutParams(ViewGroup.LayoutParams layoutParams) {
        return layoutParams instanceof b;
    }

    public void drawDividersHorizontal(Canvas canvas) {
        int right;
        int left;
        int i;
        int virtualChildCount = getVirtualChildCount();
        boolean zA = ema.a(this);
        for (int i2 = 0; i2 < virtualChildCount; i2++) {
            View virtualChildAt = getVirtualChildAt(i2);
            if (virtualChildAt != null && virtualChildAt.getVisibility() != 8 && hasDividerBeforeChildAt(i2)) {
                b bVar = (b) virtualChildAt.getLayoutParams();
                drawVerticalDivider(canvas, zA ? virtualChildAt.getRight() + ((LinearLayout.LayoutParams) bVar).rightMargin : (virtualChildAt.getLeft() - ((LinearLayout.LayoutParams) bVar).leftMargin) - this.mDividerWidth);
            }
        }
        if (hasDividerBeforeChildAt(virtualChildCount)) {
            View virtualChildAt2 = getVirtualChildAt(virtualChildCount - 1);
            if (virtualChildAt2 != null) {
                b bVar2 = (b) virtualChildAt2.getLayoutParams();
                if (zA) {
                    left = virtualChildAt2.getLeft() - ((LinearLayout.LayoutParams) bVar2).leftMargin;
                    i = this.mDividerWidth;
                    right = left - i;
                } else {
                    right = virtualChildAt2.getRight() + ((LinearLayout.LayoutParams) bVar2).rightMargin;
                }
            } else if (zA) {
                right = getPaddingLeft();
            } else {
                left = getWidth() - getPaddingRight();
                i = this.mDividerWidth;
                right = left - i;
            }
            drawVerticalDivider(canvas, right);
        }
    }

    public void drawDividersVertical(Canvas canvas) {
        int virtualChildCount = getVirtualChildCount();
        for (int i = 0; i < virtualChildCount; i++) {
            View virtualChildAt = getVirtualChildAt(i);
            if (virtualChildAt != null && virtualChildAt.getVisibility() != 8 && hasDividerBeforeChildAt(i)) {
                drawHorizontalDivider(canvas, (virtualChildAt.getTop() - ((LinearLayout.LayoutParams) ((b) virtualChildAt.getLayoutParams())).topMargin) - this.mDividerHeight);
            }
        }
        if (hasDividerBeforeChildAt(virtualChildCount)) {
            View virtualChildAt2 = getVirtualChildAt(virtualChildCount - 1);
            drawHorizontalDivider(canvas, virtualChildAt2 == null ? (getHeight() - getPaddingBottom()) - this.mDividerHeight : virtualChildAt2.getBottom() + ((LinearLayout.LayoutParams) ((b) virtualChildAt2.getLayoutParams())).bottomMargin);
        }
    }

    public void drawHorizontalDivider(Canvas canvas, int i) {
        this.mDivider.setBounds(getPaddingLeft() + this.mDividerPadding, i, (getWidth() - getPaddingRight()) - this.mDividerPadding, this.mDividerHeight + i);
        this.mDivider.draw(canvas);
    }

    public void drawVerticalDivider(Canvas canvas, int i) {
        this.mDivider.setBounds(i, getPaddingTop() + this.mDividerPadding, this.mDividerWidth + i, (getHeight() - getPaddingBottom()) - this.mDividerPadding);
        this.mDivider.draw(canvas);
    }

    @Override // android.view.View
    public int getBaseline() {
        int i;
        if (this.mBaselineAlignedChildIndex < 0) {
            return super.getBaseline();
        }
        int childCount = getChildCount();
        int i2 = this.mBaselineAlignedChildIndex;
        if (childCount <= i2) {
            throw new RuntimeException("mBaselineAlignedChildIndex of LinearLayout set to an index that is out of bounds.");
        }
        View childAt = getChildAt(i2);
        int baseline = childAt.getBaseline();
        if (baseline == -1) {
            if (this.mBaselineAlignedChildIndex == 0) {
                return -1;
            }
            throw new RuntimeException("mBaselineAlignedChildIndex of LinearLayout points to a View that doesn't know how to get its baseline.");
        }
        int bottom = this.mBaselineChildTop;
        if (this.mOrientation == 1 && (i = this.mGravity & 112) != 48) {
            if (i == 16) {
                bottom += ((((getBottom() - getTop()) - getPaddingTop()) - getPaddingBottom()) - this.mTotalLength) / 2;
            } else if (i == 80) {
                bottom = ((getBottom() - getTop()) - getPaddingBottom()) - this.mTotalLength;
            }
        }
        return bottom + ((LinearLayout.LayoutParams) ((b) childAt.getLayoutParams())).topMargin + baseline;
    }

    public int getBaselineAlignedChildIndex() {
        return this.mBaselineAlignedChildIndex;
    }

    public int getChildrenSkipCount(View view, int i) {
        return 0;
    }

    public Drawable getDividerDrawable() {
        return this.mDivider;
    }

    public int getDividerPadding() {
        return this.mDividerPadding;
    }

    @m38
    public int getDividerWidth() {
        return this.mDividerWidth;
    }

    @nx3
    public int getGravity() {
        return this.mGravity;
    }

    public int getLocationOffset(View view) {
        return 0;
    }

    public int getNextLocationOffset(View view) {
        return 0;
    }

    public int getOrientation() {
        return this.mOrientation;
    }

    public int getShowDividers() {
        return this.mShowDividers;
    }

    public View getVirtualChildAt(int i) {
        return getChildAt(i);
    }

    public int getVirtualChildCount() {
        return getChildCount();
    }

    public float getWeightSum() {
        return this.mWeightSum;
    }

    @m38
    public boolean hasDividerBeforeChildAt(int i) {
        if (i == 0) {
            return (this.mShowDividers & 1) != 0;
        }
        if (i == getChildCount()) {
            return (this.mShowDividers & 4) != 0;
        }
        if ((this.mShowDividers & 2) != 0) {
            for (int i2 = i - 1; i2 >= 0; i2--) {
                if (getChildAt(i2).getVisibility() != 8) {
                    return true;
                }
            }
        }
        return false;
    }

    public boolean isBaselineAligned() {
        return this.mBaselineAligned;
    }

    public boolean isMeasureWithLargestChildEnabled() {
        return this.mUseLargestChild;
    }

    /* JADX WARN: Removed duplicated region for block: B:28:0x00b3  */
    /* JADX WARN: Removed duplicated region for block: B:31:0x00bc  */
    /* JADX WARN: Removed duplicated region for block: B:42:0x00ea  */
    /* JADX WARN: Removed duplicated region for block: B:45:0x00fe  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public void layoutHorizontal(int i, int i2, int i3, int i4) {
        int i5;
        int i6;
        int i7;
        int i8;
        int i9;
        int i10;
        int i11;
        int i12;
        int measuredHeight;
        boolean zA = ema.a(this);
        int paddingTop = getPaddingTop();
        int i13 = i4 - i2;
        int paddingBottom = i13 - getPaddingBottom();
        int paddingBottom2 = (i13 - paddingTop) - getPaddingBottom();
        int virtualChildCount = getVirtualChildCount();
        int i14 = this.mGravity;
        int i15 = 8388615 & i14;
        int i16 = i14 & 112;
        boolean z = this.mBaselineAligned;
        int[] iArr = this.mMaxAscent;
        int[] iArr2 = this.mMaxDescent;
        WeakHashMap weakHashMap = sia.a;
        int absoluteGravity = Gravity.getAbsoluteGravity(i15, getLayoutDirection());
        char c2 = 2;
        char c3 = 1;
        int paddingLeft = absoluteGravity != 1 ? absoluteGravity != 5 ? getPaddingLeft() : ((getPaddingLeft() + i3) - i) - this.mTotalLength : getPaddingLeft() + (((i3 - i) - this.mTotalLength) / 2);
        int childrenSkipCount = 0;
        if (zA) {
            i6 = virtualChildCount - 1;
            i5 = -1;
        } else {
            i5 = 1;
            i6 = 0;
        }
        while (childrenSkipCount < virtualChildCount) {
            char c4 = c2;
            int i17 = (i5 * childrenSkipCount) + i6;
            char c5 = c3;
            View virtualChildAt = getVirtualChildAt(i17);
            if (virtualChildAt == null) {
                i7 = i6;
                i8 = paddingTop;
                i9 = paddingBottom2;
                i10 = paddingBottom;
                paddingLeft = measureNullChild(i17) + paddingLeft;
            } else {
                i7 = i6;
                if (virtualChildAt.getVisibility() != 8) {
                    int measuredWidth = virtualChildAt.getMeasuredWidth();
                    int measuredHeight2 = virtualChildAt.getMeasuredHeight();
                    b bVar = (b) virtualChildAt.getLayoutParams();
                    i8 = paddingTop;
                    if (z) {
                        i9 = paddingBottom2;
                        int baseline = ((LinearLayout.LayoutParams) bVar).height != -1 ? virtualChildAt.getBaseline() : -1;
                        i11 = ((LinearLayout.LayoutParams) bVar).gravity;
                        if (i11 < 0) {
                            i11 = i16;
                        }
                        i12 = i11 & 112;
                        i10 = paddingBottom;
                        if (i12 != 16) {
                            measuredHeight = ((((i9 - measuredHeight2) / 2) + i8) + ((LinearLayout.LayoutParams) bVar).topMargin) - ((LinearLayout.LayoutParams) bVar).bottomMargin;
                        } else if (i12 == 48) {
                            measuredHeight = i8 + ((LinearLayout.LayoutParams) bVar).topMargin;
                            if (baseline != -1) {
                                measuredHeight = (iArr[c5] - baseline) + measuredHeight;
                            }
                        } else if (i12 != 80) {
                            measuredHeight = i8;
                        } else {
                            measuredHeight = (i10 - measuredHeight2) - ((LinearLayout.LayoutParams) bVar).bottomMargin;
                            if (baseline != -1) {
                                measuredHeight -= iArr2[c4] - (virtualChildAt.getMeasuredHeight() - baseline);
                            }
                        }
                        if (hasDividerBeforeChildAt(i17)) {
                            paddingLeft += this.mDividerWidth;
                        }
                        int i18 = paddingLeft + ((LinearLayout.LayoutParams) bVar).leftMargin;
                        int locationOffset = getLocationOffset(virtualChildAt) + i18;
                        virtualChildAt.layout(locationOffset, measuredHeight, locationOffset + measuredWidth, measuredHeight2 + measuredHeight);
                        int nextLocationOffset = getNextLocationOffset(virtualChildAt) + measuredWidth + ((LinearLayout.LayoutParams) bVar).rightMargin + i18;
                        childrenSkipCount += getChildrenSkipCount(virtualChildAt, i17);
                        paddingLeft = nextLocationOffset;
                    } else {
                        i9 = paddingBottom2;
                    }
                    i11 = ((LinearLayout.LayoutParams) bVar).gravity;
                    if (i11 < 0) {
                    }
                    i12 = i11 & 112;
                    i10 = paddingBottom;
                    if (i12 != 16) {
                    }
                    if (hasDividerBeforeChildAt(i17)) {
                    }
                    int i182 = paddingLeft + ((LinearLayout.LayoutParams) bVar).leftMargin;
                    int locationOffset2 = getLocationOffset(virtualChildAt) + i182;
                    virtualChildAt.layout(locationOffset2, measuredHeight, locationOffset2 + measuredWidth, measuredHeight2 + measuredHeight);
                    int nextLocationOffset2 = getNextLocationOffset(virtualChildAt) + measuredWidth + ((LinearLayout.LayoutParams) bVar).rightMargin + i182;
                    childrenSkipCount += getChildrenSkipCount(virtualChildAt, i17);
                    paddingLeft = nextLocationOffset2;
                } else {
                    i8 = paddingTop;
                    i9 = paddingBottom2;
                    i10 = paddingBottom;
                }
            }
            childrenSkipCount++;
            c2 = c4;
            i6 = i7;
            c3 = c5;
            paddingTop = i8;
            paddingBottom2 = i9;
            paddingBottom = i10;
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:29:0x0099  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public void layoutVertical(int i, int i2, int i3, int i4) {
        int i5;
        int i6;
        int i7;
        int paddingLeft = getPaddingLeft();
        int i8 = i3 - i;
        int paddingRight = i8 - getPaddingRight();
        int paddingRight2 = (i8 - paddingLeft) - getPaddingRight();
        int virtualChildCount = getVirtualChildCount();
        int i9 = this.mGravity;
        int i10 = i9 & 112;
        int i11 = i9 & 8388615;
        int paddingTop = i10 != 16 ? i10 != 80 ? getPaddingTop() : ((getPaddingTop() + i4) - i2) - this.mTotalLength : (((i4 - i2) - this.mTotalLength) / 2) + getPaddingTop();
        int childrenSkipCount = 0;
        while (childrenSkipCount < virtualChildCount) {
            View virtualChildAt = getVirtualChildAt(childrenSkipCount);
            if (virtualChildAt == null) {
                paddingTop = measureNullChild(childrenSkipCount) + paddingTop;
            } else if (virtualChildAt.getVisibility() != 8) {
                int measuredWidth = virtualChildAt.getMeasuredWidth();
                int measuredHeight = virtualChildAt.getMeasuredHeight();
                b bVar = (b) virtualChildAt.getLayoutParams();
                int i12 = ((LinearLayout.LayoutParams) bVar).gravity;
                if (i12 < 0) {
                    i12 = i11;
                }
                WeakHashMap weakHashMap = sia.a;
                int absoluteGravity = Gravity.getAbsoluteGravity(i12, getLayoutDirection()) & 7;
                if (absoluteGravity == 1) {
                    i5 = ((paddingRight2 - measuredWidth) / 2) + paddingLeft + ((LinearLayout.LayoutParams) bVar).leftMargin;
                    i6 = ((LinearLayout.LayoutParams) bVar).rightMargin;
                } else if (absoluteGravity != 5) {
                    i7 = ((LinearLayout.LayoutParams) bVar).leftMargin + paddingLeft;
                    if (hasDividerBeforeChildAt(childrenSkipCount)) {
                        paddingTop += this.mDividerHeight;
                    }
                    int i13 = paddingTop + ((LinearLayout.LayoutParams) bVar).topMargin;
                    int locationOffset = getLocationOffset(virtualChildAt) + i13;
                    virtualChildAt.layout(i7, locationOffset, measuredWidth + i7, locationOffset + measuredHeight);
                    int nextLocationOffset = getNextLocationOffset(virtualChildAt) + measuredHeight + ((LinearLayout.LayoutParams) bVar).bottomMargin + i13;
                    childrenSkipCount += getChildrenSkipCount(virtualChildAt, childrenSkipCount);
                    paddingTop = nextLocationOffset;
                } else {
                    i5 = paddingRight - measuredWidth;
                    i6 = ((LinearLayout.LayoutParams) bVar).rightMargin;
                }
                i7 = i5 - i6;
                if (hasDividerBeforeChildAt(childrenSkipCount)) {
                }
                int i132 = paddingTop + ((LinearLayout.LayoutParams) bVar).topMargin;
                int locationOffset2 = getLocationOffset(virtualChildAt) + i132;
                virtualChildAt.layout(i7, locationOffset2, measuredWidth + i7, locationOffset2 + measuredHeight);
                int nextLocationOffset2 = getNextLocationOffset(virtualChildAt) + measuredHeight + ((LinearLayout.LayoutParams) bVar).bottomMargin + i132;
                childrenSkipCount += getChildrenSkipCount(virtualChildAt, childrenSkipCount);
                paddingTop = nextLocationOffset2;
            }
            childrenSkipCount++;
        }
    }

    public void measureChildBeforeLayout(View view, int i, int i2, int i3, int i4, int i5) {
        measureChildWithMargins(view, i2, i3, i4, i5);
    }

    /* JADX WARN: Removed duplicated region for block: B:198:0x0447  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public void measureHorizontal(int i, int i2) {
        int i3;
        int i4;
        int i5;
        int i6;
        int iMax;
        int i7;
        int i8;
        int i9;
        int baseline;
        int i10;
        int i11;
        int i12;
        int childrenSkipCount;
        byte b2;
        int i13;
        boolean z;
        int i14;
        int i15;
        int i16;
        int[] iArr;
        int i17;
        int i18;
        boolean z2;
        int[] iArr2;
        View view;
        boolean z3;
        int baseline2;
        h hVar = this;
        hVar.mTotalLength = 0;
        int virtualChildCount = hVar.getVirtualChildCount();
        int mode = View.MeasureSpec.getMode(i);
        int mode2 = View.MeasureSpec.getMode(i2);
        if (hVar.mMaxAscent == null || hVar.mMaxDescent == null) {
            hVar.mMaxAscent = new int[4];
            hVar.mMaxDescent = new int[4];
        }
        int[] iArr3 = hVar.mMaxAscent;
        int[] iArr4 = hVar.mMaxDescent;
        iArr3[3] = -1;
        iArr3[2] = -1;
        iArr3[1] = -1;
        iArr3[0] = -1;
        iArr4[3] = -1;
        iArr4[2] = -1;
        iArr4[1] = -1;
        iArr4[0] = -1;
        boolean z4 = hVar.mBaselineAligned;
        boolean z5 = hVar.mUseLargestChild;
        int i19 = 1073741824;
        boolean z6 = mode == 1073741824;
        boolean z7 = z5;
        int childrenSkipCount2 = 0;
        int i20 = 0;
        int iMax2 = 0;
        boolean z8 = false;
        int iCombineMeasuredStates = 0;
        boolean z9 = false;
        boolean z10 = true;
        float f = 0.0f;
        int iMax3 = 0;
        int iMax4 = 0;
        while (true) {
            i3 = i20;
            if (childrenSkipCount2 >= virtualChildCount) {
                break;
            }
            boolean z11 = z4;
            View virtualChildAt = hVar.getVirtualChildAt(childrenSkipCount2);
            if (virtualChildAt == null) {
                hVar.mTotalLength = hVar.measureNullChild(childrenSkipCount2) + hVar.mTotalLength;
            } else if (virtualChildAt.getVisibility() == 8) {
                childrenSkipCount2 += hVar.getChildrenSkipCount(virtualChildAt, childrenSkipCount2);
            } else {
                if (hVar.hasDividerBeforeChildAt(childrenSkipCount2)) {
                    hVar.mTotalLength += hVar.mDividerWidth;
                }
                b bVar = (b) virtualChildAt.getLayoutParams();
                float f2 = ((LinearLayout.LayoutParams) bVar).weight;
                float f3 = f + f2;
                if (mode == i19 && ((LinearLayout.LayoutParams) bVar).width == 0 && f2 > 0.0f) {
                    if (z6) {
                        hVar.mTotalLength = ((LinearLayout.LayoutParams) bVar).leftMargin + ((LinearLayout.LayoutParams) bVar).rightMargin + hVar.mTotalLength;
                    } else {
                        int i21 = hVar.mTotalLength;
                        hVar.mTotalLength = Math.max(i21, ((LinearLayout.LayoutParams) bVar).leftMargin + i21 + ((LinearLayout.LayoutParams) bVar).rightMargin);
                    }
                    if (z11) {
                        int iMakeMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, 0);
                        virtualChildAt.measure(iMakeMeasureSpec, iMakeMeasureSpec);
                        view = virtualChildAt;
                        i15 = virtualChildCount;
                        i16 = mode;
                        iArr = iArr3;
                        iArr2 = iArr4;
                    } else {
                        view = virtualChildAt;
                        i15 = virtualChildCount;
                        i16 = mode;
                        iArr = iArr3;
                        iArr2 = iArr4;
                        z8 = true;
                    }
                    i17 = i3;
                    i18 = 1073741824;
                    z2 = z7;
                } else {
                    if (((LinearLayout.LayoutParams) bVar).width != 0 || f2 <= 0.0f) {
                        b2 = -2;
                        i13 = Integer.MIN_VALUE;
                    } else {
                        b2 = -2;
                        ((LinearLayout.LayoutParams) bVar).width = -2;
                        i13 = 0;
                    }
                    if (f3 == 0.0f) {
                        z = z7;
                        i14 = hVar.mTotalLength;
                    } else {
                        z = z7;
                        i14 = 0;
                    }
                    i15 = virtualChildCount;
                    i16 = mode;
                    iArr = iArr3;
                    i17 = i3;
                    i18 = 1073741824;
                    z2 = z;
                    iArr2 = iArr4;
                    int i22 = i13;
                    hVar.measureChildBeforeLayout(virtualChildAt, childrenSkipCount2, i, i14, i2, 0);
                    view = virtualChildAt;
                    if (i22 != Integer.MIN_VALUE) {
                        ((LinearLayout.LayoutParams) bVar).width = i22;
                    }
                    int measuredWidth = view.getMeasuredWidth();
                    if (z6) {
                        hVar.mTotalLength = hVar.getNextLocationOffset(view) + ((LinearLayout.LayoutParams) bVar).leftMargin + measuredWidth + ((LinearLayout.LayoutParams) bVar).rightMargin + hVar.mTotalLength;
                    } else {
                        int i23 = hVar.mTotalLength;
                        hVar.mTotalLength = Math.max(i23, hVar.getNextLocationOffset(view) + i23 + measuredWidth + ((LinearLayout.LayoutParams) bVar).leftMargin + ((LinearLayout.LayoutParams) bVar).rightMargin);
                    }
                    if (z2) {
                        iMax2 = Math.max(measuredWidth, iMax2);
                    }
                }
                if (mode2 == i18 || ((LinearLayout.LayoutParams) bVar).height != -1) {
                    z3 = false;
                } else {
                    z3 = true;
                    z9 = true;
                }
                int i24 = ((LinearLayout.LayoutParams) bVar).topMargin + ((LinearLayout.LayoutParams) bVar).bottomMargin;
                int measuredHeight = view.getMeasuredHeight() + i24;
                iCombineMeasuredStates = View.combineMeasuredStates(iCombineMeasuredStates, view.getMeasuredState());
                if (z11 && (baseline2 = view.getBaseline()) != -1) {
                    int i25 = ((LinearLayout.LayoutParams) bVar).gravity;
                    if (i25 < 0) {
                        i25 = hVar.mGravity;
                    }
                    int i26 = (((i25 & 112) >> 4) & (-2)) >> 1;
                    iArr[i26] = Math.max(iArr[i26], baseline2);
                    iArr2[i26] = Math.max(iArr2[i26], measuredHeight - baseline2);
                }
                int iMax5 = Math.max(i17, measuredHeight);
                z10 = z10 && ((LinearLayout.LayoutParams) bVar).height == -1;
                if (((LinearLayout.LayoutParams) bVar).weight > 0.0f) {
                    if (!z3) {
                        i24 = measuredHeight;
                    }
                    iMax4 = Math.max(iMax4, i24);
                } else {
                    if (!z3) {
                        i24 = measuredHeight;
                    }
                    iMax3 = Math.max(iMax3, i24);
                }
                childrenSkipCount2 += hVar.getChildrenSkipCount(view, childrenSkipCount2);
                i20 = iMax5;
                f = f3;
                childrenSkipCount2++;
                z7 = z2;
                iArr4 = iArr2;
                z4 = z11;
                mode = i16;
                iArr3 = iArr;
                virtualChildCount = i15;
                i19 = 1073741824;
            }
            i15 = virtualChildCount;
            i16 = mode;
            iArr = iArr3;
            iArr2 = iArr4;
            i20 = i3;
            z2 = z7;
            childrenSkipCount2++;
            z7 = z2;
            iArr4 = iArr2;
            z4 = z11;
            mode = i16;
            iArr3 = iArr;
            virtualChildCount = i15;
            i19 = 1073741824;
        }
        boolean z12 = z4;
        int i27 = virtualChildCount;
        int i28 = mode;
        int[] iArr5 = iArr3;
        int[] iArr6 = iArr4;
        int iCombineMeasuredStates2 = iCombineMeasuredStates;
        boolean z13 = z7;
        if (hVar.mTotalLength > 0 && hVar.hasDividerBeforeChildAt(i27)) {
            hVar.mTotalLength += hVar.mDividerWidth;
        }
        int i29 = iArr5[1];
        int iMax6 = (i29 == -1 && iArr5[0] == -1 && iArr5[2] == -1 && iArr5[3] == -1) ? i3 : Math.max(i3, Math.max(iArr6[3], Math.max(iArr6[0], Math.max(iArr6[1], iArr6[2]))) + Math.max(iArr5[3], Math.max(iArr5[0], Math.max(i29, iArr5[2]))));
        int i30 = i28;
        if (z13 && (i30 == Integer.MIN_VALUE || i30 == 0)) {
            hVar.mTotalLength = 0;
            int i31 = 0;
            while (i31 < i27) {
                View virtualChildAt2 = hVar.getVirtualChildAt(i31);
                if (virtualChildAt2 == null) {
                    hVar.mTotalLength = hVar.measureNullChild(i31) + hVar.mTotalLength;
                } else if (virtualChildAt2.getVisibility() == 8) {
                    childrenSkipCount = i31 + hVar.getChildrenSkipCount(virtualChildAt2, i31);
                    i31 = childrenSkipCount + 1;
                } else {
                    b bVar2 = (b) virtualChildAt2.getLayoutParams();
                    if (z6) {
                        hVar.mTotalLength = hVar.getNextLocationOffset(virtualChildAt2) + ((LinearLayout.LayoutParams) bVar2).leftMargin + iMax2 + ((LinearLayout.LayoutParams) bVar2).rightMargin + hVar.mTotalLength;
                    } else {
                        int i32 = hVar.mTotalLength;
                        i12 = i31;
                        hVar.mTotalLength = Math.max(i32, hVar.getNextLocationOffset(virtualChildAt2) + i32 + iMax2 + ((LinearLayout.LayoutParams) bVar2).leftMargin + ((LinearLayout.LayoutParams) bVar2).rightMargin);
                        childrenSkipCount = i12;
                        i31 = childrenSkipCount + 1;
                    }
                }
                i12 = i31;
                childrenSkipCount = i12;
                i31 = childrenSkipCount + 1;
            }
        }
        int paddingRight = hVar.getPaddingRight() + hVar.getPaddingLeft() + hVar.mTotalLength;
        hVar.mTotalLength = paddingRight;
        int iResolveSizeAndState = View.resolveSizeAndState(Math.max(paddingRight, hVar.getSuggestedMinimumWidth()), i, 0);
        int i33 = (16777215 & iResolveSizeAndState) - hVar.mTotalLength;
        if (z8 || (i33 != 0 && f > 0.0f)) {
            float f4 = hVar.mWeightSum;
            if (f4 > 0.0f) {
                f = f4;
            }
            iArr5[3] = -1;
            iArr5[2] = -1;
            iArr5[1] = -1;
            iArr5[0] = -1;
            iArr6[3] = -1;
            iArr6[2] = -1;
            iArr6[1] = -1;
            iArr6[0] = -1;
            hVar.mTotalLength = 0;
            iMax6 = -1;
            int i34 = 0;
            while (i34 < i27) {
                View virtualChildAt3 = hVar.getVirtualChildAt(i34);
                if (virtualChildAt3 == null || virtualChildAt3.getVisibility() == 8) {
                    i7 = i30;
                    i8 = iResolveSizeAndState;
                } else {
                    b bVar3 = (b) virtualChildAt3.getLayoutParams();
                    float f5 = ((LinearLayout.LayoutParams) bVar3).weight;
                    if (f5 > 0.0f) {
                        i8 = iResolveSizeAndState;
                        int i35 = (int) ((i33 * f5) / f);
                        f -= f5;
                        i33 -= i35;
                        int childMeasureSpec = ViewGroup.getChildMeasureSpec(i2, hVar.getPaddingBottom() + hVar.getPaddingTop() + ((LinearLayout.LayoutParams) bVar3).topMargin + ((LinearLayout.LayoutParams) bVar3).bottomMargin, ((LinearLayout.LayoutParams) bVar3).height);
                        if (((LinearLayout.LayoutParams) bVar3).width == 0) {
                            i11 = 1073741824;
                            if (i30 == 1073741824) {
                                i7 = i30;
                                virtualChildAt3.measure(View.MeasureSpec.makeMeasureSpec(i35 > 0 ? i35 : 0, 1073741824), childMeasureSpec);
                            }
                            iCombineMeasuredStates2 = View.combineMeasuredStates(iCombineMeasuredStates2, virtualChildAt3.getMeasuredState() & (-16777216));
                        } else {
                            i11 = 1073741824;
                        }
                        i7 = i30;
                        int measuredWidth2 = virtualChildAt3.getMeasuredWidth() + i35;
                        if (measuredWidth2 < 0) {
                            measuredWidth2 = 0;
                        }
                        virtualChildAt3.measure(View.MeasureSpec.makeMeasureSpec(measuredWidth2, i11), childMeasureSpec);
                        iCombineMeasuredStates2 = View.combineMeasuredStates(iCombineMeasuredStates2, virtualChildAt3.getMeasuredState() & (-16777216));
                    } else {
                        i7 = i30;
                        i8 = iResolveSizeAndState;
                    }
                    if (z6) {
                        hVar.mTotalLength = hVar.getNextLocationOffset(virtualChildAt3) + virtualChildAt3.getMeasuredWidth() + ((LinearLayout.LayoutParams) bVar3).leftMargin + ((LinearLayout.LayoutParams) bVar3).rightMargin + hVar.mTotalLength;
                    } else {
                        int i36 = hVar.mTotalLength;
                        hVar.mTotalLength = Math.max(i36, hVar.getNextLocationOffset(virtualChildAt3) + virtualChildAt3.getMeasuredWidth() + i36 + ((LinearLayout.LayoutParams) bVar3).leftMargin + ((LinearLayout.LayoutParams) bVar3).rightMargin);
                    }
                    boolean z14 = mode2 != 1073741824 && ((LinearLayout.LayoutParams) bVar3).height == -1;
                    int i37 = ((LinearLayout.LayoutParams) bVar3).topMargin + ((LinearLayout.LayoutParams) bVar3).bottomMargin;
                    int measuredHeight2 = virtualChildAt3.getMeasuredHeight() + i37;
                    iMax6 = Math.max(iMax6, measuredHeight2);
                    if (!z14) {
                        i37 = measuredHeight2;
                    }
                    int iMax7 = Math.max(iMax3, i37);
                    if (z10) {
                        i9 = -1;
                        boolean z15 = ((LinearLayout.LayoutParams) bVar3).height == -1;
                        if (z12 && (baseline = virtualChildAt3.getBaseline()) != i9) {
                            i10 = ((LinearLayout.LayoutParams) bVar3).gravity;
                            if (i10 < 0) {
                                i10 = hVar.mGravity;
                            }
                            int i38 = (((i10 & 112) >> 4) & (-2)) >> 1;
                            iArr5[i38] = Math.max(iArr5[i38], baseline);
                            iArr6[i38] = Math.max(iArr6[i38], measuredHeight2 - baseline);
                        }
                        iMax3 = iMax7;
                        z10 = z15;
                    } else {
                        i9 = -1;
                    }
                    if (z12) {
                        i10 = ((LinearLayout.LayoutParams) bVar3).gravity;
                        if (i10 < 0) {
                        }
                        int i382 = (((i10 & 112) >> 4) & (-2)) >> 1;
                        iArr5[i382] = Math.max(iArr5[i382], baseline);
                        iArr6[i382] = Math.max(iArr6[i382], measuredHeight2 - baseline);
                    }
                    iMax3 = iMax7;
                    z10 = z15;
                }
                i34++;
                iResolveSizeAndState = i8;
                i30 = i7;
            }
            i4 = iResolveSizeAndState;
            i5 = -16777216;
            hVar.mTotalLength = hVar.getPaddingRight() + hVar.getPaddingLeft() + hVar.mTotalLength;
            int i39 = iArr5[1];
            if (i39 == -1 && iArr5[0] == -1 && iArr5[2] == -1 && iArr5[3] == -1) {
                i6 = 0;
            } else {
                i6 = 0;
                iMax6 = Math.max(iMax6, Math.max(iArr6[3], Math.max(iArr6[0], Math.max(iArr6[1], iArr6[2]))) + Math.max(iArr5[3], Math.max(iArr5[0], Math.max(i39, iArr5[2]))));
            }
            iMax = iMax3;
        } else {
            iMax = Math.max(iMax3, iMax4);
            if (z13 && i30 != 1073741824) {
                for (int i40 = 0; i40 < i27; i40++) {
                    View virtualChildAt4 = hVar.getVirtualChildAt(i40);
                    if (virtualChildAt4 != null && virtualChildAt4.getVisibility() != 8 && ((LinearLayout.LayoutParams) ((b) virtualChildAt4.getLayoutParams())).weight > 0.0f) {
                        virtualChildAt4.measure(View.MeasureSpec.makeMeasureSpec(iMax2, 1073741824), View.MeasureSpec.makeMeasureSpec(virtualChildAt4.getMeasuredHeight(), 1073741824));
                    }
                }
            }
            i4 = iResolveSizeAndState;
            i5 = -16777216;
            i6 = 0;
        }
        if (z10 || mode2 == 1073741824) {
            iMax = iMax6;
        }
        hVar.setMeasuredDimension(i4 | (iCombineMeasuredStates2 & i5), View.resolveSizeAndState(Math.max(hVar.getPaddingBottom() + hVar.getPaddingTop() + iMax, hVar.getSuggestedMinimumHeight()), i2, iCombineMeasuredStates2 << 16));
        if (z9) {
            int iMakeMeasureSpec2 = View.MeasureSpec.makeMeasureSpec(hVar.getMeasuredHeight(), 1073741824);
            int i41 = i6;
            while (i41 < i27) {
                int i42 = iMakeMeasureSpec2;
                View virtualChildAt5 = hVar.getVirtualChildAt(i41);
                if (virtualChildAt5.getVisibility() != 8) {
                    b bVar4 = (b) virtualChildAt5.getLayoutParams();
                    if (((LinearLayout.LayoutParams) bVar4).height == -1) {
                        int i43 = ((LinearLayout.LayoutParams) bVar4).width;
                        ((LinearLayout.LayoutParams) bVar4).width = virtualChildAt5.getMeasuredWidth();
                        hVar.measureChildWithMargins(virtualChildAt5, i, 0, i42, 0);
                        ((LinearLayout.LayoutParams) bVar4).width = i43;
                    }
                }
                i41++;
                hVar = this;
                iMakeMeasureSpec2 = i42;
            }
        }
    }

    public int measureNullChild(int i) {
        return 0;
    }

    /* JADX WARN: Removed duplicated region for block: B:150:0x02f7  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public void measureVertical(int i, int i2) {
        int iMax;
        int i3;
        int i4;
        int i5;
        int i6;
        int i7;
        int i8;
        boolean z;
        int i9;
        int i10;
        int i11;
        int i12;
        int i13;
        int i14;
        View view;
        boolean z2;
        int iMax2;
        h hVar = this;
        hVar.mTotalLength = 0;
        int virtualChildCount = hVar.getVirtualChildCount();
        int mode = View.MeasureSpec.getMode(i);
        int mode2 = View.MeasureSpec.getMode(i2);
        int i15 = hVar.mBaselineAlignedChildIndex;
        boolean z3 = hVar.mUseLargestChild;
        int childrenSkipCount = 0;
        int i16 = 0;
        int iMax3 = 0;
        int i17 = 0;
        int i18 = 0;
        int iMax4 = 0;
        boolean z4 = false;
        boolean z5 = false;
        float f = 0.0f;
        boolean z6 = true;
        while (true) {
            int i19 = i16;
            int i20 = 8;
            if (childrenSkipCount >= virtualChildCount) {
                float f2 = f;
                int i21 = virtualChildCount;
                boolean z7 = z3;
                int i22 = iMax4;
                int iMax5 = i17;
                int iCombineMeasuredStates = i18;
                int i23 = mode2;
                int i24 = iMax3;
                if (hVar.mTotalLength > 0 && hVar.hasDividerBeforeChildAt(i21)) {
                    hVar.mTotalLength += hVar.mDividerHeight;
                }
                int i25 = i23;
                if (z7 && (i25 == Integer.MIN_VALUE || i25 == 0)) {
                    hVar.mTotalLength = 0;
                    int childrenSkipCount2 = 0;
                    while (childrenSkipCount2 < i21) {
                        View virtualChildAt = hVar.getVirtualChildAt(childrenSkipCount2);
                        if (virtualChildAt == null) {
                            hVar.mTotalLength = hVar.measureNullChild(childrenSkipCount2) + hVar.mTotalLength;
                        } else if (virtualChildAt.getVisibility() == i20) {
                            childrenSkipCount2 += hVar.getChildrenSkipCount(virtualChildAt, childrenSkipCount2);
                        } else {
                            b bVar = (b) virtualChildAt.getLayoutParams();
                            int i26 = hVar.mTotalLength;
                            hVar.mTotalLength = Math.max(i26, hVar.getNextLocationOffset(virtualChildAt) + i26 + i24 + ((LinearLayout.LayoutParams) bVar).topMargin + ((LinearLayout.LayoutParams) bVar).bottomMargin);
                        }
                        childrenSkipCount2++;
                        i20 = 8;
                    }
                }
                int paddingBottom = hVar.getPaddingBottom() + hVar.getPaddingTop() + hVar.mTotalLength;
                hVar.mTotalLength = paddingBottom;
                int iResolveSizeAndState = View.resolveSizeAndState(Math.max(paddingBottom, hVar.getSuggestedMinimumHeight()), i2, 0);
                int i27 = (16777215 & iResolveSizeAndState) - hVar.mTotalLength;
                if (z4 || (i27 != 0 && f2 > 0.0f)) {
                    float f3 = hVar.mWeightSum;
                    if (f3 > 0.0f) {
                        f2 = f3;
                    }
                    hVar.mTotalLength = 0;
                    int i28 = i22;
                    int i29 = i27;
                    int i30 = 0;
                    while (i30 < i21) {
                        View virtualChildAt2 = hVar.getVirtualChildAt(i30);
                        if (virtualChildAt2.getVisibility() == 8) {
                            i3 = i25;
                        } else {
                            b bVar2 = (b) virtualChildAt2.getLayoutParams();
                            float f4 = ((LinearLayout.LayoutParams) bVar2).weight;
                            if (f4 > 0.0f) {
                                int i31 = (int) ((i29 * f4) / f2);
                                f2 -= f4;
                                i29 -= i31;
                                int childMeasureSpec = ViewGroup.getChildMeasureSpec(i, hVar.getPaddingRight() + hVar.getPaddingLeft() + ((LinearLayout.LayoutParams) bVar2).leftMargin + ((LinearLayout.LayoutParams) bVar2).rightMargin, ((LinearLayout.LayoutParams) bVar2).width);
                                if (((LinearLayout.LayoutParams) bVar2).height == 0) {
                                    i5 = 1073741824;
                                    if (i25 == 1073741824) {
                                        if (i31 <= 0) {
                                            i31 = 0;
                                        }
                                        virtualChildAt2.measure(childMeasureSpec, View.MeasureSpec.makeMeasureSpec(i31, 1073741824));
                                    }
                                    iCombineMeasuredStates = View.combineMeasuredStates(iCombineMeasuredStates, virtualChildAt2.getMeasuredState() & (-256));
                                } else {
                                    i5 = 1073741824;
                                }
                                int measuredHeight = virtualChildAt2.getMeasuredHeight() + i31;
                                if (measuredHeight < 0) {
                                    measuredHeight = 0;
                                }
                                virtualChildAt2.measure(childMeasureSpec, View.MeasureSpec.makeMeasureSpec(measuredHeight, i5));
                                iCombineMeasuredStates = View.combineMeasuredStates(iCombineMeasuredStates, virtualChildAt2.getMeasuredState() & (-256));
                            }
                            int i32 = ((LinearLayout.LayoutParams) bVar2).leftMargin + ((LinearLayout.LayoutParams) bVar2).rightMargin;
                            int measuredWidth = virtualChildAt2.getMeasuredWidth() + i32;
                            iMax5 = Math.max(iMax5, measuredWidth);
                            if (mode != 1073741824) {
                                i3 = i25;
                                i4 = -1;
                                if (((LinearLayout.LayoutParams) bVar2).width != -1) {
                                }
                                int iMax6 = Math.max(i28, i32);
                                boolean z8 = !z6 && ((LinearLayout.LayoutParams) bVar2).width == i4;
                                int i33 = hVar.mTotalLength;
                                hVar.mTotalLength = Math.max(i33, hVar.getNextLocationOffset(virtualChildAt2) + virtualChildAt2.getMeasuredHeight() + i33 + ((LinearLayout.LayoutParams) bVar2).topMargin + ((LinearLayout.LayoutParams) bVar2).bottomMargin);
                                z6 = z8;
                                i28 = iMax6;
                            } else {
                                i3 = i25;
                                i4 = -1;
                            }
                            i32 = measuredWidth;
                            int iMax62 = Math.max(i28, i32);
                            if (z6) {
                                int i332 = hVar.mTotalLength;
                                hVar.mTotalLength = Math.max(i332, hVar.getNextLocationOffset(virtualChildAt2) + virtualChildAt2.getMeasuredHeight() + i332 + ((LinearLayout.LayoutParams) bVar2).topMargin + ((LinearLayout.LayoutParams) bVar2).bottomMargin);
                                z6 = z8;
                                i28 = iMax62;
                            }
                        }
                        i30++;
                        i25 = i3;
                    }
                    hVar.mTotalLength = hVar.getPaddingBottom() + hVar.getPaddingTop() + hVar.mTotalLength;
                    iMax = i28;
                } else {
                    iMax = Math.max(i22, i19);
                    if (z7 && i25 != 1073741824) {
                        for (int i34 = 0; i34 < i21; i34++) {
                            View virtualChildAt3 = hVar.getVirtualChildAt(i34);
                            if (virtualChildAt3 != null && virtualChildAt3.getVisibility() != 8 && ((LinearLayout.LayoutParams) ((b) virtualChildAt3.getLayoutParams())).weight > 0.0f) {
                                virtualChildAt3.measure(View.MeasureSpec.makeMeasureSpec(virtualChildAt3.getMeasuredWidth(), 1073741824), View.MeasureSpec.makeMeasureSpec(i24, 1073741824));
                            }
                        }
                    }
                }
                if (z6 || mode == 1073741824) {
                    iMax = iMax5;
                }
                hVar.setMeasuredDimension(View.resolveSizeAndState(Math.max(hVar.getPaddingRight() + hVar.getPaddingLeft() + iMax, hVar.getSuggestedMinimumWidth()), i, iCombineMeasuredStates), iResolveSizeAndState);
                if (z5) {
                    int iMakeMeasureSpec = View.MeasureSpec.makeMeasureSpec(hVar.getMeasuredWidth(), 1073741824);
                    int i35 = 0;
                    while (i35 < i21) {
                        View virtualChildAt4 = hVar.getVirtualChildAt(i35);
                        if (virtualChildAt4.getVisibility() != 8) {
                            b bVar3 = (b) virtualChildAt4.getLayoutParams();
                            if (((LinearLayout.LayoutParams) bVar3).width == -1) {
                                int i36 = ((LinearLayout.LayoutParams) bVar3).height;
                                ((LinearLayout.LayoutParams) bVar3).height = virtualChildAt4.getMeasuredHeight();
                                hVar.measureChildWithMargins(virtualChildAt4, iMakeMeasureSpec, 0, i2, 0);
                                ((LinearLayout.LayoutParams) bVar3).height = i36;
                            }
                        }
                        i35++;
                        hVar = this;
                    }
                    return;
                }
                return;
            }
            float f5 = f;
            View virtualChildAt5 = hVar.getVirtualChildAt(childrenSkipCount);
            if (virtualChildAt5 == null) {
                hVar.mTotalLength = hVar.measureNullChild(childrenSkipCount) + hVar.mTotalLength;
            } else if (virtualChildAt5.getVisibility() == 8) {
                childrenSkipCount += hVar.getChildrenSkipCount(virtualChildAt5, childrenSkipCount);
            } else {
                if (hVar.hasDividerBeforeChildAt(childrenSkipCount)) {
                    hVar.mTotalLength += hVar.mDividerHeight;
                }
                b bVar4 = (b) virtualChildAt5.getLayoutParams();
                float f6 = ((LinearLayout.LayoutParams) bVar4).weight;
                f5 += f6;
                if (mode2 == 1073741824 && ((LinearLayout.LayoutParams) bVar4).height == 0 && f6 > 0.0f) {
                    int i37 = hVar.mTotalLength;
                    hVar.mTotalLength = Math.max(i37, ((LinearLayout.LayoutParams) bVar4).topMargin + i37 + ((LinearLayout.LayoutParams) bVar4).bottomMargin);
                    view = virtualChildAt5;
                    i13 = virtualChildCount;
                    z = z3;
                    i9 = iMax4;
                    z4 = true;
                    i10 = i19;
                    i14 = i17;
                    i11 = i18;
                    i12 = mode2;
                } else {
                    if (((LinearLayout.LayoutParams) bVar4).height != 0 || f6 <= 0.0f) {
                        i6 = Integer.MIN_VALUE;
                    } else {
                        ((LinearLayout.LayoutParams) bVar4).height = -2;
                        i6 = 0;
                    }
                    if (f5 == 0.0f) {
                        int i38 = i18;
                        i8 = hVar.mTotalLength;
                        i7 = i38;
                    } else {
                        i7 = i18;
                        i8 = 0;
                    }
                    int i39 = iMax3;
                    z = z3;
                    i9 = iMax4;
                    i10 = i19;
                    i11 = i7;
                    i12 = mode2;
                    i13 = virtualChildCount;
                    i14 = i17;
                    hVar.measureChildBeforeLayout(virtualChildAt5, childrenSkipCount, i, 0, i2, i8);
                    view = virtualChildAt5;
                    if (i6 != Integer.MIN_VALUE) {
                        ((LinearLayout.LayoutParams) bVar4).height = i6;
                    }
                    int measuredHeight2 = view.getMeasuredHeight();
                    int i40 = hVar.mTotalLength;
                    hVar.mTotalLength = Math.max(i40, hVar.getNextLocationOffset(view) + i40 + measuredHeight2 + ((LinearLayout.LayoutParams) bVar4).topMargin + ((LinearLayout.LayoutParams) bVar4).bottomMargin);
                    iMax3 = z ? Math.max(measuredHeight2, i39) : i39;
                }
                if (i15 >= 0 && i15 == childrenSkipCount + 1) {
                    hVar.mBaselineChildTop = hVar.mTotalLength;
                }
                if (childrenSkipCount < i15 && ((LinearLayout.LayoutParams) bVar4).weight > 0.0f) {
                    throw new RuntimeException("A child of LinearLayout with index less than mBaselineAlignedChildIndex has weight > 0, which won't work.  Either remove the weight, or don't set mBaselineAlignedChildIndex.");
                }
                if (mode == 1073741824 || ((LinearLayout.LayoutParams) bVar4).width != -1) {
                    z2 = false;
                } else {
                    z2 = true;
                    z5 = true;
                }
                int i41 = ((LinearLayout.LayoutParams) bVar4).leftMargin + ((LinearLayout.LayoutParams) bVar4).rightMargin;
                int measuredWidth2 = view.getMeasuredWidth() + i41;
                int iMax7 = Math.max(i14, measuredWidth2);
                int iCombineMeasuredStates2 = View.combineMeasuredStates(i11, view.getMeasuredState());
                z6 = z6 && ((LinearLayout.LayoutParams) bVar4).width == -1;
                if (((LinearLayout.LayoutParams) bVar4).weight > 0.0f) {
                    if (!z2) {
                        i41 = measuredWidth2;
                    }
                    iMax2 = Math.max(i10, i41);
                    iMax4 = i9;
                } else {
                    if (!z2) {
                        i41 = measuredWidth2;
                    }
                    iMax4 = Math.max(i9, i41);
                    iMax2 = i10;
                }
                childrenSkipCount += hVar.getChildrenSkipCount(view, childrenSkipCount);
                i16 = iMax2;
                i17 = iMax7;
                i18 = iCombineMeasuredStates2;
                childrenSkipCount++;
                mode2 = i12;
                f = f5;
                virtualChildCount = i13;
                z3 = z;
            }
            i13 = virtualChildCount;
            z = z3;
            i16 = i19;
            i12 = mode2;
            childrenSkipCount++;
            mode2 = i12;
            f = f5;
            virtualChildCount = i13;
            z3 = z;
        }
    }

    @Override // android.view.View
    public void onDraw(Canvas canvas) {
        if (this.mDivider == null) {
            return;
        }
        if (this.mOrientation == 1) {
            drawDividersVertical(canvas);
        } else {
            drawDividersHorizontal(canvas);
        }
    }

    @Override // android.view.View
    public void onInitializeAccessibilityEvent(AccessibilityEvent accessibilityEvent) {
        super.onInitializeAccessibilityEvent(accessibilityEvent);
        accessibilityEvent.setClassName(ACCESSIBILITY_CLASS_NAME);
    }

    @Override // android.view.View
    public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo accessibilityNodeInfo) {
        super.onInitializeAccessibilityNodeInfo(accessibilityNodeInfo);
        accessibilityNodeInfo.setClassName(ACCESSIBILITY_CLASS_NAME);
    }

    @Override // android.view.ViewGroup, android.view.View
    public void onLayout(boolean z, int i, int i2, int i3, int i4) {
        if (this.mOrientation == 1) {
            layoutVertical(i, i2, i3, i4);
        } else {
            layoutHorizontal(i, i2, i3, i4);
        }
    }

    @Override // android.view.View
    public void onMeasure(int i, int i2) {
        if (this.mOrientation == 1) {
            measureVertical(i, i2);
        } else {
            measureHorizontal(i, i2);
        }
    }

    public void setBaselineAligned(boolean z) {
        this.mBaselineAligned = z;
    }

    public void setBaselineAlignedChildIndex(int i) {
        if (i >= 0 && i < getChildCount()) {
            this.mBaselineAlignedChildIndex = i;
            return;
        }
        throw new IllegalArgumentException("base aligned child index out of range (0, " + getChildCount() + ")");
    }

    public void setDividerDrawable(Drawable drawable) {
        if (drawable == this.mDivider) {
            return;
        }
        this.mDivider = drawable;
        if (drawable != null) {
            this.mDividerWidth = drawable.getIntrinsicWidth();
            this.mDividerHeight = drawable.getIntrinsicHeight();
        } else {
            this.mDividerWidth = 0;
            this.mDividerHeight = 0;
        }
        setWillNotDraw(drawable == null);
        requestLayout();
    }

    public void setDividerPadding(int i) {
        this.mDividerPadding = i;
    }

    public void setGravity(@nx3 int i) {
        if (this.mGravity != i) {
            if ((8388615 & i) == 0) {
                i |= 8388611;
            }
            if ((i & 112) == 0) {
                i |= 48;
            }
            this.mGravity = i;
            requestLayout();
        }
    }

    public void setHorizontalGravity(int i) {
        int i2 = i & 8388615;
        int i3 = this.mGravity;
        if ((8388615 & i3) != i2) {
            this.mGravity = i2 | ((-8388616) & i3);
            requestLayout();
        }
    }

    public void setMeasureWithLargestChildEnabled(boolean z) {
        this.mUseLargestChild = z;
    }

    public void setOrientation(int i) {
        if (this.mOrientation != i) {
            this.mOrientation = i;
            requestLayout();
        }
    }

    public void setShowDividers(int i) {
        if (i != this.mShowDividers) {
            requestLayout();
        }
        this.mShowDividers = i;
    }

    public void setVerticalGravity(int i) {
        int i2 = i & 112;
        int i3 = this.mGravity;
        if ((i3 & 112) != i2) {
            this.mGravity = i2 | (i3 & (-113));
            requestLayout();
        }
    }

    public void setWeightSum(float f) {
        this.mWeightSum = Math.max(0.0f, f);
    }

    @Override // android.view.ViewGroup
    public boolean shouldDelayChildPressedState() {
        return false;
    }

    @Override // android.view.ViewGroup
    public b generateDefaultLayoutParams() {
        int i = this.mOrientation;
        if (i == 0) {
            return new b(-2, -2);
        }
        if (i == 1) {
            return new b(-1, -2);
        }
        return null;
    }

    @Override // android.view.ViewGroup
    public b generateLayoutParams(AttributeSet attributeSet) {
        return new b(getContext(), attributeSet);
    }

    @Override // android.view.ViewGroup
    public b generateLayoutParams(ViewGroup.LayoutParams layoutParams) {
        return new b(layoutParams);
    }
}
