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

249 lines
7.8 KiB
Java

package androidx.constraintlayout.solver.widgets;
import androidx.constraintlayout.solver.LinearSystem;
import androidx.constraintlayout.solver.SolverVariable;
import androidx.constraintlayout.solver.widgets.ConstraintAnchor;
/* loaded from: classes.dex */
public class ResolutionAnchor extends ResolutionNode {
ConstraintAnchor c;
ResolutionAnchor d;
float e;
ResolutionAnchor f;
float g;
private ResolutionAnchor i;
int h = 0;
private ResolutionDimension j = null;
private int k = 1;
private ResolutionDimension l = null;
private int m = 1;
public ResolutionAnchor(ConstraintAnchor constraintAnchor) {
this.c = constraintAnchor;
}
String a(int i) {
return i == 1 ? "DIRECT" : i == 2 ? "CENTER" : i == 3 ? "MATCH" : i == 4 ? "CHAIN" : i == 5 ? "BARRIER" : "UNCONNECTED";
}
public void a(ResolutionAnchor resolutionAnchor, float f) {
if (this.b == 0 || !(this.f == resolutionAnchor || this.g == f)) {
this.f = resolutionAnchor;
this.g = f;
if (this.b == 1) {
b();
}
a();
}
}
public void b(int i) {
this.h = i;
}
@Override // androidx.constraintlayout.solver.widgets.ResolutionNode
public void d() {
super.d();
this.d = null;
this.e = 0.0f;
this.j = null;
this.k = 1;
this.l = null;
this.m = 1;
this.f = null;
this.g = 0.0f;
this.i = null;
this.h = 0;
}
@Override // androidx.constraintlayout.solver.widgets.ResolutionNode
public void e() {
ResolutionAnchor resolutionAnchor;
ResolutionAnchor resolutionAnchor2;
ResolutionAnchor resolutionAnchor3;
ResolutionAnchor resolutionAnchor4;
ResolutionAnchor resolutionAnchor5;
ResolutionAnchor resolutionAnchor6;
float f;
float f2;
float s;
float f3;
ResolutionAnchor resolutionAnchor7;
boolean z = true;
if (this.b == 1 || this.h == 4) {
return;
}
ResolutionDimension resolutionDimension = this.j;
if (resolutionDimension != null) {
if (resolutionDimension.b != 1) {
return;
} else {
this.e = this.k * resolutionDimension.c;
}
}
ResolutionDimension resolutionDimension2 = this.l;
if (resolutionDimension2 != null) {
if (resolutionDimension2.b != 1) {
return;
} else {
float f4 = resolutionDimension2.c;
}
}
if (this.h == 1 && ((resolutionAnchor7 = this.d) == null || resolutionAnchor7.b == 1)) {
ResolutionAnchor resolutionAnchor8 = this.d;
if (resolutionAnchor8 == null) {
this.f = this;
this.g = this.e;
} else {
this.f = resolutionAnchor8.f;
this.g = resolutionAnchor8.g + this.e;
}
a();
return;
}
if (this.h != 2 || (resolutionAnchor4 = this.d) == null || resolutionAnchor4.b != 1 || (resolutionAnchor5 = this.i) == null || (resolutionAnchor6 = resolutionAnchor5.d) == null || resolutionAnchor6.b != 1) {
if (this.h != 3 || (resolutionAnchor = this.d) == null || resolutionAnchor.b != 1 || (resolutionAnchor2 = this.i) == null || (resolutionAnchor3 = resolutionAnchor2.d) == null || resolutionAnchor3.b != 1) {
if (this.h == 5) {
this.c.b.G();
return;
}
return;
}
if (LinearSystem.h() != null) {
LinearSystem.h().w++;
}
ResolutionAnchor resolutionAnchor9 = this.d;
this.f = resolutionAnchor9.f;
ResolutionAnchor resolutionAnchor10 = this.i;
ResolutionAnchor resolutionAnchor11 = resolutionAnchor10.d;
resolutionAnchor10.f = resolutionAnchor11.f;
this.g = resolutionAnchor9.g + this.e;
resolutionAnchor10.g = resolutionAnchor11.g + resolutionAnchor10.e;
a();
this.i.a();
return;
}
if (LinearSystem.h() != null) {
LinearSystem.h().v++;
}
this.f = this.d.f;
ResolutionAnchor resolutionAnchor12 = this.i;
resolutionAnchor12.f = resolutionAnchor12.d.f;
ConstraintAnchor.Type type = this.c.c;
int i = 0;
if (type != ConstraintAnchor.Type.RIGHT && type != ConstraintAnchor.Type.BOTTOM) {
z = false;
}
if (z) {
f = this.d.g;
f2 = this.i.d.g;
} else {
f = this.i.d.g;
f2 = this.d.g;
}
float f5 = f - f2;
ConstraintAnchor.Type type2 = this.c.c;
if (type2 == ConstraintAnchor.Type.LEFT || type2 == ConstraintAnchor.Type.RIGHT) {
s = f5 - this.c.b.s();
f3 = this.c.b.V;
} else {
s = f5 - r2.b.i();
f3 = this.c.b.W;
}
int b = this.c.b();
int b2 = this.i.c.b();
if (this.c.g() == this.i.c.g()) {
f3 = 0.5f;
b2 = 0;
} else {
i = b;
}
float f6 = i;
float f7 = b2;
float f8 = (s - f6) - f7;
if (z) {
ResolutionAnchor resolutionAnchor13 = this.i;
resolutionAnchor13.g = resolutionAnchor13.d.g + f7 + (f8 * f3);
this.g = (this.d.g - f6) - (f8 * (1.0f - f3));
} else {
this.g = this.d.g + f6 + (f8 * f3);
ResolutionAnchor resolutionAnchor14 = this.i;
resolutionAnchor14.g = (resolutionAnchor14.d.g - f7) - (f8 * (1.0f - f3));
}
a();
this.i.a();
}
public float f() {
return this.g;
}
public void g() {
ConstraintAnchor g = this.c.g();
if (g == null) {
return;
}
if (g.g() == this.c) {
this.h = 4;
g.d().h = 4;
}
int b = this.c.b();
ConstraintAnchor.Type type = this.c.c;
if (type == ConstraintAnchor.Type.RIGHT || type == ConstraintAnchor.Type.BOTTOM) {
b = -b;
}
a(g.d(), b);
}
public String toString() {
if (this.b != 1) {
return "{ " + this.c + " UNRESOLVED} type: " + a(this.h);
}
if (this.f == this) {
return "[" + this.c + ", RESOLVED: " + this.g + "] type: " + a(this.h);
}
return "[" + this.c + ", RESOLVED: " + this.f + ":" + this.g + "] type: " + a(this.h);
}
public void b(ResolutionAnchor resolutionAnchor, float f) {
this.i = resolutionAnchor;
}
public void b(ResolutionAnchor resolutionAnchor, int i, ResolutionDimension resolutionDimension) {
this.i = resolutionAnchor;
this.l = resolutionDimension;
this.m = i;
}
public void a(int i, ResolutionAnchor resolutionAnchor, int i2) {
this.h = i;
this.d = resolutionAnchor;
this.e = i2;
this.d.a(this);
}
public void a(ResolutionAnchor resolutionAnchor, int i) {
this.d = resolutionAnchor;
this.e = i;
this.d.a(this);
}
public void a(ResolutionAnchor resolutionAnchor, int i, ResolutionDimension resolutionDimension) {
this.d = resolutionAnchor;
this.d.a(this);
this.j = resolutionDimension;
this.k = i;
this.j.a(this);
}
void a(LinearSystem linearSystem) {
SolverVariable e = this.c.e();
ResolutionAnchor resolutionAnchor = this.f;
if (resolutionAnchor == null) {
linearSystem.a(e, (int) (this.g + 0.5f));
} else {
linearSystem.a(e, linearSystem.a(resolutionAnchor.c), (int) (this.g + 0.5f), 6);
}
}
}