mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2024-12-28 18:12:31 -06:00
247 lines
7.1 KiB
Java
247 lines
7.1 KiB
Java
package androidx.constraintlayout.solver.state;
|
|
|
|
import androidx.constraintlayout.solver.widgets.ConstraintWidget;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class Dimension {
|
|
private final int WRAP_CONTENT;
|
|
Object mInitialValue;
|
|
boolean mIsSuggested;
|
|
int mMax;
|
|
int mMin;
|
|
float mPercent;
|
|
float mRatio;
|
|
int mValue;
|
|
public static final Object FIXED_DIMENSION = new Object();
|
|
public static final Object WRAP_DIMENSION = new Object();
|
|
public static final Object SPREAD_DIMENSION = new Object();
|
|
public static final Object PARENT_DIMENSION = new Object();
|
|
public static final Object PERCENT_DIMENSION = new Object();
|
|
|
|
/* loaded from: classes.dex */
|
|
public enum Type {
|
|
FIXED,
|
|
WRAP,
|
|
MATCH_PARENT,
|
|
MATCH_CONSTRAINT
|
|
}
|
|
|
|
public Dimension fixed(int i) {
|
|
this.mInitialValue = null;
|
|
this.mValue = i;
|
|
return this;
|
|
}
|
|
|
|
float getRatio() {
|
|
return this.mRatio;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public int getValue() {
|
|
return this.mValue;
|
|
}
|
|
|
|
public Dimension max(int i) {
|
|
if (this.mMax >= 0) {
|
|
this.mMax = i;
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public Dimension max(Object obj) {
|
|
Object obj2 = WRAP_DIMENSION;
|
|
if (obj == obj2 && this.mIsSuggested) {
|
|
this.mInitialValue = obj2;
|
|
this.mMax = Integer.MAX_VALUE;
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public Dimension min(int i) {
|
|
if (i >= 0) {
|
|
this.mMin = i;
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public Dimension min(Object obj) {
|
|
if (obj == WRAP_DIMENSION) {
|
|
this.mMin = -2;
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public Dimension percent(Object obj, float f) {
|
|
this.mPercent = f;
|
|
return this;
|
|
}
|
|
|
|
public Dimension ratio(float f) {
|
|
return this;
|
|
}
|
|
|
|
void setRatio(float f) {
|
|
this.mRatio = f;
|
|
}
|
|
|
|
void setValue(int i) {
|
|
this.mIsSuggested = false;
|
|
this.mInitialValue = null;
|
|
this.mValue = i;
|
|
}
|
|
|
|
public Dimension suggested(int i) {
|
|
this.mIsSuggested = true;
|
|
return this;
|
|
}
|
|
|
|
public Dimension suggested(Object obj) {
|
|
this.mInitialValue = obj;
|
|
this.mIsSuggested = true;
|
|
return this;
|
|
}
|
|
|
|
private Dimension() {
|
|
this.WRAP_CONTENT = -2;
|
|
this.mMin = 0;
|
|
this.mMax = Integer.MAX_VALUE;
|
|
this.mPercent = 1.0f;
|
|
this.mValue = 0;
|
|
this.mRatio = 1.0f;
|
|
this.mInitialValue = WRAP_DIMENSION;
|
|
this.mIsSuggested = false;
|
|
}
|
|
|
|
private Dimension(Object obj) {
|
|
this.WRAP_CONTENT = -2;
|
|
this.mMin = 0;
|
|
this.mMax = Integer.MAX_VALUE;
|
|
this.mPercent = 1.0f;
|
|
this.mValue = 0;
|
|
this.mRatio = 1.0f;
|
|
this.mIsSuggested = false;
|
|
this.mInitialValue = obj;
|
|
}
|
|
|
|
public static Dimension Suggested(int i) {
|
|
Dimension dimension = new Dimension();
|
|
dimension.suggested(i);
|
|
return dimension;
|
|
}
|
|
|
|
public static Dimension Suggested(Object obj) {
|
|
Dimension dimension = new Dimension();
|
|
dimension.suggested(obj);
|
|
return dimension;
|
|
}
|
|
|
|
public static Dimension Fixed(int i) {
|
|
Dimension dimension = new Dimension(FIXED_DIMENSION);
|
|
dimension.fixed(i);
|
|
return dimension;
|
|
}
|
|
|
|
public static Dimension Fixed(Object obj) {
|
|
Dimension dimension = new Dimension(FIXED_DIMENSION);
|
|
dimension.fixed(obj);
|
|
return dimension;
|
|
}
|
|
|
|
public static Dimension Percent(Object obj, float f) {
|
|
Dimension dimension = new Dimension(PERCENT_DIMENSION);
|
|
dimension.percent(obj, f);
|
|
return dimension;
|
|
}
|
|
|
|
public static Dimension Parent() {
|
|
return new Dimension(PARENT_DIMENSION);
|
|
}
|
|
|
|
public static Dimension Wrap() {
|
|
return new Dimension(WRAP_DIMENSION);
|
|
}
|
|
|
|
public static Dimension Spread() {
|
|
return new Dimension(SPREAD_DIMENSION);
|
|
}
|
|
|
|
public Dimension fixed(Object obj) {
|
|
this.mInitialValue = obj;
|
|
if (obj instanceof Integer) {
|
|
this.mValue = ((Integer) obj).intValue();
|
|
this.mInitialValue = null;
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public void apply(State state, ConstraintWidget constraintWidget, int i) {
|
|
int i2 = 2;
|
|
if (i == 0) {
|
|
if (this.mIsSuggested) {
|
|
constraintWidget.setHorizontalDimensionBehaviour(ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT);
|
|
Object obj = this.mInitialValue;
|
|
if (obj == WRAP_DIMENSION) {
|
|
i2 = 1;
|
|
} else if (obj != PERCENT_DIMENSION) {
|
|
i2 = 0;
|
|
}
|
|
constraintWidget.setHorizontalMatchStyle(i2, this.mMin, this.mMax, this.mPercent);
|
|
return;
|
|
}
|
|
int i3 = this.mMin;
|
|
if (i3 > 0) {
|
|
constraintWidget.setMinWidth(i3);
|
|
}
|
|
int i4 = this.mMax;
|
|
if (i4 < Integer.MAX_VALUE) {
|
|
constraintWidget.setMaxWidth(i4);
|
|
}
|
|
Object obj2 = this.mInitialValue;
|
|
if (obj2 == WRAP_DIMENSION) {
|
|
constraintWidget.setHorizontalDimensionBehaviour(ConstraintWidget.DimensionBehaviour.WRAP_CONTENT);
|
|
return;
|
|
}
|
|
if (obj2 == PARENT_DIMENSION) {
|
|
constraintWidget.setHorizontalDimensionBehaviour(ConstraintWidget.DimensionBehaviour.MATCH_PARENT);
|
|
return;
|
|
} else {
|
|
if (obj2 == null) {
|
|
constraintWidget.setHorizontalDimensionBehaviour(ConstraintWidget.DimensionBehaviour.FIXED);
|
|
constraintWidget.setWidth(this.mValue);
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
}
|
|
if (this.mIsSuggested) {
|
|
constraintWidget.setVerticalDimensionBehaviour(ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT);
|
|
Object obj3 = this.mInitialValue;
|
|
if (obj3 == WRAP_DIMENSION) {
|
|
i2 = 1;
|
|
} else if (obj3 != PERCENT_DIMENSION) {
|
|
i2 = 0;
|
|
}
|
|
constraintWidget.setVerticalMatchStyle(i2, this.mMin, this.mMax, this.mPercent);
|
|
return;
|
|
}
|
|
int i5 = this.mMin;
|
|
if (i5 > 0) {
|
|
constraintWidget.setMinHeight(i5);
|
|
}
|
|
int i6 = this.mMax;
|
|
if (i6 < Integer.MAX_VALUE) {
|
|
constraintWidget.setMaxHeight(i6);
|
|
}
|
|
Object obj4 = this.mInitialValue;
|
|
if (obj4 == WRAP_DIMENSION) {
|
|
constraintWidget.setVerticalDimensionBehaviour(ConstraintWidget.DimensionBehaviour.WRAP_CONTENT);
|
|
return;
|
|
}
|
|
if (obj4 == PARENT_DIMENSION) {
|
|
constraintWidget.setVerticalDimensionBehaviour(ConstraintWidget.DimensionBehaviour.MATCH_PARENT);
|
|
} else if (obj4 == null) {
|
|
constraintWidget.setVerticalDimensionBehaviour(ConstraintWidget.DimensionBehaviour.FIXED);
|
|
constraintWidget.setHeight(this.mValue);
|
|
}
|
|
}
|
|
}
|