Rabbit-R1/original r1/java/sources/androidx/constraintlayout/solver/widgets/VirtualLayout.java
2024-05-21 17:08:36 -04:00

174 lines
6.5 KiB
Java

package androidx.constraintlayout.solver.widgets;
import androidx.constraintlayout.solver.widgets.ConstraintWidget;
import androidx.constraintlayout.solver.widgets.analyzer.BasicMeasure;
/* loaded from: classes.dex */
public class VirtualLayout extends HelperWidget {
private int mPaddingTop = 0;
private int mPaddingBottom = 0;
private int mPaddingLeft = 0;
private int mPaddingRight = 0;
private int mPaddingStart = 0;
private int mPaddingEnd = 0;
private int mResolvedPaddingLeft = 0;
private int mResolvedPaddingRight = 0;
private boolean mNeedsCallFromSolver = false;
private int mMeasuredWidth = 0;
private int mMeasuredHeight = 0;
protected BasicMeasure.Measure mMeasure = new BasicMeasure.Measure();
BasicMeasure.Measurer mMeasurer = null;
public void applyRtl(boolean z) {
int i = this.mPaddingStart;
if (i > 0 || this.mPaddingEnd > 0) {
if (z) {
this.mResolvedPaddingLeft = this.mPaddingEnd;
this.mResolvedPaddingRight = i;
} else {
this.mResolvedPaddingLeft = i;
this.mResolvedPaddingRight = this.mPaddingEnd;
}
}
}
public int getMeasuredHeight() {
return this.mMeasuredHeight;
}
public int getMeasuredWidth() {
return this.mMeasuredWidth;
}
public int getPaddingBottom() {
return this.mPaddingBottom;
}
public int getPaddingLeft() {
return this.mResolvedPaddingLeft;
}
public int getPaddingRight() {
return this.mResolvedPaddingRight;
}
public int getPaddingTop() {
return this.mPaddingTop;
}
public void measure(int i, int i2, int i3, int i4) {
}
public boolean needSolverPass() {
return this.mNeedsCallFromSolver;
}
/* JADX INFO: Access modifiers changed from: protected */
public void needsCallbackFromSolver(boolean z) {
this.mNeedsCallFromSolver = z;
}
public void setMeasure(int i, int i2) {
this.mMeasuredWidth = i;
this.mMeasuredHeight = i2;
}
public void setPadding(int i) {
this.mPaddingLeft = i;
this.mPaddingTop = i;
this.mPaddingRight = i;
this.mPaddingBottom = i;
this.mPaddingStart = i;
this.mPaddingEnd = i;
}
public void setPaddingBottom(int i) {
this.mPaddingBottom = i;
}
public void setPaddingEnd(int i) {
this.mPaddingEnd = i;
}
public void setPaddingLeft(int i) {
this.mPaddingLeft = i;
this.mResolvedPaddingLeft = i;
}
public void setPaddingRight(int i) {
this.mPaddingRight = i;
this.mResolvedPaddingRight = i;
}
public void setPaddingStart(int i) {
this.mPaddingStart = i;
this.mResolvedPaddingLeft = i;
this.mResolvedPaddingRight = i;
}
public void setPaddingTop(int i) {
this.mPaddingTop = i;
}
@Override // androidx.constraintlayout.solver.widgets.HelperWidget, androidx.constraintlayout.solver.widgets.Helper
public void updateConstraints(ConstraintWidgetContainer constraintWidgetContainer) {
captureWidgets();
}
public void captureWidgets() {
for (int i = 0; i < this.mWidgetsCount; i++) {
ConstraintWidget constraintWidget = this.mWidgets[i];
if (constraintWidget != null) {
constraintWidget.setInVirtualLayout(true);
}
}
}
/* JADX INFO: Access modifiers changed from: protected */
public boolean measureChildren() {
BasicMeasure.Measurer measurer = this.mParent != null ? ((ConstraintWidgetContainer) this.mParent).getMeasurer() : null;
if (measurer == null) {
return false;
}
for (int i = 0; i < this.mWidgetsCount; i++) {
ConstraintWidget constraintWidget = this.mWidgets[i];
if (constraintWidget != null && !(constraintWidget instanceof Guideline)) {
ConstraintWidget.DimensionBehaviour dimensionBehaviour = constraintWidget.getDimensionBehaviour(0);
ConstraintWidget.DimensionBehaviour dimensionBehaviour2 = constraintWidget.getDimensionBehaviour(1);
if (dimensionBehaviour != ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT || constraintWidget.mMatchConstraintDefaultWidth == 1 || dimensionBehaviour2 != ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT || constraintWidget.mMatchConstraintDefaultHeight == 1) {
if (dimensionBehaviour == ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT) {
dimensionBehaviour = ConstraintWidget.DimensionBehaviour.WRAP_CONTENT;
}
if (dimensionBehaviour2 == ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT) {
dimensionBehaviour2 = ConstraintWidget.DimensionBehaviour.WRAP_CONTENT;
}
this.mMeasure.horizontalBehavior = dimensionBehaviour;
this.mMeasure.verticalBehavior = dimensionBehaviour2;
this.mMeasure.horizontalDimension = constraintWidget.getWidth();
this.mMeasure.verticalDimension = constraintWidget.getHeight();
measurer.measure(constraintWidget, this.mMeasure);
constraintWidget.setWidth(this.mMeasure.measuredWidth);
constraintWidget.setHeight(this.mMeasure.measuredHeight);
constraintWidget.setBaselineDistance(this.mMeasure.measuredBaseline);
}
}
}
return true;
}
/* JADX INFO: Access modifiers changed from: protected */
public void measure(ConstraintWidget constraintWidget, ConstraintWidget.DimensionBehaviour dimensionBehaviour, int i, ConstraintWidget.DimensionBehaviour dimensionBehaviour2, int i2) {
while (this.mMeasurer == null && getParent() != null) {
this.mMeasurer = ((ConstraintWidgetContainer) getParent()).getMeasurer();
}
this.mMeasure.horizontalBehavior = dimensionBehaviour;
this.mMeasure.verticalBehavior = dimensionBehaviour2;
this.mMeasure.horizontalDimension = i;
this.mMeasure.verticalDimension = i2;
this.mMeasurer.measure(constraintWidget, this.mMeasure);
constraintWidget.setWidth(this.mMeasure.measuredWidth);
constraintWidget.setHeight(this.mMeasure.measuredHeight);
constraintWidget.setHasBaseline(this.mMeasure.measuredHasBaseline);
constraintWidget.setBaselineDistance(this.mMeasure.measuredBaseline);
}
}