jimu-decompiled/sources/androidx/constraintlayout/solver/widgets/Guideline.java
2025-05-13 19:24:51 +02:00

258 lines
8.0 KiB
Java

package androidx.constraintlayout.solver.widgets;
import androidx.constraintlayout.solver.LinearSystem;
import androidx.constraintlayout.solver.SolverVariable;
import androidx.constraintlayout.solver.widgets.ConstraintAnchor;
import androidx.constraintlayout.solver.widgets.ConstraintWidget;
import java.util.ArrayList;
/* loaded from: classes.dex */
public class Guideline extends ConstraintWidget {
protected float k0 = -1.0f;
protected int l0 = -1;
protected int m0 = -1;
private ConstraintAnchor n0 = this.t;
private int o0 = 0;
private boolean p0 = false;
/* renamed from: androidx.constraintlayout.solver.widgets.Guideline$1, reason: invalid class name */
static /* synthetic */ class AnonymousClass1 {
static final /* synthetic */ int[] a = new int[ConstraintAnchor.Type.values().length];
static {
try {
a[ConstraintAnchor.Type.LEFT.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
a[ConstraintAnchor.Type.RIGHT.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
a[ConstraintAnchor.Type.TOP.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
a[ConstraintAnchor.Type.BOTTOM.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
try {
a[ConstraintAnchor.Type.BASELINE.ordinal()] = 5;
} catch (NoSuchFieldError unused5) {
}
try {
a[ConstraintAnchor.Type.CENTER.ordinal()] = 6;
} catch (NoSuchFieldError unused6) {
}
try {
a[ConstraintAnchor.Type.CENTER_X.ordinal()] = 7;
} catch (NoSuchFieldError unused7) {
}
try {
a[ConstraintAnchor.Type.CENTER_Y.ordinal()] = 8;
} catch (NoSuchFieldError unused8) {
}
try {
a[ConstraintAnchor.Type.NONE.ordinal()] = 9;
} catch (NoSuchFieldError unused9) {
}
}
}
public Guideline() {
new Rectangle();
this.B.clear();
this.B.add(this.n0);
int length = this.A.length;
for (int i = 0; i < length; i++) {
this.A[i] = this.n0;
}
}
public int J() {
return this.o0;
}
@Override // androidx.constraintlayout.solver.widgets.ConstraintWidget
public ConstraintAnchor a(ConstraintAnchor.Type type) {
switch (AnonymousClass1.a[type.ordinal()]) {
case 1:
case 2:
if (this.o0 == 1) {
return this.n0;
}
break;
case 3:
case 4:
if (this.o0 == 0) {
return this.n0;
}
break;
case 5:
case 6:
case 7:
case 8:
case 9:
return null;
}
throw new AssertionError(type.name());
}
@Override // androidx.constraintlayout.solver.widgets.ConstraintWidget
public boolean a() {
return true;
}
@Override // androidx.constraintlayout.solver.widgets.ConstraintWidget
public ArrayList<ConstraintAnchor> b() {
return this.B;
}
@Override // androidx.constraintlayout.solver.widgets.ConstraintWidget
public void c(LinearSystem linearSystem) {
if (k() == null) {
return;
}
int b = linearSystem.b(this.n0);
if (this.o0 == 1) {
r(b);
s(0);
g(k().i());
o(0);
return;
}
r(0);
s(b);
o(k().s());
g(0);
}
public void e(float f) {
if (f > -1.0f) {
this.k0 = f;
this.l0 = -1;
this.m0 = -1;
}
}
public void t(int i) {
if (i > -1) {
this.k0 = -1.0f;
this.l0 = i;
this.m0 = -1;
}
}
public void u(int i) {
if (i > -1) {
this.k0 = -1.0f;
this.l0 = -1;
this.m0 = i;
}
}
public void v(int i) {
if (this.o0 == i) {
return;
}
this.o0 = i;
this.B.clear();
if (this.o0 == 1) {
this.n0 = this.s;
} else {
this.n0 = this.t;
}
this.B.add(this.n0);
int length = this.A.length;
for (int i2 = 0; i2 < length; i2++) {
this.A[i2] = this.n0;
}
}
@Override // androidx.constraintlayout.solver.widgets.ConstraintWidget
public void a(int i) {
ConstraintWidget k = k();
if (k == null) {
return;
}
if (J() == 1) {
this.t.d().a(1, k.t.d(), 0);
this.v.d().a(1, k.t.d(), 0);
if (this.l0 != -1) {
this.s.d().a(1, k.s.d(), this.l0);
this.u.d().a(1, k.s.d(), this.l0);
return;
} else if (this.m0 != -1) {
this.s.d().a(1, k.u.d(), -this.m0);
this.u.d().a(1, k.u.d(), -this.m0);
return;
} else {
if (this.k0 == -1.0f || k.j() != ConstraintWidget.DimensionBehaviour.FIXED) {
return;
}
int i2 = (int) (k.E * this.k0);
this.s.d().a(1, k.s.d(), i2);
this.u.d().a(1, k.s.d(), i2);
return;
}
}
this.s.d().a(1, k.s.d(), 0);
this.u.d().a(1, k.s.d(), 0);
if (this.l0 != -1) {
this.t.d().a(1, k.t.d(), this.l0);
this.v.d().a(1, k.t.d(), this.l0);
} else if (this.m0 != -1) {
this.t.d().a(1, k.v.d(), -this.m0);
this.v.d().a(1, k.v.d(), -this.m0);
} else {
if (this.k0 == -1.0f || k.q() != ConstraintWidget.DimensionBehaviour.FIXED) {
return;
}
int i3 = (int) (k.F * this.k0);
this.t.d().a(1, k.t.d(), i3);
this.v.d().a(1, k.t.d(), i3);
}
}
@Override // androidx.constraintlayout.solver.widgets.ConstraintWidget
public void a(LinearSystem linearSystem) {
ConstraintWidgetContainer constraintWidgetContainer = (ConstraintWidgetContainer) k();
if (constraintWidgetContainer == null) {
return;
}
ConstraintAnchor a = constraintWidgetContainer.a(ConstraintAnchor.Type.LEFT);
ConstraintAnchor a2 = constraintWidgetContainer.a(ConstraintAnchor.Type.RIGHT);
ConstraintWidget constraintWidget = this.D;
boolean z = constraintWidget != null && constraintWidget.C[0] == ConstraintWidget.DimensionBehaviour.WRAP_CONTENT;
if (this.o0 == 0) {
a = constraintWidgetContainer.a(ConstraintAnchor.Type.TOP);
a2 = constraintWidgetContainer.a(ConstraintAnchor.Type.BOTTOM);
ConstraintWidget constraintWidget2 = this.D;
z = constraintWidget2 != null && constraintWidget2.C[1] == ConstraintWidget.DimensionBehaviour.WRAP_CONTENT;
}
if (this.l0 != -1) {
SolverVariable a3 = linearSystem.a(this.n0);
linearSystem.a(a3, linearSystem.a(a), this.l0, 6);
if (z) {
linearSystem.b(linearSystem.a(a2), a3, 0, 5);
return;
}
return;
}
if (this.m0 == -1) {
if (this.k0 != -1.0f) {
linearSystem.a(LinearSystem.a(linearSystem, linearSystem.a(this.n0), linearSystem.a(a), linearSystem.a(a2), this.k0, this.p0));
return;
}
return;
}
SolverVariable a4 = linearSystem.a(this.n0);
SolverVariable a5 = linearSystem.a(a2);
linearSystem.a(a4, a5, -this.m0, 6);
if (z) {
linearSystem.b(a4, linearSystem.a(a), 0, 5);
linearSystem.b(a5, a4, 0, 5);
}
}
}