package c.b.f;

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.View;
import android.view.ViewGroup;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
import android.widget.LinearLayout;

/* JADX INFO: compiled from: LinearLayoutCompat.java */
/* JADX INFO: loaded from: classes.dex */
public class o0 extends ViewGroup {

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public boolean f919b;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public int f920e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public int f921f;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public int f922g;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public int f923h;

    /* JADX INFO: renamed from: i, reason: collision with root package name */
    public int f924i;

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    public float f925j;

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    public boolean f926k;

    /* JADX INFO: renamed from: l, reason: collision with root package name */
    public int[] f927l;
    public int[] m;
    public Drawable n;
    public int o;
    public int p;
    public int q;
    public int r;

    /* JADX INFO: compiled from: LinearLayoutCompat.java */
    public static class a extends LinearLayout.LayoutParams {
        public a(Context context, AttributeSet attributeSet) {
            super(context, attributeSet);
        }

        public a(int i2, int i3) {
            super(i2, i3);
        }

        public a(ViewGroup.LayoutParams layoutParams) {
            super(layoutParams);
        }
    }

    public o0(Context context) {
        this(context, null);
    }

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

    public void e(Canvas canvas, int i2) {
        this.n.setBounds(getPaddingLeft() + this.r, i2, (getWidth() - getPaddingRight()) - this.r, this.p + i2);
        this.n.draw(canvas);
    }

    public void f(Canvas canvas, int i2) {
        this.n.setBounds(i2, getPaddingTop() + this.r, this.o + i2, (getHeight() - getPaddingBottom()) - this.r);
        this.n.draw(canvas);
    }

    @Override // android.view.ViewGroup
    /* JADX INFO: renamed from: g, reason: merged with bridge method [inline-methods] */
    public a generateDefaultLayoutParams() {
        int i2 = this.f922g;
        if (i2 == 0) {
            return new a(-2, -2);
        }
        if (i2 == 1) {
            return new a(-1, -2);
        }
        return null;
    }

