package androidx.appcompat.widget; import android.content.Context; 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; import androidx.appcompat.R; import androidx.core.view.GravityCompat; import androidx.core.view.ViewCompat; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; /* loaded from: classes.dex */ public class LinearLayoutCompat 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; @Retention(RetentionPolicy.SOURCE) /* loaded from: classes.dex */ public @interface DividerMode { } @Retention(RetentionPolicy.SOURCE) /* loaded from: classes.dex */ public @interface OrientationMode { } public int getBaselineAlignedChildIndex() { return this.mBaselineAlignedChildIndex; } int getChildrenSkipCount(View view, int i) { return 0; } public Drawable getDividerDrawable() { return this.mDivider; } public int getDividerPadding() { return this.mDividerPadding; } public int getDividerWidth() { return this.mDividerWidth; } public int getGravity() { return this.mGravity; } int getLocationOffset(View view) { return 0; } int getNextLocationOffset(View view) { return 0; } public int getOrientation() { return this.mOrientation; } public int getShowDividers() { return this.mShowDividers; } public float getWeightSum() { return this.mWeightSum; } public boolean isBaselineAligned() { return this.mBaselineAligned; } public boolean isMeasureWithLargestChildEnabled() { return this.mUseLargestChild; } int measureNullChild(int i) { return 0; } public void setBaselineAligned(boolean z) { this.mBaselineAligned = z; } public void setDividerPadding(int i) { this.mDividerPadding = i; } public void setMeasureWithLargestChildEnabled(boolean z) { this.mUseLargestChild = z; } @Override // android.view.ViewGroup public boolean shouldDelayChildPressedState() { return false; } public LinearLayoutCompat(Context context) { this(context, null); } public LinearLayoutCompat(Context context, AttributeSet attributeSet) { this(context, attributeSet, 0); } public LinearLayoutCompat(Context context, AttributeSet attributeSet, int i) { super(context, attributeSet, i); this.mBaselineAligned = true; this.mBaselineAlignedChildIndex = -1; this.mBaselineChildTop = 0; this.mGravity = 8388659; TintTypedArray obtainStyledAttributes = TintTypedArray.obtainStyledAttributes(context, attributeSet, R.styleable.LinearLayoutCompat, i, 0); ViewCompat.saveAttributeDataForStyleable(this, context, R.styleable.LinearLayoutCompat, attributeSet, obtainStyledAttributes.getWrappedTypeArray(), i, 0); int i2 = obtainStyledAttributes.getInt(R.styleable.LinearLayoutCompat_android_orientation, -1); if (i2 >= 0) { setOrientation(i2); } int i3 = obtainStyledAttributes.getInt(R.styleable.LinearLayoutCompat_android_gravity, -1); if (i3 >= 0) { setGravity(i3); } boolean z = obtainStyledAttributes.getBoolean(R.styleable.LinearLayoutCompat_android_baselineAligned, true); if (!z) { setBaselineAligned(z); } this.mWeightSum = obtainStyledAttributes.getFloat(R.styleable.LinearLayoutCompat_android_weightSum, -1.0f); this.mBaselineAlignedChildIndex = obtainStyledAttributes.getInt(R.styleable.LinearLayoutCompat_android_baselineAlignedChildIndex, -1); this.mUseLargestChild = obtainStyledAttributes.getBoolean(R.styleable.LinearLayoutCompat_measureWithLargestChild, false); setDividerDrawable(obtainStyledAttributes.getDrawable(R.styleable.LinearLayoutCompat_divider)); this.mShowDividers = obtainStyledAttributes.getInt(R.styleable.LinearLayoutCompat_showDividers, 0); this.mDividerPadding = obtainStyledAttributes.getDimensionPixelSize(R.styleable.LinearLayoutCompat_dividerPadding, 0); obtainStyledAttributes.recycle(); } public void setShowDividers(int i) { if (i != this.mShowDividers) { requestLayout(); } this.mShowDividers = i; } 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(); } @Override // android.view.View protected void onDraw(Canvas canvas) { if (this.mDivider == null) { return; } if (this.mOrientation == 1) { drawDividersVertical(canvas); } else { drawDividersHorizontal(canvas); } } void drawDividersVertical(Canvas canvas) { int bottom; 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() - ((LayoutParams) virtualChildAt.getLayoutParams()).topMargin) - this.mDividerHeight); } } if (hasDividerBeforeChildAt(virtualChildCount)) { View virtualChildAt2 = getVirtualChildAt(virtualChildCount - 1); if (virtualChildAt2 == null) { bottom = (getHeight() - getPaddingBottom()) - this.mDividerHeight; } else { bottom = virtualChildAt2.getBottom() + ((LayoutParams) virtualChildAt2.getLayoutParams()).bottomMargin; } drawHorizontalDivider(canvas, bottom); } } void drawDividersHorizontal(Canvas canvas) { int right; int left; int i; int left2; int virtualChildCount = getVirtualChildCount(); boolean isLayoutRtl = ViewUtils.isLayoutRtl(this); for (int i2 = 0; i2 < virtualChildCount; i2++) { View virtualChildAt = getVirtualChildAt(i2); if (virtualChildAt != null && virtualChildAt.getVisibility() != 8 && hasDividerBeforeChildAt(i2)) { LayoutParams layoutParams = (LayoutParams) virtualChildAt.getLayoutParams(); if (isLayoutRtl) { left2 = virtualChildAt.getRight() + layoutParams.rightMargin; } else { left2 = (virtualChildAt.getLeft() - layoutParams.leftMargin) - this.mDividerWidth; } drawVerticalDivider(canvas, left2); } } if (hasDividerBeforeChildAt(virtualChildCount)) { View virtualChildAt2 = getVirtualChildAt(virtualChildCount - 1); if (virtualChildAt2 != null) { LayoutParams layoutParams2 = (LayoutParams) virtualChildAt2.getLayoutParams(); if (isLayoutRtl) { left = virtualChildAt2.getLeft() - layoutParams2.leftMargin; i = this.mDividerWidth; right = left - i; } else { right = virtualChildAt2.getRight() + layoutParams2.rightMargin; } } else if (isLayoutRtl) { right = getPaddingLeft(); } else { left = getWidth() - getPaddingRight(); i = this.mDividerWidth; right = left - i; } drawVerticalDivider(canvas, right); } } void drawHorizontalDivider(Canvas canvas, int i) { this.mDivider.setBounds(getPaddingLeft() + this.mDividerPadding, i, (getWidth() - getPaddingRight()) - this.mDividerPadding, this.mDividerHeight + i); this.mDivider.draw(canvas); } 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 i3 = this.mBaselineChildTop; if (this.mOrientation == 1 && (i = this.mGravity & 112) != 48) { if (i == 16) { i3 += ((((getBottom() - getTop()) - getPaddingTop()) - getPaddingBottom()) - this.mTotalLength) / 2; } else if (i == 80) { i3 = ((getBottom() - getTop()) - getPaddingBottom()) - this.mTotalLength; } } return i3 + ((LayoutParams) childAt.getLayoutParams()).topMargin + baseline; } public void setBaselineAlignedChildIndex(int i) { if (i < 0 || i >= getChildCount()) { throw new IllegalArgumentException("base aligned child index out of range (0, " + getChildCount() + ")"); } this.mBaselineAlignedChildIndex = i; } View getVirtualChildAt(int i) { return getChildAt(i); } int getVirtualChildCount() { return getChildCount(); } public void setWeightSum(float f) { this.mWeightSum = Math.max(0.0f, f); } /* JADX INFO: Access modifiers changed from: protected */ @Override // android.view.View public void onMeasure(int i, int i2) { if (this.mOrientation == 1) { measureVertical(i, i2); } else { measureHorizontal(i, i2); } } /* JADX INFO: Access modifiers changed from: protected */ 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) { return false; } for (int i2 = i - 1; i2 >= 0; i2--) { if (getChildAt(i2).getVisibility() != 8) { return true; } } return false; } /* JADX WARN: Code restructure failed: missing block: B:155:0x031f, code lost: if (r14.width == (-1)) goto L148; */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ void measureVertical(int r34, int r35) { /* Method dump skipped, instructions count: 914 To view this dump add '--comments-level debug' option */ throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.LinearLayoutCompat.measureVertical(int, int):void"); } private void forceUniformWidth(int i, int i2) { int makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(getMeasuredWidth(), 1073741824); for (int i3 = 0; i3 < i; i3++) { View virtualChildAt = getVirtualChildAt(i3); if (virtualChildAt.getVisibility() != 8) { LayoutParams layoutParams = (LayoutParams) virtualChildAt.getLayoutParams(); if (layoutParams.width == -1) { int i4 = layoutParams.height; layoutParams.height = virtualChildAt.getMeasuredHeight(); measureChildWithMargins(virtualChildAt, makeMeasureSpec, 0, i2, 0); layoutParams.height = i4; } } } } /* JADX WARN: Removed duplicated region for block: B:196:0x0459 */ /* JADX WARN: Removed duplicated region for block: B:198:0x045c */ /* JADX WARN: Removed duplicated region for block: B:44:0x019d */ /* JADX WARN: Removed duplicated region for block: B:46:0x01a0 */ /* JADX WARN: Removed duplicated region for block: B:54:0x01d4 */ /* JADX WARN: Removed duplicated region for block: B:59:0x01df */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ void measureHorizontal(int r39, int r40) { /* Method dump skipped, instructions count: 1301 To view this dump add '--comments-level debug' option */ throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.LinearLayoutCompat.measureHorizontal(int, int):void"); } private void forceUniformHeight(int i, int i2) { int makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(getMeasuredHeight(), 1073741824); for (int i3 = 0; i3 < i; i3++) { View virtualChildAt = getVirtualChildAt(i3); if (virtualChildAt.getVisibility() != 8) { LayoutParams layoutParams = (LayoutParams) virtualChildAt.getLayoutParams(); if (layoutParams.height == -1) { int i4 = layoutParams.width; layoutParams.width = virtualChildAt.getMeasuredWidth(); measureChildWithMargins(virtualChildAt, i2, 0, makeMeasureSpec, 0); layoutParams.width = i4; } } } } void measureChildBeforeLayout(View view, int i, int i2, int i3, int i4, int i5) { measureChildWithMargins(view, i2, i3, i4, i5); } /* JADX INFO: Access modifiers changed from: protected */ @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); } } /* JADX WARN: Removed duplicated region for block: B:26:0x009f */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ void layoutVertical(int r18, int r19, int r20, int r21) { /* r17 = this; r6 = r17 int r7 = r17.getPaddingLeft() int r0 = r20 - r18 int r1 = r17.getPaddingRight() int r8 = r0 - r1 int r0 = r0 - r7 int r1 = r17.getPaddingRight() int r9 = r0 - r1 int r10 = r17.getVirtualChildCount() int r0 = r6.mGravity r1 = r0 & 112(0x70, float:1.57E-43) r2 = 8388615(0x800007, float:1.1754953E-38) r11 = r0 & r2 r0 = 16 if (r1 == r0) goto L3b r0 = 80 if (r1 == r0) goto L2f int r0 = r17.getPaddingTop() goto L47 L2f: int r0 = r17.getPaddingTop() int r0 = r0 + r21 int r0 = r0 - r19 int r1 = r6.mTotalLength int r0 = r0 - r1 goto L47 L3b: int r0 = r17.getPaddingTop() int r1 = r21 - r19 int r2 = r6.mTotalLength int r1 = r1 - r2 int r1 = r1 / 2 int r0 = r0 + r1 L47: r1 = 0 r12 = r1 L49: if (r12 >= r10) goto Lcb android.view.View r13 = r6.getVirtualChildAt(r12) r14 = 1 if (r13 != 0) goto L59 int r1 = r6.measureNullChild(r12) int r0 = r0 + r1 goto Lc7 L59: int r1 = r13.getVisibility() r2 = 8 if (r1 == r2) goto Lc7 int r4 = r13.getMeasuredWidth() int r15 = r13.getMeasuredHeight() android.view.ViewGroup$LayoutParams r1 = r13.getLayoutParams() r5 = r1 androidx.appcompat.widget.LinearLayoutCompat$LayoutParams r5 = (androidx.appcompat.widget.LinearLayoutCompat.LayoutParams) r5 int r1 = r5.gravity if (r1 >= 0) goto L75 r1 = r11 L75: int r2 = androidx.core.view.ViewCompat.getLayoutDirection(r17) int r1 = androidx.core.view.GravityCompat.getAbsoluteGravity(r1, r2) r1 = r1 & 7 if (r1 == r14) goto L8d r2 = 5 if (r1 == r2) goto L88 int r1 = r5.leftMargin int r1 = r1 + r7 goto L98 L88: int r1 = r8 - r4 int r2 = r5.rightMargin goto L97 L8d: int r1 = r9 - r4 int r1 = r1 / 2 int r1 = r1 + r7 int r2 = r5.leftMargin int r1 = r1 + r2 int r2 = r5.rightMargin L97: int r1 = r1 - r2 L98: r2 = r1 boolean r1 = r6.hasDividerBeforeChildAt(r12) if (r1 == 0) goto La2 int r1 = r6.mDividerHeight int r0 = r0 + r1 La2: int r1 = r5.topMargin int r16 = r0 + r1 int r0 = r6.getLocationOffset(r13) int r3 = r16 + r0 r0 = r17 r1 = r13 r14 = r5 r5 = r15 r0.setChildFrame(r1, r2, r3, r4, r5) int r0 = r14.bottomMargin int r15 = r15 + r0 int r0 = r6.getNextLocationOffset(r13) int r15 = r15 + r0 int r16 = r16 + r15 int r0 = r6.getChildrenSkipCount(r13, r12) int r12 = r12 + r0 r0 = r16 r1 = 1 goto Lc8 Lc7: r1 = r14 Lc8: int r12 = r12 + r1 goto L49 Lcb: return */ throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.LinearLayoutCompat.layoutVertical(int, int, int, int):void"); } /* JADX WARN: Removed duplicated region for block: B:26:0x00af */ /* JADX WARN: Removed duplicated region for block: B:29:0x00b8 */ /* JADX WARN: Removed duplicated region for block: B:37:0x00ff */ /* JADX WARN: Removed duplicated region for block: B:46:0x00eb */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ void layoutHorizontal(int r25, int r26, int r27, int r28) { /* Method dump skipped, instructions count: 330 To view this dump add '--comments-level debug' option */ throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.LinearLayoutCompat.layoutHorizontal(int, int, int, int):void"); } private void setChildFrame(View view, int i, int i2, int i3, int i4) { view.layout(i, i2, i3 + i, i4 + i2); } public void setOrientation(int i) { if (this.mOrientation != i) { this.mOrientation = i; requestLayout(); } } public void setGravity(int i) { if (this.mGravity != i) { if ((8388615 & i) == 0) { i |= GravityCompat.START; } if ((i & 112) == 0) { i |= 48; } this.mGravity = i; requestLayout(); } } public void setHorizontalGravity(int i) { int i2 = i & GravityCompat.RELATIVE_HORIZONTAL_GRAVITY_MASK; int i3 = this.mGravity; if ((8388615 & i3) != i2) { this.mGravity = i2 | ((-8388616) & i3); requestLayout(); } } public void setVerticalGravity(int i) { int i2 = i & 112; int i3 = this.mGravity; if ((i3 & 112) != i2) { this.mGravity = i2 | (i3 & (-113)); requestLayout(); } } @Override // android.view.ViewGroup public LayoutParams generateLayoutParams(AttributeSet attributeSet) { return new LayoutParams(getContext(), attributeSet); } /* JADX INFO: Access modifiers changed from: protected */ @Override // android.view.ViewGroup public LayoutParams generateDefaultLayoutParams() { int i = this.mOrientation; if (i == 0) { return new LayoutParams(-2, -2); } if (i == 1) { return new LayoutParams(-1, -2); } return null; } /* JADX INFO: Access modifiers changed from: protected */ @Override // android.view.ViewGroup public LayoutParams generateLayoutParams(ViewGroup.LayoutParams layoutParams) { return new LayoutParams(layoutParams); } @Override // android.view.ViewGroup protected boolean checkLayoutParams(ViewGroup.LayoutParams layoutParams) { return layoutParams instanceof LayoutParams; } @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); } /* loaded from: classes.dex */ public static class LayoutParams extends LinearLayout.LayoutParams { public LayoutParams(Context context, AttributeSet attributeSet) { super(context, attributeSet); } public LayoutParams(int i, int i2) { super(i, i2); } public LayoutParams(int i, int i2, float f) { super(i, i2, f); } public LayoutParams(ViewGroup.LayoutParams layoutParams) { super(layoutParams); } public LayoutParams(ViewGroup.MarginLayoutParams marginLayoutParams) { super(marginLayoutParams); } } }