package d.b.g;

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: loaded from: classes.dex */
public class k0 extends ViewGroup {

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

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

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

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

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

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

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

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

    /* JADX INFO: renamed from: t, reason: collision with root package name */
    public int[] f2011t;

    /* JADX INFO: renamed from: u, reason: collision with root package name */
    public int[] f2012u;

    /* JADX INFO: renamed from: v, reason: collision with root package name */
    public Drawable f2013v;

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

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

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

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

    public static class a extends LinearLayout.LayoutParams {
        public a(int i2, int i3) {
            super(i2, i3);
        }

        public a(Context context, AttributeSet attributeSet) {
            super(context, attributeSet);
        }

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

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

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

    public k0(Context context, AttributeSet attributeSet, int i2) {
        int resourceId;
        super(context, attributeSet, i2);
        this.f2003f = true;
        this.f2004m = -1;
        this.f2005n = 0;
        this.f2007p = 8388659;
        int[] iArr = d.b.b.f1540m;
        TypedArray typedArrayObtainStyledAttributes = context.obtainStyledAttributes(attributeSet, iArr, i2, 0);
        d.h.j.y.o(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 z2 = typedArrayObtainStyledAttributes.getBoolean(2, true);
        if (!z2) {
            setBaselineAligned(z2);
        }
        this.f2009r = typedArrayObtainStyledAttributes.getFloat(4, -1.0f);
        this.f2004m = typedArrayObtainStyledAttributes.getInt(3, -1);
        this.f2010s = typedArrayObtainStyledAttributes.getBoolean(7, false);
        setDividerDrawable((!typedArrayObtainStyledAttributes.hasValue(5) || (resourceId = typedArrayObtainStyledAttributes.getResourceId(5, 0)) == 0) ? typedArrayObtainStyledAttributes.getDrawable(5) : d.b.d.a.a.a(context, resourceId));
        this.f2016y = typedArrayObtainStyledAttributes.getInt(8, 0);
        this.f2017z = typedArrayObtainStyledAttributes.getDimensionPixelSize(6, 0);
        typedArrayObtainStyledAttributes.recycle();
    }

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

    public void f(Canvas canvas, int i2) {
        this.f2013v.setBounds(getPaddingLeft() + this.f2017z, i2, (getWidth() - getPaddingRight()) - this.f2017z, this.f2015x + i2);
        this.f2013v.draw(canvas);
    }

    public void g(Canvas canvas, int i2) {
        this.f2013v.setBounds(i2, getPaddingTop() + this.f2017z, this.f2014w + i2, (getHeight() - getPaddingBottom()) - this.f2017z);
        this.f2013v.draw(canvas);
    }

    @Override // android.view.View
    public int getBaseline() {
        int i2;
        if (this.f2004m < 0) {
            return super.getBaseline();
        }
        int childCount = getChildCount();
        int i3 = this.f2004m;
        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.f2004m == 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.f2005n;
        if (this.f2006o == 1 && (i2 = this.f2007p & 112) != 48) {
            if (i2 == 16) {
                bottom += ((((getBottom() - getTop()) - getPaddingTop()) - getPaddingBottom()) - this.f2008q) / 2;
            } else if (i2 == 80) {
                bottom = ((getBottom() - getTop()) - getPaddingBottom()) - this.f2008q;
            }
        }
        return bottom + ((LinearLayout.LayoutParams) ((a) childAt.getLayoutParams())).topMargin + baseline;
    }

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

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

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

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

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

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

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

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

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

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

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

    public int k() {
        return 0;
    }

    public int l() {
        return 0;
    }

    public int m() {
        return 0;
    }

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

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

    @Override // android.view.View
    public void onDraw(Canvas canvas) {
        int right;
        int left;
        int paddingRight;
        if (this.f2013v == null) {
            return;
        }
        int i2 = 0;
        if (this.f2006o == 1) {
            int virtualChildCount = getVirtualChildCount();
            while (i2 < virtualChildCount) {
                View childAt = getChildAt(i2);
                if (childAt != null && childAt.getVisibility() != 8 && n(i2)) {
                    f(canvas, (childAt.getTop() - ((LinearLayout.LayoutParams) ((a) childAt.getLayoutParams())).topMargin) - this.f2015x);
                }
                i2++;
            }
            if (n(virtualChildCount)) {
                View childAt2 = getChildAt(virtualChildCount - 1);
                f(canvas, childAt2 == null ? (getHeight() - getPaddingBottom()) - this.f2015x : childAt2.getBottom() + ((LinearLayout.LayoutParams) ((a) childAt2.getLayoutParams())).bottomMargin);
                return;
            }
            return;
        }
        int virtualChildCount2 = getVirtualChildCount();
        boolean zB = d1.b(this);
        while (i2 < virtualChildCount2) {
            View childAt3 = getChildAt(i2);
            if (childAt3 != null && childAt3.getVisibility() != 8 && n(i2)) {
                a aVar = (a) childAt3.getLayoutParams();
                g(canvas, zB ? childAt3.getRight() + ((LinearLayout.LayoutParams) aVar).rightMargin : (childAt3.getLeft() - ((LinearLayout.LayoutParams) aVar).leftMargin) - this.f2014w);
            }
            i2++;
        }
        if (n(virtualChildCount2)) {
            View childAt4 = getChildAt(virtualChildCount2 - 1);
            if (childAt4 != null) {
                a aVar2 = (a) childAt4.getLayoutParams();
                if (zB) {
                    left = childAt4.getLeft();
                    paddingRight = ((LinearLayout.LayoutParams) aVar2).leftMargin;
                    right = (left - paddingRight) - this.f2014w;
                } else {
                    right = childAt4.getRight() + ((LinearLayout.LayoutParams) aVar2).rightMargin;
                }
            } else if (zB) {
                right = getPaddingLeft();
            } else {
                left = getWidth();
                paddingRight = getPaddingRight();
                right = (left - paddingRight) - this.f2014w;
            }
            g(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:0x009d  */
    /* JADX WARN: Removed duplicated region for block: B:60:0x016c  */
    /* JADX WARN: Removed duplicated region for block: B:63:0x0176  */
    /* JADX WARN: Removed duplicated region for block: B:74:0x01a6  */
    /* JADX WARN: Removed duplicated region for block: B:77:0x01b8  */
    @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: 490
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: d.b.g.k0.onLayout(boolean, int, int, int, int):void");
    }

    /* JADX WARN: Removed duplicated region for block: B:136:0x02cb  */
    /* JADX WARN: Removed duplicated region for block: B:147:0x0306  */
    /* JADX WARN: Removed duplicated region for block: B:153:0x0314  */
    /* JADX WARN: Removed duplicated region for block: B:213:0x04b2  */
    /* JADX WARN: Removed duplicated region for block: B:214:0x04b7  */
    /* JADX WARN: Removed duplicated region for block: B:217:0x04df  */
    /* JADX WARN: Removed duplicated region for block: B:218:0x04e4  */
    /* JADX WARN: Removed duplicated region for block: B:221:0x04ee  */
    /* JADX WARN: Removed duplicated region for block: B:222:0x04fd  */
    /* JADX WARN: Removed duplicated region for block: B:224:0x0512  */
    /* JADX WARN: Removed duplicated region for block: B:230:0x0526  */
    /* JADX WARN: Removed duplicated region for block: B:239:0x0569  */
    /* JADX WARN: Removed duplicated region for block: B:245:0x0579  */
    /* JADX WARN: Removed duplicated region for block: B:248:0x0581  */
    /* JADX WARN: Removed duplicated region for block: B:251:0x058c  */
    /* JADX WARN: Removed duplicated region for block: B:280:0x0627  */
    /* JADX WARN: Removed duplicated region for block: B:315:0x06e6  */
    /* JADX WARN: Removed duplicated region for block: B:317:0x06ed  */
    /* JADX WARN: Removed duplicated region for block: B:320:0x070a  */
    /* JADX WARN: Removed duplicated region for block: B:336:0x0762  */
    /* JADX WARN: Removed duplicated region for block: B:366:0x0814  */
    /* JADX WARN: Removed duplicated region for block: B:380:0x085c  */
    /* JADX WARN: Removed duplicated region for block: B:383:0x088e  */
    /* JADX WARN: Removed duplicated region for block: B:386:0x0893  */
    /* JADX WARN: Removed duplicated region for block: B:389:0x08b5  */
    /* JADX WARN: Removed duplicated region for block: B:439:? 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: 2294
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: d.b.g.k0.onMeasure(int, int):void");
    }

    public int p() {
        return 0;
    }

    public void setBaselineAligned(boolean z2) {
        this.f2003f = z2;
    }

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

    public void setDividerDrawable(Drawable drawable) {
        if (drawable == this.f2013v) {
            return;
        }
        this.f2013v = drawable;
        if (drawable != null) {
            this.f2014w = drawable.getIntrinsicWidth();
            this.f2015x = drawable.getIntrinsicHeight();
        } else {
            this.f2014w = 0;
            this.f2015x = 0;
        }
        setWillNotDraw(drawable == null);
        requestLayout();
    }

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

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

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

    public void setMeasureWithLargestChildEnabled(boolean z2) {
        this.f2010s = z2;
    }

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

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

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

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

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