    @Override // android.view.View
    public int getBaseline() {
        int i2;
        if (this.f920e < 0) {
            return super.getBaseline();
        }
        int childCount = getChildCount();
        int i3 = this.f920e;
        if (childCount <= i3) {
            throw new RuntimeException("mBaselineAlignedChildIndex of LinearLayout set to an index that is out of bounds.");
        }
        View childAt = getChildAt(i3);
        int baseline = childAt.getBaseline();
        if (baseline == -1) {
            if (this.f920e == 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.f921f;
        if (this.f922g == 1 && (i2 = this.f923h & 112) != 48) {
            if (i2 == 16) {
                bottom += ((((getBottom() - getTop()) - getPaddingTop()) - getPaddingBottom()) - this.f924i) / 2;
            } else if (i2 == 80) {
                bottom = ((getBottom() - getTop()) - getPaddingBottom()) - this.f924i;
            }
        }
        return bottom + ((LinearLayout.LayoutParams) ((a) childAt.getLayoutParams())).topMargin + baseline;
    }

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

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

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

    public int getDividerWidth() {
        return this.o;
    }

    public int getGravity() {
        return this.f923h;
    }

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

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

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

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

    @Override // android.view.ViewGroup
    /* JADX INFO: renamed from: h, reason: merged with bridge method [inline-methods] */
    public a generateLayoutParams(AttributeSet attributeSet) {
        return new a(getContext(), attributeSet);
    }

    @Override // android.view.ViewGroup
    /* JADX INFO: renamed from: i, reason: merged with bridge method [inline-methods] */
    public a generateLayoutParams(ViewGroup.LayoutParams layoutParams) {
        return new a(layoutParams);
    }

    public int j() {
        return 0;
    }

    public int k() {
        return 0;
    }

    public int l() {
        return 0;
    }

    public boolean m(int i2) {
        if (i2 == 0) {
            return (this.q & 1) != 0;
        }
        if (i2 == getChildCount()) {
            return (this.q & 4) != 0;
        }
        if ((this.q & 2) == 0) {
            return false;
        }
        for (int i3 = i2 - 1; i3 >= 0; i3--) {
            if (getChildAt(i3).getVisibility() != 8) {
                return true;
            }
        }
        return false;
    }

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

    public int o() {
        return 0;
    }

    @Override // android.view.View
    public void onDraw(Canvas canvas) {
        int right;
        int left;
        int i2;
        if (this.n == null) {
            return;
        }
        int i3 = 0;
        if (this.f922g == 1) {
            int virtualChildCount = getVirtualChildCount();
            while (i3 < virtualChildCount) {
                View childAt = getChildAt(i3);
                if (childAt != null && childAt.getVisibility() != 8 && m(i3)) {
                    e(canvas, (childAt.getTop() - ((LinearLayout.LayoutParams) ((a) childAt.getLayoutParams())).topMargin) - this.p);
                }
                i3++;
            }
            if (m(virtualChildCount)) {
                View childAt2 = getChildAt(virtualChildCount - 1);
                e(canvas, childAt2 == null ? (getHeight() - getPaddingBottom()) - this.p : childAt2.getBottom() + ((LinearLayout.LayoutParams) ((a) childAt2.getLayoutParams())).bottomMargin);
                return;
            }
            return;
        }
        int virtualChildCount2 = getVirtualChildCount();
        boolean zB = i1.b(this);
        while (i3 < virtualChildCount2) {
            View childAt3 = getChildAt(i3);
            if (childAt3 != null && childAt3.getVisibility() != 8 && m(i3)) {
                a aVar = (a) childAt3.getLayoutParams();
                f(canvas, zB ? childAt3.getRight() + ((LinearLayout.LayoutParams) aVar).rightMargin : (childAt3.getLeft() - ((LinearLayout.LayoutParams) aVar).leftMargin) - this.o);
            }
            i3++;
        }
        if (m(virtualChildCount2)) {
            View childAt4 = getChildAt(virtualChildCount2 - 1);
            if (childAt4 != null) {
                a aVar2 = (a) childAt4.getLayoutParams();
                if (zB) {
                    left = childAt4.getLeft() - ((LinearLayout.LayoutParams) aVar2).leftMargin;
                    i2 = this.o;
                    right = left - i2;
                } else {
                    right = childAt4.getRight() + ((LinearLayout.LayoutParams) aVar2).rightMargin;
                }
            } else if (zB) {
                right = getPaddingLeft();
            } else {
                left = getWidth() - getPaddingRight();
                i2 = this.o;
                right = left - i2;
            }
            f(canvas, right);
        }
    }

    @Override // android.view.View
    public void onInitializeAccessibilityEvent(AccessibilityEvent accessibilityEvent) {
        super.onInitializeAccessibilityEvent(accessibilityEvent);
        accessibilityEvent.setClassName("androidx.appcompat.widget.LinearLayoutCompat");
    }

    @Override // android.view.View
    public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo accessibilityNodeInfo) {
        super.onInitializeAccessibilityNodeInfo(accessibilityNodeInfo);
        accessibilityNodeInfo.setClassName("androidx.appcompat.widget.LinearLayoutCompat");
    }

    /* JADX WARN: Removed duplicated region for block: B:29:0x009f  */
    /* JADX WARN: Removed duplicated region for block: B:60:0x0170  */
    /* JADX WARN: Removed duplicated region for block: B:63:0x017a  */
    /* JADX WARN: Removed duplicated region for block: B:74:0x01aa  */
    /* JADX WARN: Removed duplicated region for block: B:77:0x01bc  */
    @Override // android.view.ViewGroup, android.view.View
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public void onLayout(boolean r24, int r25, int r26, int r27, int r28) {
        /*
            Method dump skipped, instruction units count: 494
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: c.b.f.o0.onLayout(boolean, int, int, int, int):void");
    }

    /* JADX WARN: Removed duplicated region for block: B:152:0x0312  */
    /* JADX WARN: Removed duplicated region for block: B:158:0x0320  */
    /* JADX WARN: Removed duplicated region for block: B:218:0x04be  */
    /* JADX WARN: Removed duplicated region for block: B:219:0x04c3  */
    /* JADX WARN: Removed duplicated region for block: B:222:0x04eb  */
    /* JADX WARN: Removed duplicated region for block: B:223:0x04f0  */
    /* JADX WARN: Removed duplicated region for block: B:226:0x04f8  */
    /* JADX WARN: Removed duplicated region for block: B:227:0x0509  */
    /* JADX WARN: Removed duplicated region for block: B:229:0x0520  */
    /* JADX WARN: Removed duplicated region for block: B:235:0x0534  */
    /* JADX WARN: Removed duplicated region for block: B:244:0x0577  */
    /* JADX WARN: Removed duplicated region for block: B:250:0x0587  */
    /* JADX WARN: Removed duplicated region for block: B:253:0x058f  */
    /* JADX WARN: Removed duplicated region for block: B:256:0x059a  */
    /* JADX WARN: Removed duplicated region for block: B:285:0x0635  */
    /* JADX WARN: Removed duplicated region for block: B:319:0x06f8  */
    /* JADX WARN: Removed duplicated region for block: B:321:0x06ff  */
    /* JADX WARN: Removed duplicated region for block: B:324:0x071c  */
    /* JADX WARN: Removed duplicated region for block: B:374:0x0831  */
    /* JADX WARN: Removed duplicated region for block: B:388:0x0879  */
    /* JADX WARN: Removed duplicated region for block: B:391:0x08ab  */
    /* JADX WARN: Removed duplicated region for block: B:394:0x08b0  */
    /* JADX WARN: Removed duplicated region for block: B:397:0x08d2  */
    /* JADX WARN: Removed duplicated region for block: B:448:? A[RETURN, SYNTHETIC] */
    @Override // android.view.View
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public void onMeasure(int r39, int r40) {
        /*
            Method dump skipped, instruction units count: 2323
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: c.b.f.o0.onMeasure(int, int):void");
    }

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

    public void setBaselineAlignedChildIndex(int i2) {
        if (i2 >= 0 && i2 < getChildCount()) {
            this.f920e = i2;
            return;
        }
        StringBuilder sbB = d.b.a.a.a.B("base aligned child index out of range (0, ");
        sbB.append(getChildCount());
        sbB.append(")");
        throw new IllegalArgumentException(sbB.toString());
    }

    public void setDividerDrawable(Drawable drawable) {
        if (drawable == this.n) {
            return;
        }
        this.n = drawable;
        if (drawable != null) {
            this.o = drawable.getIntrinsicWidth();
            this.p = drawable.getIntrinsicHeight();
        } else {
            this.o = 0;
            this.p = 0;
        }
        setWillNotDraw(drawable == null);
        requestLayout();
    }

    public void setDividerPadding(int i2) {
        this.r = i2;
    }

    public void setGravity(int i2) {
        if (this.f923h != i2) {
            if ((8388615 & i2) == 0) {
                i2 |= 8388611;
            }
            if ((i2 & 112) == 0) {
                i2 |= 48;
            }
            this.f923h = i2;
            requestLayout();
        }
    }

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

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

    public void setOrientation(int i2) {
        if (this.f922g != i2) {
            this.f922g = i2;
            requestLayout();
        }
    }

    public void setShowDividers(int i2) {
        if (i2 != this.q) {
            requestLayout();
        }
        this.q = i2;
    }

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

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

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

    public o0(Context context, AttributeSet attributeSet) {
        this(context, attributeSet, 0);
    }

    public o0(Context context, AttributeSet attributeSet, int i2) {
        Drawable drawable;
        int resourceId;
        super(context, attributeSet, i2);
        this.f919b = true;
        this.f920e = -1;
        this.f921f = 0;
        this.f923h = 8388659;
        int[] iArr = c.b.b.n;
        TypedArray typedArrayObtainStyledAttributes = context.obtainStyledAttributes(attributeSet, iArr, i2, 0);
        c.f.j.a0.k(this, context, iArr, attributeSet, typedArrayObtainStyledAttributes, i2, 0);
        int i3 = typedArrayObtainStyledAttributes.getInt(1, -1);
        if (i3 >= 0) {
            setOrientation(i3);
        }
        int i4 = typedArrayObtainStyledAttributes.getInt(0, -1);
        if (i4 >= 0) {
            setGravity(i4);
        }
        boolean z = typedArrayObtainStyledAttributes.getBoolean(2, true);
        if (!z) {
            setBaselineAligned(z);
        }
        this.f925j = typedArrayObtainStyledAttributes.getFloat(4, -1.0f);
        this.f920e = typedArrayObtainStyledAttributes.getInt(3, -1);
        this.f926k = typedArrayObtainStyledAttributes.getBoolean(7, false);
        if (typedArrayObtainStyledAttributes.hasValue(5) && (resourceId = typedArrayObtainStyledAttributes.getResourceId(5, 0)) != 0) {
            drawable = c.b.a.e(context, resourceId);
        } else {
            drawable = typedArrayObtainStyledAttributes.getDrawable(5);
        }
        setDividerDrawable(drawable);
        this.q = typedArrayObtainStyledAttributes.getInt(8, 0);
        this.r = typedArrayObtainStyledAttributes.getDimensionPixelSize(6, 0);
        typedArrayObtainStyledAttributes.recycle();
    }
}
