package com.squareup.leakcanary.internal; import android.content.Context; import android.content.res.Resources; import android.util.AttributeSet; import android.view.View; import android.view.ViewGroup; import com.squareup.leakcanary.R; /* loaded from: classes.dex */ public class RowElementLayout extends ViewGroup { private View connector; private final int connectorWidth; private View details; private final int minHeight; private View moreButton; private final int moreMarginTop; private final int moreSize; private final int rowMargins; private View title; private final int titleMarginTop; public RowElementLayout(Context context, AttributeSet attributeSet) { super(context, attributeSet); Resources resources = getResources(); this.connectorWidth = resources.getDimensionPixelSize(R.dimen.leak_canary_connector_width); this.rowMargins = resources.getDimensionPixelSize(R.dimen.leak_canary_row_margins); this.moreSize = resources.getDimensionPixelSize(R.dimen.leak_canary_more_size); this.minHeight = resources.getDimensionPixelSize(R.dimen.leak_canary_row_min); this.titleMarginTop = resources.getDimensionPixelSize(R.dimen.leak_canary_row_title_margin_top); this.moreMarginTop = resources.getDimensionPixelSize(R.dimen.leak_canary_more_margin_top); } @Override // android.view.View protected void onFinishInflate() { super.onFinishInflate(); this.connector = findViewById(R.id.leak_canary_row_connector); this.moreButton = findViewById(R.id.leak_canary_row_more); this.title = findViewById(R.id.leak_canary_row_title); this.details = findViewById(R.id.leak_canary_row_details); } @Override // android.view.ViewGroup, android.view.View protected void onLayout(boolean z, int i, int i2, int i3, int i4) { int measuredWidth = getMeasuredWidth(); int measuredWidth2 = this.rowMargins + this.connector.getMeasuredWidth(); View view = this.connector; view.layout(this.rowMargins, 0, measuredWidth2, view.getMeasuredHeight()); View view2 = this.moreButton; int i5 = this.rowMargins; int i6 = this.moreSize; int i7 = this.moreMarginTop; view2.layout((measuredWidth - i5) - i6, i7, measuredWidth - i5, i6 + i7); int i8 = measuredWidth2 + this.rowMargins; int measuredHeight = this.titleMarginTop + this.title.getMeasuredHeight(); View view3 = this.title; view3.layout(i8, this.titleMarginTop, view3.getMeasuredWidth() + i8, measuredHeight); if (this.details.getVisibility() != 8) { View view4 = this.details; view4.layout(i8, measuredHeight, measuredWidth - this.rowMargins, view4.getMeasuredHeight() + measuredHeight); } } @Override // android.view.View protected void onMeasure(int i, int i2) { int size = View.MeasureSpec.getSize(i); this.title.measure(View.MeasureSpec.makeMeasureSpec(((size - this.connectorWidth) - this.moreSize) - (this.rowMargins * 4), Integer.MIN_VALUE), View.MeasureSpec.makeMeasureSpec(0, 0)); int makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(this.moreSize, 1073741824); this.moreButton.measure(makeMeasureSpec, makeMeasureSpec); int measuredHeight = this.titleMarginTop + this.title.getMeasuredHeight(); this.details.measure(View.MeasureSpec.makeMeasureSpec((size - this.connectorWidth) - (this.rowMargins * 3), Integer.MIN_VALUE), View.MeasureSpec.makeMeasureSpec(0, 0)); if (this.details.getVisibility() != 8) { measuredHeight += this.details.getMeasuredHeight(); } int max = Math.max(measuredHeight, this.minHeight); this.connector.measure(View.MeasureSpec.makeMeasureSpec(this.connectorWidth, 1073741824), View.MeasureSpec.makeMeasureSpec(max, 1073741824)); setMeasuredDimension(size, max); } }