mirror of
https://github.com/VibedByKaKi/alexandroid.git
synced 2026-11-18 11:57:18 +01:00
92 lines
3.5 KiB
Java
92 lines
3.5 KiB
Java
package com.google.android.material.internal;
|
|
|
|
import android.content.Context;
|
|
import android.util.AttributeSet;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import androidx.biometric.ErrorUtils$$ExternalSyntheticOutline0;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
/* loaded from: classes7.dex */
|
|
public class BaselineLayout extends ViewGroup {
|
|
private int baseline;
|
|
private boolean measurePaddingFromBaseline;
|
|
|
|
public BaselineLayout(Context context) {
|
|
super(context, null, 0);
|
|
this.baseline = -1;
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public int getBaseline() {
|
|
return this.baseline;
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.View
|
|
public void onLayout(boolean z, int i, int i2, int i3, int i4) {
|
|
int childCount = getChildCount();
|
|
int paddingLeft = getPaddingLeft();
|
|
int paddingRight = ((i3 - i) - getPaddingRight()) - paddingLeft;
|
|
int paddingTop = getPaddingTop();
|
|
for (int i5 = 0; i5 < childCount; i5++) {
|
|
View childAt = getChildAt(i5);
|
|
if (childAt.getVisibility() != 8) {
|
|
int measuredWidth = childAt.getMeasuredWidth();
|
|
int measuredHeight = childAt.getMeasuredHeight();
|
|
int m = ErrorUtils$$ExternalSyntheticOutline0.m(paddingRight, measuredWidth, 2, paddingLeft);
|
|
int baseline = (this.baseline == -1 || childAt.getBaseline() == -1) ? paddingTop : (this.baseline + paddingTop) - childAt.getBaseline();
|
|
childAt.layout(m, baseline, measuredWidth + m, measuredHeight + baseline);
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public void onMeasure(int i, int i2) {
|
|
int childCount = getChildCount();
|
|
int i3 = 0;
|
|
int i4 = 0;
|
|
int i5 = 0;
|
|
int i6 = 0;
|
|
int i7 = -1;
|
|
int i8 = -1;
|
|
for (int i9 = 0; i9 < childCount; i9++) {
|
|
View childAt = getChildAt(i9);
|
|
if (childAt.getVisibility() != 8) {
|
|
measureChild(childAt, i, i2);
|
|
i3 = Math.max(i3, childAt.getMeasuredHeight());
|
|
int baseline = childAt.getBaseline();
|
|
if (baseline != -1) {
|
|
i7 = Math.max(i7, baseline);
|
|
i8 = Math.max(i8, childAt.getMeasuredHeight() - baseline);
|
|
}
|
|
i5 = Math.max(i5, childAt.getMeasuredWidth());
|
|
i4 = Math.max(i4, childAt.getMeasuredHeight());
|
|
i6 = View.combineMeasuredStates(i6, childAt.getMeasuredState());
|
|
}
|
|
}
|
|
if (i7 != -1) {
|
|
if (this.measurePaddingFromBaseline) {
|
|
i4 = Math.max(i4, Math.max(i8, getPaddingBottom()) + i7);
|
|
}
|
|
this.baseline = i7;
|
|
}
|
|
if (!this.measurePaddingFromBaseline) {
|
|
i4 = getPaddingBottom() + i3;
|
|
}
|
|
setMeasuredDimension(View.resolveSizeAndState(Math.max(i5, getSuggestedMinimumWidth()), i, i6), View.resolveSizeAndState(Math.max(i4, getSuggestedMinimumHeight()), i2, i6 << 16));
|
|
}
|
|
|
|
public void setMeasurePaddingFromBaseline(boolean z) {
|
|
this.measurePaddingFromBaseline = z;
|
|
}
|
|
|
|
public BaselineLayout(Context context, AttributeSet attributeSet) {
|
|
super(context, attributeSet, 0);
|
|
this.baseline = -1;
|
|
}
|
|
|
|
public BaselineLayout(Context context, AttributeSet attributeSet, int i) {
|
|
super(context, attributeSet, i);
|
|
this.baseline = -1;
|
|
}
|
|
}
|