ADD week 5

This commit is contained in:
2025-03-31 16:33:42 +02:00
parent 86f265f22d
commit bf645048e6
4927 changed files with 544053 additions and 0 deletions

View File

@ -0,0 +1,482 @@
package androidx.constraintlayout.core;
import androidx.constraintlayout.core.ArrayRow;
import java.util.Arrays;
/* loaded from: classes.dex */
public class ArrayLinkedVariables implements ArrayRow.ArrayRowVariables {
private static final boolean DEBUG = false;
private static final boolean FULL_NEW_CHECK = false;
static final int NONE = -1;
private static float epsilon = 0.001f;
protected final Cache mCache;
private final ArrayRow mRow;
int currentSize = 0;
private int ROW_SIZE = 8;
private SolverVariable candidate = null;
private int[] mArrayIndices = new int[8];
private int[] mArrayNextIndices = new int[8];
private float[] mArrayValues = new float[8];
private int mHead = -1;
private int mLast = -1;
private boolean mDidFillOnce = false;
@Override // androidx.constraintlayout.core.ArrayRow.ArrayRowVariables
public int getCurrentSize() {
return this.currentSize;
}
public int getHead() {
return this.mHead;
}
ArrayLinkedVariables(ArrayRow arrayRow, Cache cache) {
this.mRow = arrayRow;
this.mCache = cache;
}
@Override // androidx.constraintlayout.core.ArrayRow.ArrayRowVariables
public final void put(SolverVariable solverVariable, float f) {
if (f == 0.0f) {
remove(solverVariable, true);
return;
}
int i = this.mHead;
if (i == -1) {
this.mHead = 0;
this.mArrayValues[0] = f;
this.mArrayIndices[0] = solverVariable.id;
this.mArrayNextIndices[this.mHead] = -1;
solverVariable.usageInRowCount++;
solverVariable.addToRow(this.mRow);
this.currentSize++;
if (this.mDidFillOnce) {
return;
}
int i2 = this.mLast + 1;
this.mLast = i2;
int[] iArr = this.mArrayIndices;
if (i2 >= iArr.length) {
this.mDidFillOnce = true;
this.mLast = iArr.length - 1;
return;
}
return;
}
int i3 = -1;
for (int i4 = 0; i != -1 && i4 < this.currentSize; i4++) {
if (this.mArrayIndices[i] == solverVariable.id) {
this.mArrayValues[i] = f;
return;
}
if (this.mArrayIndices[i] < solverVariable.id) {
i3 = i;
}
i = this.mArrayNextIndices[i];
}
int i5 = this.mLast;
int i6 = i5 + 1;
if (this.mDidFillOnce) {
int[] iArr2 = this.mArrayIndices;
if (iArr2[i5] != -1) {
i5 = iArr2.length;
}
} else {
i5 = i6;
}
int[] iArr3 = this.mArrayIndices;
if (i5 >= iArr3.length && this.currentSize < iArr3.length) {
int i7 = 0;
while (true) {
int[] iArr4 = this.mArrayIndices;
if (i7 >= iArr4.length) {
break;
}
if (iArr4[i7] == -1) {
i5 = i7;
break;
}
i7++;
}
}
int[] iArr5 = this.mArrayIndices;
if (i5 >= iArr5.length) {
i5 = iArr5.length;
int i8 = this.ROW_SIZE * 2;
this.ROW_SIZE = i8;
this.mDidFillOnce = false;
this.mLast = i5 - 1;
this.mArrayValues = Arrays.copyOf(this.mArrayValues, i8);
this.mArrayIndices = Arrays.copyOf(this.mArrayIndices, this.ROW_SIZE);
this.mArrayNextIndices = Arrays.copyOf(this.mArrayNextIndices, this.ROW_SIZE);
}
this.mArrayIndices[i5] = solverVariable.id;
this.mArrayValues[i5] = f;
if (i3 != -1) {
int[] iArr6 = this.mArrayNextIndices;
iArr6[i5] = iArr6[i3];
iArr6[i3] = i5;
} else {
this.mArrayNextIndices[i5] = this.mHead;
this.mHead = i5;
}
solverVariable.usageInRowCount++;
solverVariable.addToRow(this.mRow);
int i9 = this.currentSize + 1;
this.currentSize = i9;
if (!this.mDidFillOnce) {
this.mLast++;
}
int[] iArr7 = this.mArrayIndices;
if (i9 >= iArr7.length) {
this.mDidFillOnce = true;
}
if (this.mLast >= iArr7.length) {
this.mDidFillOnce = true;
this.mLast = iArr7.length - 1;
}
}
@Override // androidx.constraintlayout.core.ArrayRow.ArrayRowVariables
public void add(SolverVariable solverVariable, float f, boolean z) {
float f2 = epsilon;
if (f <= (-f2) || f >= f2) {
int i = this.mHead;
if (i == -1) {
this.mHead = 0;
this.mArrayValues[0] = f;
this.mArrayIndices[0] = solverVariable.id;
this.mArrayNextIndices[this.mHead] = -1;
solverVariable.usageInRowCount++;
solverVariable.addToRow(this.mRow);
this.currentSize++;
if (this.mDidFillOnce) {
return;
}
int i2 = this.mLast + 1;
this.mLast = i2;
int[] iArr = this.mArrayIndices;
if (i2 >= iArr.length) {
this.mDidFillOnce = true;
this.mLast = iArr.length - 1;
return;
}
return;
}
int i3 = -1;
for (int i4 = 0; i != -1 && i4 < this.currentSize; i4++) {
if (this.mArrayIndices[i] == solverVariable.id) {
float[] fArr = this.mArrayValues;
float f3 = fArr[i] + f;
float f4 = epsilon;
if (f3 > (-f4) && f3 < f4) {
f3 = 0.0f;
}
fArr[i] = f3;
if (f3 == 0.0f) {
if (i == this.mHead) {
this.mHead = this.mArrayNextIndices[i];
} else {
int[] iArr2 = this.mArrayNextIndices;
iArr2[i3] = iArr2[i];
}
if (z) {
solverVariable.removeFromRow(this.mRow);
}
if (this.mDidFillOnce) {
this.mLast = i;
}
solverVariable.usageInRowCount--;
this.currentSize--;
return;
}
return;
}
if (this.mArrayIndices[i] < solverVariable.id) {
i3 = i;
}
i = this.mArrayNextIndices[i];
}
int i5 = this.mLast;
int i6 = i5 + 1;
if (this.mDidFillOnce) {
int[] iArr3 = this.mArrayIndices;
if (iArr3[i5] != -1) {
i5 = iArr3.length;
}
} else {
i5 = i6;
}
int[] iArr4 = this.mArrayIndices;
if (i5 >= iArr4.length && this.currentSize < iArr4.length) {
int i7 = 0;
while (true) {
int[] iArr5 = this.mArrayIndices;
if (i7 >= iArr5.length) {
break;
}
if (iArr5[i7] == -1) {
i5 = i7;
break;
}
i7++;
}
}
int[] iArr6 = this.mArrayIndices;
if (i5 >= iArr6.length) {
i5 = iArr6.length;
int i8 = this.ROW_SIZE * 2;
this.ROW_SIZE = i8;
this.mDidFillOnce = false;
this.mLast = i5 - 1;
this.mArrayValues = Arrays.copyOf(this.mArrayValues, i8);
this.mArrayIndices = Arrays.copyOf(this.mArrayIndices, this.ROW_SIZE);
this.mArrayNextIndices = Arrays.copyOf(this.mArrayNextIndices, this.ROW_SIZE);
}
this.mArrayIndices[i5] = solverVariable.id;
this.mArrayValues[i5] = f;
if (i3 != -1) {
int[] iArr7 = this.mArrayNextIndices;
iArr7[i5] = iArr7[i3];
iArr7[i3] = i5;
} else {
this.mArrayNextIndices[i5] = this.mHead;
this.mHead = i5;
}
solverVariable.usageInRowCount++;
solverVariable.addToRow(this.mRow);
this.currentSize++;
if (!this.mDidFillOnce) {
this.mLast++;
}
int i9 = this.mLast;
int[] iArr8 = this.mArrayIndices;
if (i9 >= iArr8.length) {
this.mDidFillOnce = true;
this.mLast = iArr8.length - 1;
}
}
}
@Override // androidx.constraintlayout.core.ArrayRow.ArrayRowVariables
public float use(ArrayRow arrayRow, boolean z) {
float f = get(arrayRow.variable);
remove(arrayRow.variable, z);
ArrayRow.ArrayRowVariables arrayRowVariables = arrayRow.variables;
int currentSize = arrayRowVariables.getCurrentSize();
for (int i = 0; i < currentSize; i++) {
SolverVariable variable = arrayRowVariables.getVariable(i);
add(variable, arrayRowVariables.get(variable) * f, z);
}
return f;
}
@Override // androidx.constraintlayout.core.ArrayRow.ArrayRowVariables
public final float remove(SolverVariable solverVariable, boolean z) {
if (this.candidate == solverVariable) {
this.candidate = null;
}
int i = this.mHead;
if (i == -1) {
return 0.0f;
}
int i2 = 0;
int i3 = -1;
while (i != -1 && i2 < this.currentSize) {
if (this.mArrayIndices[i] == solverVariable.id) {
if (i == this.mHead) {
this.mHead = this.mArrayNextIndices[i];
} else {
int[] iArr = this.mArrayNextIndices;
iArr[i3] = iArr[i];
}
if (z) {
solverVariable.removeFromRow(this.mRow);
}
solverVariable.usageInRowCount--;
this.currentSize--;
this.mArrayIndices[i] = -1;
if (this.mDidFillOnce) {
this.mLast = i;
}
return this.mArrayValues[i];
}
i2++;
i3 = i;
i = this.mArrayNextIndices[i];
}
return 0.0f;
}
@Override // androidx.constraintlayout.core.ArrayRow.ArrayRowVariables
public final void clear() {
int i = this.mHead;
for (int i2 = 0; i != -1 && i2 < this.currentSize; i2++) {
SolverVariable solverVariable = this.mCache.mIndexedVariables[this.mArrayIndices[i]];
if (solverVariable != null) {
solverVariable.removeFromRow(this.mRow);
}
i = this.mArrayNextIndices[i];
}
this.mHead = -1;
this.mLast = -1;
this.mDidFillOnce = false;
this.currentSize = 0;
}
@Override // androidx.constraintlayout.core.ArrayRow.ArrayRowVariables
public boolean contains(SolverVariable solverVariable) {
int i = this.mHead;
if (i == -1) {
return false;
}
for (int i2 = 0; i != -1 && i2 < this.currentSize; i2++) {
if (this.mArrayIndices[i] == solverVariable.id) {
return true;
}
i = this.mArrayNextIndices[i];
}
return false;
}
@Override // androidx.constraintlayout.core.ArrayRow.ArrayRowVariables
public int indexOf(SolverVariable solverVariable) {
int i = this.mHead;
if (i == -1) {
return -1;
}
for (int i2 = 0; i != -1 && i2 < this.currentSize; i2++) {
if (this.mArrayIndices[i] == solverVariable.id) {
return i;
}
i = this.mArrayNextIndices[i];
}
return -1;
}
boolean hasAtLeastOnePositiveVariable() {
int i = this.mHead;
for (int i2 = 0; i != -1 && i2 < this.currentSize; i2++) {
if (this.mArrayValues[i] > 0.0f) {
return true;
}
i = this.mArrayNextIndices[i];
}
return false;
}
@Override // androidx.constraintlayout.core.ArrayRow.ArrayRowVariables
public void invert() {
int i = this.mHead;
for (int i2 = 0; i != -1 && i2 < this.currentSize; i2++) {
float[] fArr = this.mArrayValues;
fArr[i] = fArr[i] * (-1.0f);
i = this.mArrayNextIndices[i];
}
}
@Override // androidx.constraintlayout.core.ArrayRow.ArrayRowVariables
public void divideByAmount(float f) {
int i = this.mHead;
for (int i2 = 0; i != -1 && i2 < this.currentSize; i2++) {
float[] fArr = this.mArrayValues;
fArr[i] = fArr[i] / f;
i = this.mArrayNextIndices[i];
}
}
public final int getId(int i) {
return this.mArrayIndices[i];
}
public final float getValue(int i) {
return this.mArrayValues[i];
}
public final int getNextIndice(int i) {
return this.mArrayNextIndices[i];
}
SolverVariable getPivotCandidate() {
SolverVariable solverVariable = this.candidate;
if (solverVariable != null) {
return solverVariable;
}
int i = this.mHead;
SolverVariable solverVariable2 = null;
for (int i2 = 0; i != -1 && i2 < this.currentSize; i2++) {
if (this.mArrayValues[i] < 0.0f) {
SolverVariable solverVariable3 = this.mCache.mIndexedVariables[this.mArrayIndices[i]];
if (solverVariable2 == null || solverVariable2.strength < solverVariable3.strength) {
solverVariable2 = solverVariable3;
}
}
i = this.mArrayNextIndices[i];
}
return solverVariable2;
}
@Override // androidx.constraintlayout.core.ArrayRow.ArrayRowVariables
public SolverVariable getVariable(int i) {
int i2 = this.mHead;
for (int i3 = 0; i2 != -1 && i3 < this.currentSize; i3++) {
if (i3 == i) {
return this.mCache.mIndexedVariables[this.mArrayIndices[i2]];
}
i2 = this.mArrayNextIndices[i2];
}
return null;
}
@Override // androidx.constraintlayout.core.ArrayRow.ArrayRowVariables
public float getVariableValue(int i) {
int i2 = this.mHead;
for (int i3 = 0; i2 != -1 && i3 < this.currentSize; i3++) {
if (i3 == i) {
return this.mArrayValues[i2];
}
i2 = this.mArrayNextIndices[i2];
}
return 0.0f;
}
@Override // androidx.constraintlayout.core.ArrayRow.ArrayRowVariables
public final float get(SolverVariable solverVariable) {
int i = this.mHead;
for (int i2 = 0; i != -1 && i2 < this.currentSize; i2++) {
if (this.mArrayIndices[i] == solverVariable.id) {
return this.mArrayValues[i];
}
i = this.mArrayNextIndices[i];
}
return 0.0f;
}
@Override // androidx.constraintlayout.core.ArrayRow.ArrayRowVariables
public int sizeInBytes() {
return (this.mArrayIndices.length * 12) + 36;
}
@Override // androidx.constraintlayout.core.ArrayRow.ArrayRowVariables
public void display() {
int i = this.currentSize;
System.out.print("{ ");
for (int i2 = 0; i2 < i; i2++) {
SolverVariable variable = getVariable(i2);
if (variable != null) {
System.out.print(variable + " = " + getVariableValue(i2) + " ");
}
}
System.out.println(" }");
}
public String toString() {
int i = this.mHead;
String str = "";
for (int i2 = 0; i != -1 && i2 < this.currentSize; i2++) {
str = ((str + " -> ") + this.mArrayValues[i] + " : ") + this.mCache.mIndexedVariables[this.mArrayIndices[i]];
i = this.mArrayNextIndices[i];
}
return str;
}
}

View File

@ -0,0 +1,652 @@
package androidx.constraintlayout.core;
import androidx.constraintlayout.core.LinearSystem;
import androidx.constraintlayout.core.SolverVariable;
import java.util.ArrayList;
/* loaded from: classes.dex */
public class ArrayRow implements LinearSystem.Row {
private static final boolean DEBUG = false;
private static final boolean FULL_NEW_CHECK = false;
public ArrayRowVariables variables;
SolverVariable variable = null;
float constantValue = 0.0f;
boolean used = false;
ArrayList<SolverVariable> variablesToUpdate = new ArrayList<>();
boolean isSimpleDefinition = false;
public interface ArrayRowVariables {
void add(SolverVariable solverVariable, float f, boolean z);
void clear();
boolean contains(SolverVariable solverVariable);
void display();
void divideByAmount(float f);
float get(SolverVariable solverVariable);
int getCurrentSize();
SolverVariable getVariable(int i);
float getVariableValue(int i);
int indexOf(SolverVariable solverVariable);
void invert();
void put(SolverVariable solverVariable, float f);
float remove(SolverVariable solverVariable, boolean z);
int sizeInBytes();
float use(ArrayRow arrayRow, boolean z);
}
@Override // androidx.constraintlayout.core.LinearSystem.Row
public SolverVariable getKey() {
return this.variable;
}
public ArrayRow() {
}
public ArrayRow(Cache cache) {
this.variables = new ArrayLinkedVariables(this, cache);
}
boolean hasKeyVariable() {
SolverVariable solverVariable = this.variable;
return solverVariable != null && (solverVariable.mType == SolverVariable.Type.UNRESTRICTED || this.constantValue >= 0.0f);
}
public String toString() {
return toReadableString();
}
/* JADX WARN: Removed duplicated region for block: B:21:0x00ae */
/* JADX WARN: Removed duplicated region for block: B:25:0x00be */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
java.lang.String toReadableString() {
/*
r10 = this;
androidx.constraintlayout.core.SolverVariable r0 = r10.variable
if (r0 != 0) goto L7
java.lang.String r0 = "0"
goto L17
L7:
java.lang.StringBuilder r0 = new java.lang.StringBuilder
java.lang.String r1 = ""
r0.<init>(r1)
androidx.constraintlayout.core.SolverVariable r1 = r10.variable
r0.append(r1)
java.lang.String r0 = r0.toString()
L17:
java.lang.StringBuilder r1 = new java.lang.StringBuilder
r1.<init>()
r1.append(r0)
java.lang.String r0 = " = "
r1.append(r0)
java.lang.String r0 = r1.toString()
float r1 = r10.constantValue
r2 = 0
r3 = 1
r4 = 0
int r1 = (r1 > r4 ? 1 : (r1 == r4 ? 0 : -1))
if (r1 == 0) goto L44
java.lang.StringBuilder r1 = new java.lang.StringBuilder
r1.<init>()
r1.append(r0)
float r0 = r10.constantValue
r1.append(r0)
java.lang.String r0 = r1.toString()
r1 = 1
goto L45
L44:
r1 = 0
L45:
androidx.constraintlayout.core.ArrayRow$ArrayRowVariables r5 = r10.variables
int r5 = r5.getCurrentSize()
L4b:
if (r2 >= r5) goto Lda
androidx.constraintlayout.core.ArrayRow$ArrayRowVariables r6 = r10.variables
androidx.constraintlayout.core.SolverVariable r6 = r6.getVariable(r2)
if (r6 != 0) goto L57
goto Ld6
L57:
androidx.constraintlayout.core.ArrayRow$ArrayRowVariables r7 = r10.variables
float r7 = r7.getVariableValue(r2)
int r8 = (r7 > r4 ? 1 : (r7 == r4 ? 0 : -1))
if (r8 != 0) goto L63
goto Ld6
L63:
java.lang.String r6 = r6.toString()
r9 = -1082130432(0xffffffffbf800000, float:-1.0)
if (r1 != 0) goto L81
int r1 = (r7 > r4 ? 1 : (r7 == r4 ? 0 : -1))
if (r1 >= 0) goto La8
java.lang.StringBuilder r1 = new java.lang.StringBuilder
r1.<init>()
r1.append(r0)
java.lang.String r0 = "- "
r1.append(r0)
java.lang.String r0 = r1.toString()
goto La6
L81:
if (r8 <= 0) goto L95
java.lang.StringBuilder r1 = new java.lang.StringBuilder
r1.<init>()
r1.append(r0)
java.lang.String r0 = " + "
r1.append(r0)
java.lang.String r0 = r1.toString()
goto La8
L95:
java.lang.StringBuilder r1 = new java.lang.StringBuilder
r1.<init>()
r1.append(r0)
java.lang.String r0 = " - "
r1.append(r0)
java.lang.String r0 = r1.toString()
La6:
float r7 = r7 * r9
La8:
r1 = 1065353216(0x3f800000, float:1.0)
int r1 = (r7 > r1 ? 1 : (r7 == r1 ? 0 : -1))
if (r1 != 0) goto Lbe
java.lang.StringBuilder r1 = new java.lang.StringBuilder
r1.<init>()
r1.append(r0)
r1.append(r6)
java.lang.String r0 = r1.toString()
goto Ld5
Lbe:
java.lang.StringBuilder r1 = new java.lang.StringBuilder
r1.<init>()
r1.append(r0)
r1.append(r7)
java.lang.String r0 = " "
r1.append(r0)
r1.append(r6)
java.lang.String r0 = r1.toString()
Ld5:
r1 = 1
Ld6:
int r2 = r2 + 1
goto L4b
Lda:
if (r1 != 0) goto Led
java.lang.StringBuilder r1 = new java.lang.StringBuilder
r1.<init>()
r1.append(r0)
java.lang.String r0 = "0.0"
r1.append(r0)
java.lang.String r0 = r1.toString()
Led:
return r0
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.constraintlayout.core.ArrayRow.toReadableString():java.lang.String");
}
public void reset() {
this.variable = null;
this.variables.clear();
this.constantValue = 0.0f;
this.isSimpleDefinition = false;
}
boolean hasVariable(SolverVariable solverVariable) {
return this.variables.contains(solverVariable);
}
ArrayRow createRowDefinition(SolverVariable solverVariable, int i) {
this.variable = solverVariable;
float f = i;
solverVariable.computedValue = f;
this.constantValue = f;
this.isSimpleDefinition = true;
return this;
}
public ArrayRow createRowEquals(SolverVariable solverVariable, int i) {
if (i < 0) {
this.constantValue = i * (-1);
this.variables.put(solverVariable, 1.0f);
} else {
this.constantValue = i;
this.variables.put(solverVariable, -1.0f);
}
return this;
}
public ArrayRow createRowEquals(SolverVariable solverVariable, SolverVariable solverVariable2, int i) {
boolean z;
if (i != 0) {
if (i < 0) {
i *= -1;
z = true;
} else {
z = false;
}
this.constantValue = i;
if (z) {
this.variables.put(solverVariable, 1.0f);
this.variables.put(solverVariable2, -1.0f);
return this;
}
}
this.variables.put(solverVariable, -1.0f);
this.variables.put(solverVariable2, 1.0f);
return this;
}
ArrayRow addSingleError(SolverVariable solverVariable, int i) {
this.variables.put(solverVariable, i);
return this;
}
public ArrayRow createRowGreaterThan(SolverVariable solverVariable, SolverVariable solverVariable2, SolverVariable solverVariable3, int i) {
boolean z;
if (i != 0) {
if (i < 0) {
i *= -1;
z = true;
} else {
z = false;
}
this.constantValue = i;
if (z) {
this.variables.put(solverVariable, 1.0f);
this.variables.put(solverVariable2, -1.0f);
this.variables.put(solverVariable3, -1.0f);
return this;
}
}
this.variables.put(solverVariable, -1.0f);
this.variables.put(solverVariable2, 1.0f);
this.variables.put(solverVariable3, 1.0f);
return this;
}
public ArrayRow createRowGreaterThan(SolverVariable solverVariable, int i, SolverVariable solverVariable2) {
this.constantValue = i;
this.variables.put(solverVariable, -1.0f);
return this;
}
public ArrayRow createRowLowerThan(SolverVariable solverVariable, SolverVariable solverVariable2, SolverVariable solverVariable3, int i) {
boolean z;
if (i != 0) {
if (i < 0) {
i *= -1;
z = true;
} else {
z = false;
}
this.constantValue = i;
if (z) {
this.variables.put(solverVariable, 1.0f);
this.variables.put(solverVariable2, -1.0f);
this.variables.put(solverVariable3, 1.0f);
return this;
}
}
this.variables.put(solverVariable, -1.0f);
this.variables.put(solverVariable2, 1.0f);
this.variables.put(solverVariable3, -1.0f);
return this;
}
public ArrayRow createRowEqualMatchDimensions(float f, float f2, float f3, SolverVariable solverVariable, SolverVariable solverVariable2, SolverVariable solverVariable3, SolverVariable solverVariable4) {
this.constantValue = 0.0f;
if (f2 == 0.0f || f == f3) {
this.variables.put(solverVariable, 1.0f);
this.variables.put(solverVariable2, -1.0f);
this.variables.put(solverVariable4, 1.0f);
this.variables.put(solverVariable3, -1.0f);
} else if (f == 0.0f) {
this.variables.put(solverVariable, 1.0f);
this.variables.put(solverVariable2, -1.0f);
} else if (f3 == 0.0f) {
this.variables.put(solverVariable3, 1.0f);
this.variables.put(solverVariable4, -1.0f);
} else {
float f4 = (f / f2) / (f3 / f2);
this.variables.put(solverVariable, 1.0f);
this.variables.put(solverVariable2, -1.0f);
this.variables.put(solverVariable4, f4);
this.variables.put(solverVariable3, -f4);
}
return this;
}
public ArrayRow createRowEqualDimension(float f, float f2, float f3, SolverVariable solverVariable, int i, SolverVariable solverVariable2, int i2, SolverVariable solverVariable3, int i3, SolverVariable solverVariable4, int i4) {
if (f2 == 0.0f || f == f3) {
this.constantValue = ((-i) - i2) + i3 + i4;
this.variables.put(solverVariable, 1.0f);
this.variables.put(solverVariable2, -1.0f);
this.variables.put(solverVariable4, 1.0f);
this.variables.put(solverVariable3, -1.0f);
} else {
float f4 = (f / f2) / (f3 / f2);
this.constantValue = ((-i) - i2) + (i3 * f4) + (i4 * f4);
this.variables.put(solverVariable, 1.0f);
this.variables.put(solverVariable2, -1.0f);
this.variables.put(solverVariable4, f4);
this.variables.put(solverVariable3, -f4);
}
return this;
}
ArrayRow createRowCentering(SolverVariable solverVariable, SolverVariable solverVariable2, int i, float f, SolverVariable solverVariable3, SolverVariable solverVariable4, int i2) {
if (solverVariable2 == solverVariable3) {
this.variables.put(solverVariable, 1.0f);
this.variables.put(solverVariable4, 1.0f);
this.variables.put(solverVariable2, -2.0f);
return this;
}
if (f == 0.5f) {
this.variables.put(solverVariable, 1.0f);
this.variables.put(solverVariable2, -1.0f);
this.variables.put(solverVariable3, -1.0f);
this.variables.put(solverVariable4, 1.0f);
if (i > 0 || i2 > 0) {
this.constantValue = (-i) + i2;
}
} else if (f <= 0.0f) {
this.variables.put(solverVariable, -1.0f);
this.variables.put(solverVariable2, 1.0f);
this.constantValue = i;
} else if (f >= 1.0f) {
this.variables.put(solverVariable4, -1.0f);
this.variables.put(solverVariable3, 1.0f);
this.constantValue = -i2;
} else {
float f2 = 1.0f - f;
this.variables.put(solverVariable, f2 * 1.0f);
this.variables.put(solverVariable2, f2 * (-1.0f));
this.variables.put(solverVariable3, (-1.0f) * f);
this.variables.put(solverVariable4, 1.0f * f);
if (i > 0 || i2 > 0) {
this.constantValue = ((-i) * f2) + (i2 * f);
}
}
return this;
}
public ArrayRow addError(LinearSystem linearSystem, int i) {
this.variables.put(linearSystem.createErrorVariable(i, "ep"), 1.0f);
this.variables.put(linearSystem.createErrorVariable(i, "em"), -1.0f);
return this;
}
ArrayRow createRowDimensionPercent(SolverVariable solverVariable, SolverVariable solverVariable2, float f) {
this.variables.put(solverVariable, -1.0f);
this.variables.put(solverVariable2, f);
return this;
}
public ArrayRow createRowDimensionRatio(SolverVariable solverVariable, SolverVariable solverVariable2, SolverVariable solverVariable3, SolverVariable solverVariable4, float f) {
this.variables.put(solverVariable, -1.0f);
this.variables.put(solverVariable2, 1.0f);
this.variables.put(solverVariable3, f);
this.variables.put(solverVariable4, -f);
return this;
}
public ArrayRow createRowWithAngle(SolverVariable solverVariable, SolverVariable solverVariable2, SolverVariable solverVariable3, SolverVariable solverVariable4, float f) {
this.variables.put(solverVariable3, 0.5f);
this.variables.put(solverVariable4, 0.5f);
this.variables.put(solverVariable, -0.5f);
this.variables.put(solverVariable2, -0.5f);
this.constantValue = -f;
return this;
}
int sizeInBytes() {
return (this.variable != null ? 4 : 0) + 8 + this.variables.sizeInBytes();
}
void ensurePositiveConstant() {
float f = this.constantValue;
if (f < 0.0f) {
this.constantValue = f * (-1.0f);
this.variables.invert();
}
}
boolean chooseSubject(LinearSystem linearSystem) {
boolean z;
SolverVariable chooseSubjectInVariables = chooseSubjectInVariables(linearSystem);
if (chooseSubjectInVariables == null) {
z = true;
} else {
pivot(chooseSubjectInVariables);
z = false;
}
if (this.variables.getCurrentSize() == 0) {
this.isSimpleDefinition = true;
}
return z;
}
SolverVariable chooseSubjectInVariables(LinearSystem linearSystem) {
boolean isNew;
boolean isNew2;
int currentSize = this.variables.getCurrentSize();
SolverVariable solverVariable = null;
SolverVariable solverVariable2 = null;
boolean z = false;
boolean z2 = false;
float f = 0.0f;
float f2 = 0.0f;
for (int i = 0; i < currentSize; i++) {
float variableValue = this.variables.getVariableValue(i);
SolverVariable variable = this.variables.getVariable(i);
if (variable.mType == SolverVariable.Type.UNRESTRICTED) {
if (solverVariable == null) {
isNew2 = isNew(variable, linearSystem);
} else if (f > variableValue) {
isNew2 = isNew(variable, linearSystem);
} else if (!z && isNew(variable, linearSystem)) {
f = variableValue;
solverVariable = variable;
z = true;
}
z = isNew2;
f = variableValue;
solverVariable = variable;
} else if (solverVariable == null && variableValue < 0.0f) {
if (solverVariable2 == null) {
isNew = isNew(variable, linearSystem);
} else if (f2 > variableValue) {
isNew = isNew(variable, linearSystem);
} else if (!z2 && isNew(variable, linearSystem)) {
f2 = variableValue;
solverVariable2 = variable;
z2 = true;
}
z2 = isNew;
f2 = variableValue;
solverVariable2 = variable;
}
}
return solverVariable != null ? solverVariable : solverVariable2;
}
private boolean isNew(SolverVariable solverVariable, LinearSystem linearSystem) {
return solverVariable.usageInRowCount <= 1;
}
void pivot(SolverVariable solverVariable) {
SolverVariable solverVariable2 = this.variable;
if (solverVariable2 != null) {
this.variables.put(solverVariable2, -1.0f);
this.variable.definitionId = -1;
this.variable = null;
}
float remove = this.variables.remove(solverVariable, true) * (-1.0f);
this.variable = solverVariable;
if (remove == 1.0f) {
return;
}
this.constantValue /= remove;
this.variables.divideByAmount(remove);
}
@Override // androidx.constraintlayout.core.LinearSystem.Row
public boolean isEmpty() {
return this.variable == null && this.constantValue == 0.0f && this.variables.getCurrentSize() == 0;
}
@Override // androidx.constraintlayout.core.LinearSystem.Row
public void updateFromRow(LinearSystem linearSystem, ArrayRow arrayRow, boolean z) {
this.constantValue += arrayRow.constantValue * this.variables.use(arrayRow, z);
if (z) {
arrayRow.variable.removeFromRow(this);
}
if (LinearSystem.SIMPLIFY_SYNONYMS && this.variable != null && this.variables.getCurrentSize() == 0) {
this.isSimpleDefinition = true;
linearSystem.hasSimpleDefinition = true;
}
}
@Override // androidx.constraintlayout.core.LinearSystem.Row
public void updateFromFinalVariable(LinearSystem linearSystem, SolverVariable solverVariable, boolean z) {
if (solverVariable == null || !solverVariable.isFinalValue) {
return;
}
this.constantValue += solverVariable.computedValue * this.variables.get(solverVariable);
this.variables.remove(solverVariable, z);
if (z) {
solverVariable.removeFromRow(this);
}
if (LinearSystem.SIMPLIFY_SYNONYMS && this.variables.getCurrentSize() == 0) {
this.isSimpleDefinition = true;
linearSystem.hasSimpleDefinition = true;
}
}
public void updateFromSynonymVariable(LinearSystem linearSystem, SolverVariable solverVariable, boolean z) {
if (solverVariable == null || !solverVariable.isSynonym) {
return;
}
float f = this.variables.get(solverVariable);
this.constantValue += solverVariable.synonymDelta * f;
this.variables.remove(solverVariable, z);
if (z) {
solverVariable.removeFromRow(this);
}
this.variables.add(linearSystem.mCache.mIndexedVariables[solverVariable.synonym], f, z);
if (LinearSystem.SIMPLIFY_SYNONYMS && this.variables.getCurrentSize() == 0) {
this.isSimpleDefinition = true;
linearSystem.hasSimpleDefinition = true;
}
}
private SolverVariable pickPivotInVariables(boolean[] zArr, SolverVariable solverVariable) {
int currentSize = this.variables.getCurrentSize();
SolverVariable solverVariable2 = null;
float f = 0.0f;
for (int i = 0; i < currentSize; i++) {
float variableValue = this.variables.getVariableValue(i);
if (variableValue < 0.0f) {
SolverVariable variable = this.variables.getVariable(i);
if ((zArr == null || !zArr[variable.id]) && variable != solverVariable && ((variable.mType == SolverVariable.Type.SLACK || variable.mType == SolverVariable.Type.ERROR) && variableValue < f)) {
f = variableValue;
solverVariable2 = variable;
}
}
}
return solverVariable2;
}
public SolverVariable pickPivot(SolverVariable solverVariable) {
return pickPivotInVariables(null, solverVariable);
}
@Override // androidx.constraintlayout.core.LinearSystem.Row
public SolverVariable getPivotCandidate(LinearSystem linearSystem, boolean[] zArr) {
return pickPivotInVariables(zArr, null);
}
@Override // androidx.constraintlayout.core.LinearSystem.Row
public void clear() {
this.variables.clear();
this.variable = null;
this.constantValue = 0.0f;
}
@Override // androidx.constraintlayout.core.LinearSystem.Row
public void initFromRow(LinearSystem.Row row) {
if (row instanceof ArrayRow) {
ArrayRow arrayRow = (ArrayRow) row;
this.variable = null;
this.variables.clear();
for (int i = 0; i < arrayRow.variables.getCurrentSize(); i++) {
this.variables.add(arrayRow.variables.getVariable(i), arrayRow.variables.getVariableValue(i), true);
}
}
}
@Override // androidx.constraintlayout.core.LinearSystem.Row
public void addError(SolverVariable solverVariable) {
float f = 1.0f;
if (solverVariable.strength != 1) {
if (solverVariable.strength == 2) {
f = 1000.0f;
} else if (solverVariable.strength == 3) {
f = 1000000.0f;
} else if (solverVariable.strength == 4) {
f = 1.0E9f;
} else if (solverVariable.strength == 5) {
f = 1.0E12f;
}
}
this.variables.put(solverVariable, f);
}
@Override // androidx.constraintlayout.core.LinearSystem.Row
public void updateFromSystem(LinearSystem linearSystem) {
if (linearSystem.mRows.length == 0) {
return;
}
boolean z = false;
while (!z) {
int currentSize = this.variables.getCurrentSize();
for (int i = 0; i < currentSize; i++) {
SolverVariable variable = this.variables.getVariable(i);
if (variable.definitionId != -1 || variable.isFinalValue || variable.isSynonym) {
this.variablesToUpdate.add(variable);
}
}
int size = this.variablesToUpdate.size();
if (size > 0) {
for (int i2 = 0; i2 < size; i2++) {
SolverVariable solverVariable = this.variablesToUpdate.get(i2);
if (solverVariable.isFinalValue) {
updateFromFinalVariable(linearSystem, solverVariable, true);
} else if (solverVariable.isSynonym) {
updateFromSynonymVariable(linearSystem, solverVariable, true);
} else {
updateFromRow(linearSystem, linearSystem.mRows[solverVariable.definitionId], true);
}
}
this.variablesToUpdate.clear();
} else {
z = true;
}
}
if (LinearSystem.SIMPLIFY_SYNONYMS && this.variable != null && this.variables.getCurrentSize() == 0) {
this.isSimpleDefinition = true;
linearSystem.hasSimpleDefinition = true;
}
}
}

View File

@ -0,0 +1,11 @@
package androidx.constraintlayout.core;
import androidx.constraintlayout.core.Pools;
/* loaded from: classes.dex */
public class Cache {
Pools.Pool<ArrayRow> optimizedArrayRowPool = new Pools.SimplePool(256);
Pools.Pool<ArrayRow> arrayRowPool = new Pools.SimplePool(256);
Pools.Pool<SolverVariable> solverVariablePool = new Pools.SimplePool(256);
SolverVariable[] mIndexedVariables = new SolverVariable[32];
}

View File

@ -0,0 +1,14 @@
package androidx.constraintlayout.core;
/* loaded from: classes.dex */
public class GoalRow extends ArrayRow {
public GoalRow(Cache cache) {
super(cache);
}
@Override // androidx.constraintlayout.core.ArrayRow, androidx.constraintlayout.core.LinearSystem.Row
public void addError(SolverVariable solverVariable) {
super.addError(solverVariable);
solverVariable.usageInRowCount--;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,89 @@
package androidx.constraintlayout.core;
import java.util.ArrayList;
/* loaded from: classes.dex */
public class Metrics {
public long additionalMeasures;
public long barrierConnectionResolved;
public long bfs;
public long centerConnectionResolved;
public long chainConnectionResolved;
public long constraints;
public long determineGroups;
public long errors;
public long extravariables;
public long fullySolved;
public long graphOptimizer;
public long graphSolved;
public long grouping;
public long infeasibleDetermineGroups;
public long iterations;
public long lastTableSize;
public long layouts;
public long linearSolved;
public long matchConnectionResolved;
public long maxRows;
public long maxTableSize;
public long maxVariables;
public long measuredMatchWidgets;
public long measuredWidgets;
public long measures;
public long measuresLayoutDuration;
public long measuresWidgetsDuration;
public long measuresWrap;
public long measuresWrapInfeasible;
public long minimize;
public long minimizeGoal;
public long nonresolvedWidgets;
public long oldresolvedWidgets;
public long optimize;
public long pivots;
public ArrayList<String> problematicLayouts = new ArrayList<>();
public long resolutions;
public long resolvedWidgets;
public long simpleconstraints;
public long slackvariables;
public long tableSizeIncrease;
public long variables;
public long widgets;
public String toString() {
return "\n*** Metrics ***\nmeasures: " + this.measures + "\nmeasuresWrap: " + this.measuresWrap + "\nmeasuresWrapInfeasible: " + this.measuresWrapInfeasible + "\ndetermineGroups: " + this.determineGroups + "\ninfeasibleDetermineGroups: " + this.infeasibleDetermineGroups + "\ngraphOptimizer: " + this.graphOptimizer + "\nwidgets: " + this.widgets + "\ngraphSolved: " + this.graphSolved + "\nlinearSolved: " + this.linearSolved + "\n";
}
public void reset() {
this.measures = 0L;
this.widgets = 0L;
this.additionalMeasures = 0L;
this.resolutions = 0L;
this.tableSizeIncrease = 0L;
this.maxTableSize = 0L;
this.lastTableSize = 0L;
this.maxVariables = 0L;
this.maxRows = 0L;
this.minimize = 0L;
this.minimizeGoal = 0L;
this.constraints = 0L;
this.simpleconstraints = 0L;
this.optimize = 0L;
this.iterations = 0L;
this.pivots = 0L;
this.bfs = 0L;
this.variables = 0L;
this.errors = 0L;
this.slackvariables = 0L;
this.extravariables = 0L;
this.fullySolved = 0L;
this.graphOptimizer = 0L;
this.graphSolved = 0L;
this.resolvedWidgets = 0L;
this.oldresolvedWidgets = 0L;
this.nonresolvedWidgets = 0L;
this.centerConnectionResolved = 0L;
this.matchConnectionResolved = 0L;
this.chainConnectionResolved = 0L;
this.barrierConnectionResolved = 0L;
this.problematicLayouts.clear();
}
}

View File

@ -0,0 +1,80 @@
package androidx.constraintlayout.core;
/* loaded from: classes.dex */
final class Pools {
private static final boolean DEBUG = false;
interface Pool<T> {
T acquire();
boolean release(T t);
void releaseAll(T[] tArr, int i);
}
private Pools() {
}
static class SimplePool<T> implements Pool<T> {
private final Object[] mPool;
private int mPoolSize;
SimplePool(int i) {
if (i <= 0) {
throw new IllegalArgumentException("The max pool size must be > 0");
}
this.mPool = new Object[i];
}
@Override // androidx.constraintlayout.core.Pools.Pool
public T acquire() {
int i = this.mPoolSize;
if (i <= 0) {
return null;
}
int i2 = i - 1;
Object[] objArr = this.mPool;
T t = (T) objArr[i2];
objArr[i2] = null;
this.mPoolSize = i - 1;
return t;
}
@Override // androidx.constraintlayout.core.Pools.Pool
public boolean release(T t) {
int i = this.mPoolSize;
Object[] objArr = this.mPool;
if (i >= objArr.length) {
return false;
}
objArr[i] = t;
this.mPoolSize = i + 1;
return true;
}
@Override // androidx.constraintlayout.core.Pools.Pool
public void releaseAll(T[] tArr, int i) {
if (i > tArr.length) {
i = tArr.length;
}
for (int i2 = 0; i2 < i; i2++) {
T t = tArr[i2];
int i3 = this.mPoolSize;
Object[] objArr = this.mPool;
if (i3 < objArr.length) {
objArr[i3] = t;
this.mPoolSize = i3 + 1;
}
}
}
private boolean isInPool(T t) {
for (int i = 0; i < this.mPoolSize; i++) {
if (this.mPool[i] == t) {
return true;
}
}
return false;
}
}
}

View File

@ -0,0 +1,271 @@
package androidx.constraintlayout.core;
import androidx.constraintlayout.core.ArrayRow;
import java.util.Arrays;
import java.util.Comparator;
/* loaded from: classes.dex */
public class PriorityGoalRow extends ArrayRow {
private static final boolean DEBUG = false;
static final int NOT_FOUND = -1;
private static final float epsilon = 1.0E-4f;
private int TABLE_SIZE;
GoalVariableAccessor accessor;
private SolverVariable[] arrayGoals;
Cache mCache;
private int numGoals;
private SolverVariable[] sortArray;
@Override // androidx.constraintlayout.core.ArrayRow, androidx.constraintlayout.core.LinearSystem.Row
public boolean isEmpty() {
return this.numGoals == 0;
}
class GoalVariableAccessor {
PriorityGoalRow row;
SolverVariable variable;
public void init(SolverVariable solverVariable) {
this.variable = solverVariable;
}
public GoalVariableAccessor(PriorityGoalRow priorityGoalRow) {
this.row = priorityGoalRow;
}
public boolean addToGoal(SolverVariable solverVariable, float f) {
boolean z = true;
if (!this.variable.inGoal) {
for (int i = 0; i < 9; i++) {
float f2 = solverVariable.goalStrengthVector[i];
if (f2 != 0.0f) {
float f3 = f2 * f;
if (Math.abs(f3) < 1.0E-4f) {
f3 = 0.0f;
}
this.variable.goalStrengthVector[i] = f3;
} else {
this.variable.goalStrengthVector[i] = 0.0f;
}
}
return true;
}
for (int i2 = 0; i2 < 9; i2++) {
float[] fArr = this.variable.goalStrengthVector;
fArr[i2] = fArr[i2] + (solverVariable.goalStrengthVector[i2] * f);
if (Math.abs(this.variable.goalStrengthVector[i2]) < 1.0E-4f) {
this.variable.goalStrengthVector[i2] = 0.0f;
} else {
z = false;
}
}
if (z) {
PriorityGoalRow.this.removeGoal(this.variable);
}
return false;
}
public void add(SolverVariable solverVariable) {
for (int i = 0; i < 9; i++) {
float[] fArr = this.variable.goalStrengthVector;
fArr[i] = fArr[i] + solverVariable.goalStrengthVector[i];
if (Math.abs(this.variable.goalStrengthVector[i]) < 1.0E-4f) {
this.variable.goalStrengthVector[i] = 0.0f;
}
}
}
public final boolean isNegative() {
for (int i = 8; i >= 0; i--) {
float f = this.variable.goalStrengthVector[i];
if (f > 0.0f) {
return false;
}
if (f < 0.0f) {
return true;
}
}
return false;
}
public final boolean isSmallerThan(SolverVariable solverVariable) {
int i = 8;
while (true) {
if (i < 0) {
break;
}
float f = solverVariable.goalStrengthVector[i];
float f2 = this.variable.goalStrengthVector[i];
if (f2 == f) {
i--;
} else if (f2 < f) {
return true;
}
}
return false;
}
public final boolean isNull() {
for (int i = 0; i < 9; i++) {
if (this.variable.goalStrengthVector[i] != 0.0f) {
return false;
}
}
return true;
}
public void reset() {
Arrays.fill(this.variable.goalStrengthVector, 0.0f);
}
public String toString() {
String str = "[ ";
if (this.variable != null) {
for (int i = 0; i < 9; i++) {
str = str + this.variable.goalStrengthVector[i] + " ";
}
}
return str + "] " + this.variable;
}
}
@Override // androidx.constraintlayout.core.ArrayRow, androidx.constraintlayout.core.LinearSystem.Row
public void clear() {
this.numGoals = 0;
this.constantValue = 0.0f;
}
public PriorityGoalRow(Cache cache) {
super(cache);
this.TABLE_SIZE = 128;
this.arrayGoals = new SolverVariable[128];
this.sortArray = new SolverVariable[128];
this.numGoals = 0;
this.accessor = new GoalVariableAccessor(this);
this.mCache = cache;
}
@Override // androidx.constraintlayout.core.ArrayRow, androidx.constraintlayout.core.LinearSystem.Row
public SolverVariable getPivotCandidate(LinearSystem linearSystem, boolean[] zArr) {
int i = -1;
for (int i2 = 0; i2 < this.numGoals; i2++) {
SolverVariable solverVariable = this.arrayGoals[i2];
if (!zArr[solverVariable.id]) {
this.accessor.init(solverVariable);
if (i == -1) {
if (!this.accessor.isNegative()) {
}
i = i2;
} else {
if (!this.accessor.isSmallerThan(this.arrayGoals[i])) {
}
i = i2;
}
}
}
if (i == -1) {
return null;
}
return this.arrayGoals[i];
}
@Override // androidx.constraintlayout.core.ArrayRow, androidx.constraintlayout.core.LinearSystem.Row
public void addError(SolverVariable solverVariable) {
this.accessor.init(solverVariable);
this.accessor.reset();
solverVariable.goalStrengthVector[solverVariable.strength] = 1.0f;
addToGoal(solverVariable);
}
private final void addToGoal(SolverVariable solverVariable) {
int i;
int i2 = this.numGoals + 1;
SolverVariable[] solverVariableArr = this.arrayGoals;
if (i2 > solverVariableArr.length) {
SolverVariable[] solverVariableArr2 = (SolverVariable[]) Arrays.copyOf(solverVariableArr, solverVariableArr.length * 2);
this.arrayGoals = solverVariableArr2;
this.sortArray = (SolverVariable[]) Arrays.copyOf(solverVariableArr2, solverVariableArr2.length * 2);
}
SolverVariable[] solverVariableArr3 = this.arrayGoals;
int i3 = this.numGoals;
solverVariableArr3[i3] = solverVariable;
int i4 = i3 + 1;
this.numGoals = i4;
if (i4 > 1 && solverVariableArr3[i3].id > solverVariable.id) {
int i5 = 0;
while (true) {
i = this.numGoals;
if (i5 >= i) {
break;
}
this.sortArray[i5] = this.arrayGoals[i5];
i5++;
}
Arrays.sort(this.sortArray, 0, i, new Comparator<SolverVariable>() { // from class: androidx.constraintlayout.core.PriorityGoalRow.1
@Override // java.util.Comparator
public int compare(SolverVariable solverVariable2, SolverVariable solverVariable3) {
return solverVariable2.id - solverVariable3.id;
}
});
for (int i6 = 0; i6 < this.numGoals; i6++) {
this.arrayGoals[i6] = this.sortArray[i6];
}
}
solverVariable.inGoal = true;
solverVariable.addToRow(this);
}
/* JADX INFO: Access modifiers changed from: private */
public final void removeGoal(SolverVariable solverVariable) {
int i = 0;
while (i < this.numGoals) {
if (this.arrayGoals[i] == solverVariable) {
while (true) {
int i2 = this.numGoals;
if (i < i2 - 1) {
SolverVariable[] solverVariableArr = this.arrayGoals;
int i3 = i + 1;
solverVariableArr[i] = solverVariableArr[i3];
i = i3;
} else {
this.numGoals = i2 - 1;
solverVariable.inGoal = false;
return;
}
}
} else {
i++;
}
}
}
@Override // androidx.constraintlayout.core.ArrayRow, androidx.constraintlayout.core.LinearSystem.Row
public void updateFromRow(LinearSystem linearSystem, ArrayRow arrayRow, boolean z) {
SolverVariable solverVariable = arrayRow.variable;
if (solverVariable == null) {
return;
}
ArrayRow.ArrayRowVariables arrayRowVariables = arrayRow.variables;
int currentSize = arrayRowVariables.getCurrentSize();
for (int i = 0; i < currentSize; i++) {
SolverVariable variable = arrayRowVariables.getVariable(i);
float variableValue = arrayRowVariables.getVariableValue(i);
this.accessor.init(variable);
if (this.accessor.addToGoal(solverVariable, variableValue)) {
addToGoal(variable);
}
this.constantValue += arrayRow.constantValue * variableValue;
}
removeGoal(solverVariable);
}
@Override // androidx.constraintlayout.core.ArrayRow
public String toString() {
String str = " goal -> (" + this.constantValue + ") : ";
for (int i = 0; i < this.numGoals; i++) {
this.accessor.init(this.arrayGoals[i]);
str = str + this.accessor + " ";
}
return str;
}
}

View File

@ -0,0 +1,317 @@
package androidx.constraintlayout.core;
import java.util.Arrays;
import java.util.HashSet;
/* loaded from: classes.dex */
public class SolverVariable implements Comparable<SolverVariable> {
private static final boolean INTERNAL_DEBUG = false;
static final int MAX_STRENGTH = 9;
public static final int STRENGTH_BARRIER = 6;
public static final int STRENGTH_CENTERING = 7;
public static final int STRENGTH_EQUALITY = 5;
public static final int STRENGTH_FIXED = 8;
public static final int STRENGTH_HIGH = 3;
public static final int STRENGTH_HIGHEST = 4;
public static final int STRENGTH_LOW = 1;
public static final int STRENGTH_MEDIUM = 2;
public static final int STRENGTH_NONE = 0;
private static final boolean VAR_USE_HASH = false;
private static int uniqueConstantId = 1;
private static int uniqueErrorId = 1;
private static int uniqueId = 1;
private static int uniqueSlackId = 1;
private static int uniqueUnrestrictedId = 1;
public float computedValue;
int definitionId;
float[] goalStrengthVector;
public int id;
public boolean inGoal;
HashSet<ArrayRow> inRows;
public boolean isFinalValue;
boolean isSynonym;
ArrayRow[] mClientEquations;
int mClientEquationsCount;
private String mName;
Type mType;
public int strength;
float[] strengthVector;
int synonym;
float synonymDelta;
public int usageInRowCount;
public enum Type {
UNRESTRICTED,
CONSTANT,
SLACK,
ERROR,
UNKNOWN
}
static void increaseErrorId() {
uniqueErrorId++;
}
public String getName() {
return this.mName;
}
public void setName(String str) {
this.mName = str;
}
public void setType(Type type, String str) {
this.mType = type;
}
private static String getUniqueName(Type type, String str) {
if (str != null) {
return str + uniqueErrorId;
}
int i = AnonymousClass1.$SwitchMap$androidx$constraintlayout$core$SolverVariable$Type[type.ordinal()];
if (i == 1) {
StringBuilder sb = new StringBuilder("U");
int i2 = uniqueUnrestrictedId + 1;
uniqueUnrestrictedId = i2;
sb.append(i2);
return sb.toString();
}
if (i == 2) {
StringBuilder sb2 = new StringBuilder("C");
int i3 = uniqueConstantId + 1;
uniqueConstantId = i3;
sb2.append(i3);
return sb2.toString();
}
if (i == 3) {
StringBuilder sb3 = new StringBuilder("S");
int i4 = uniqueSlackId + 1;
uniqueSlackId = i4;
sb3.append(i4);
return sb3.toString();
}
if (i == 4) {
StringBuilder sb4 = new StringBuilder("e");
int i5 = uniqueErrorId + 1;
uniqueErrorId = i5;
sb4.append(i5);
return sb4.toString();
}
if (i == 5) {
StringBuilder sb5 = new StringBuilder("V");
int i6 = uniqueId + 1;
uniqueId = i6;
sb5.append(i6);
return sb5.toString();
}
throw new AssertionError(type.name());
}
/* renamed from: androidx.constraintlayout.core.SolverVariable$1, reason: invalid class name */
static /* synthetic */ class AnonymousClass1 {
static final /* synthetic */ int[] $SwitchMap$androidx$constraintlayout$core$SolverVariable$Type;
static {
int[] iArr = new int[Type.values().length];
$SwitchMap$androidx$constraintlayout$core$SolverVariable$Type = iArr;
try {
iArr[Type.UNRESTRICTED.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
$SwitchMap$androidx$constraintlayout$core$SolverVariable$Type[Type.CONSTANT.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
$SwitchMap$androidx$constraintlayout$core$SolverVariable$Type[Type.SLACK.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
$SwitchMap$androidx$constraintlayout$core$SolverVariable$Type[Type.ERROR.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
try {
$SwitchMap$androidx$constraintlayout$core$SolverVariable$Type[Type.UNKNOWN.ordinal()] = 5;
} catch (NoSuchFieldError unused5) {
}
}
}
public SolverVariable(String str, Type type) {
this.id = -1;
this.definitionId = -1;
this.strength = 0;
this.isFinalValue = false;
this.strengthVector = new float[9];
this.goalStrengthVector = new float[9];
this.mClientEquations = new ArrayRow[16];
this.mClientEquationsCount = 0;
this.usageInRowCount = 0;
this.isSynonym = false;
this.synonym = -1;
this.synonymDelta = 0.0f;
this.inRows = null;
this.mName = str;
this.mType = type;
}
public SolverVariable(Type type, String str) {
this.id = -1;
this.definitionId = -1;
this.strength = 0;
this.isFinalValue = false;
this.strengthVector = new float[9];
this.goalStrengthVector = new float[9];
this.mClientEquations = new ArrayRow[16];
this.mClientEquationsCount = 0;
this.usageInRowCount = 0;
this.isSynonym = false;
this.synonym = -1;
this.synonymDelta = 0.0f;
this.inRows = null;
this.mType = type;
}
void clearStrengths() {
for (int i = 0; i < 9; i++) {
this.strengthVector[i] = 0.0f;
}
}
String strengthsToString() {
String str = this + "[";
boolean z = false;
boolean z2 = true;
for (int i = 0; i < this.strengthVector.length; i++) {
String str2 = str + this.strengthVector[i];
float[] fArr = this.strengthVector;
float f = fArr[i];
if (f > 0.0f) {
z = false;
} else if (f < 0.0f) {
z = true;
}
if (f != 0.0f) {
z2 = false;
}
str = i < fArr.length - 1 ? str2 + ", " : str2 + "] ";
}
if (z) {
str = str + " (-)";
}
if (!z2) {
return str;
}
return str + " (*)";
}
public final void addToRow(ArrayRow arrayRow) {
int i = 0;
while (true) {
int i2 = this.mClientEquationsCount;
if (i < i2) {
if (this.mClientEquations[i] == arrayRow) {
return;
} else {
i++;
}
} else {
ArrayRow[] arrayRowArr = this.mClientEquations;
if (i2 >= arrayRowArr.length) {
this.mClientEquations = (ArrayRow[]) Arrays.copyOf(arrayRowArr, arrayRowArr.length * 2);
}
ArrayRow[] arrayRowArr2 = this.mClientEquations;
int i3 = this.mClientEquationsCount;
arrayRowArr2[i3] = arrayRow;
this.mClientEquationsCount = i3 + 1;
return;
}
}
}
public final void removeFromRow(ArrayRow arrayRow) {
int i = this.mClientEquationsCount;
int i2 = 0;
while (i2 < i) {
if (this.mClientEquations[i2] == arrayRow) {
while (i2 < i - 1) {
ArrayRow[] arrayRowArr = this.mClientEquations;
int i3 = i2 + 1;
arrayRowArr[i2] = arrayRowArr[i3];
i2 = i3;
}
this.mClientEquationsCount--;
return;
}
i2++;
}
}
public final void updateReferencesWithNewDefinition(LinearSystem linearSystem, ArrayRow arrayRow) {
int i = this.mClientEquationsCount;
for (int i2 = 0; i2 < i; i2++) {
this.mClientEquations[i2].updateFromRow(linearSystem, arrayRow, false);
}
this.mClientEquationsCount = 0;
}
public void setFinalValue(LinearSystem linearSystem, float f) {
this.computedValue = f;
this.isFinalValue = true;
this.isSynonym = false;
this.synonym = -1;
this.synonymDelta = 0.0f;
int i = this.mClientEquationsCount;
this.definitionId = -1;
for (int i2 = 0; i2 < i; i2++) {
this.mClientEquations[i2].updateFromFinalVariable(linearSystem, this, false);
}
this.mClientEquationsCount = 0;
}
public void setSynonym(LinearSystem linearSystem, SolverVariable solverVariable, float f) {
this.isSynonym = true;
this.synonym = solverVariable.id;
this.synonymDelta = f;
int i = this.mClientEquationsCount;
this.definitionId = -1;
for (int i2 = 0; i2 < i; i2++) {
this.mClientEquations[i2].updateFromSynonymVariable(linearSystem, this, false);
}
this.mClientEquationsCount = 0;
linearSystem.displayReadableRows();
}
public void reset() {
this.mName = null;
this.mType = Type.UNKNOWN;
this.strength = 0;
this.id = -1;
this.definitionId = -1;
this.computedValue = 0.0f;
this.isFinalValue = false;
this.isSynonym = false;
this.synonym = -1;
this.synonymDelta = 0.0f;
int i = this.mClientEquationsCount;
for (int i2 = 0; i2 < i; i2++) {
this.mClientEquations[i2] = null;
}
this.mClientEquationsCount = 0;
this.usageInRowCount = 0;
this.inGoal = false;
Arrays.fill(this.goalStrengthVector, 0.0f);
}
@Override // java.lang.Comparable
public int compareTo(SolverVariable solverVariable) {
return this.id - solverVariable.id;
}
public String toString() {
if (this.mName != null) {
return "" + this.mName;
}
return "" + this.id;
}
}

View File

@ -0,0 +1,434 @@
package androidx.constraintlayout.core;
import androidx.constraintlayout.core.ArrayRow;
import java.util.Arrays;
/* loaded from: classes.dex */
public class SolverVariableValues implements ArrayRow.ArrayRowVariables {
private static final boolean DEBUG = false;
private static final boolean HASH = true;
private static float epsilon = 0.001f;
protected final Cache mCache;
private final ArrayRow mRow;
private final int NONE = -1;
private int SIZE = 16;
private int HASH_SIZE = 16;
int[] keys = new int[16];
int[] nextKeys = new int[16];
int[] variables = new int[16];
float[] values = new float[16];
int[] previous = new int[16];
int[] next = new int[16];
int mCount = 0;
int head = -1;
@Override // androidx.constraintlayout.core.ArrayRow.ArrayRowVariables
public int getCurrentSize() {
return this.mCount;
}
@Override // androidx.constraintlayout.core.ArrayRow.ArrayRowVariables
public int sizeInBytes() {
return 0;
}
SolverVariableValues(ArrayRow arrayRow, Cache cache) {
this.mRow = arrayRow;
this.mCache = cache;
clear();
}
@Override // androidx.constraintlayout.core.ArrayRow.ArrayRowVariables
public SolverVariable getVariable(int i) {
int i2 = this.mCount;
if (i2 == 0) {
return null;
}
int i3 = this.head;
for (int i4 = 0; i4 < i2; i4++) {
if (i4 == i && i3 != -1) {
return this.mCache.mIndexedVariables[this.variables[i3]];
}
i3 = this.next[i3];
if (i3 == -1) {
break;
}
}
return null;
}
@Override // androidx.constraintlayout.core.ArrayRow.ArrayRowVariables
public float getVariableValue(int i) {
int i2 = this.mCount;
int i3 = this.head;
for (int i4 = 0; i4 < i2; i4++) {
if (i4 == i) {
return this.values[i3];
}
i3 = this.next[i3];
if (i3 == -1) {
return 0.0f;
}
}
return 0.0f;
}
@Override // androidx.constraintlayout.core.ArrayRow.ArrayRowVariables
public boolean contains(SolverVariable solverVariable) {
if (indexOf(solverVariable) != -1) {
return HASH;
}
return false;
}
@Override // androidx.constraintlayout.core.ArrayRow.ArrayRowVariables
public int indexOf(SolverVariable solverVariable) {
if (this.mCount != 0 && solverVariable != null) {
int i = solverVariable.id;
int i2 = this.keys[i % this.HASH_SIZE];
if (i2 == -1) {
return -1;
}
if (this.variables[i2] == i) {
return i2;
}
do {
i2 = this.nextKeys[i2];
if (i2 == -1) {
break;
}
} while (this.variables[i2] != i);
if (i2 != -1 && this.variables[i2] == i) {
return i2;
}
}
return -1;
}
@Override // androidx.constraintlayout.core.ArrayRow.ArrayRowVariables
public float get(SolverVariable solverVariable) {
int indexOf = indexOf(solverVariable);
if (indexOf != -1) {
return this.values[indexOf];
}
return 0.0f;
}
@Override // androidx.constraintlayout.core.ArrayRow.ArrayRowVariables
public void display() {
int i = this.mCount;
System.out.print("{ ");
for (int i2 = 0; i2 < i; i2++) {
SolverVariable variable = getVariable(i2);
if (variable != null) {
System.out.print(variable + " = " + getVariableValue(i2) + " ");
}
}
System.out.println(" }");
}
public String toString() {
String str = hashCode() + " { ";
int i = this.mCount;
for (int i2 = 0; i2 < i; i2++) {
SolverVariable variable = getVariable(i2);
if (variable != null) {
String str2 = str + variable + " = " + getVariableValue(i2) + " ";
int indexOf = indexOf(variable);
String str3 = str2 + "[p: ";
String str4 = (this.previous[indexOf] != -1 ? str3 + this.mCache.mIndexedVariables[this.variables[this.previous[indexOf]]] : str3 + "none") + ", n: ";
str = (this.next[indexOf] != -1 ? str4 + this.mCache.mIndexedVariables[this.variables[this.next[indexOf]]] : str4 + "none") + "]";
}
}
return str + " }";
}
@Override // androidx.constraintlayout.core.ArrayRow.ArrayRowVariables
public void clear() {
int i = this.mCount;
for (int i2 = 0; i2 < i; i2++) {
SolverVariable variable = getVariable(i2);
if (variable != null) {
variable.removeFromRow(this.mRow);
}
}
for (int i3 = 0; i3 < this.SIZE; i3++) {
this.variables[i3] = -1;
this.nextKeys[i3] = -1;
}
for (int i4 = 0; i4 < this.HASH_SIZE; i4++) {
this.keys[i4] = -1;
}
this.mCount = 0;
this.head = -1;
}
private void increaseSize() {
int i = this.SIZE * 2;
this.variables = Arrays.copyOf(this.variables, i);
this.values = Arrays.copyOf(this.values, i);
this.previous = Arrays.copyOf(this.previous, i);
this.next = Arrays.copyOf(this.next, i);
this.nextKeys = Arrays.copyOf(this.nextKeys, i);
for (int i2 = this.SIZE; i2 < i; i2++) {
this.variables[i2] = -1;
this.nextKeys[i2] = -1;
}
this.SIZE = i;
}
private void addToHashMap(SolverVariable solverVariable, int i) {
int[] iArr;
int i2 = solverVariable.id % this.HASH_SIZE;
int[] iArr2 = this.keys;
int i3 = iArr2[i2];
if (i3 == -1) {
iArr2[i2] = i;
} else {
while (true) {
iArr = this.nextKeys;
int i4 = iArr[i3];
if (i4 == -1) {
break;
} else {
i3 = i4;
}
}
iArr[i3] = i;
}
this.nextKeys[i] = -1;
}
private void displayHash() {
for (int i = 0; i < this.HASH_SIZE; i++) {
if (this.keys[i] != -1) {
String str = hashCode() + " hash [" + i + "] => ";
int i2 = this.keys[i];
boolean z = false;
while (!z) {
str = str + " " + this.variables[i2];
int i3 = this.nextKeys[i2];
if (i3 != -1) {
i2 = i3;
} else {
z = HASH;
}
}
System.out.println(str);
}
}
}
private void removeFromHashMap(SolverVariable solverVariable) {
int[] iArr;
int i;
int i2 = solverVariable.id % this.HASH_SIZE;
int i3 = this.keys[i2];
if (i3 == -1) {
return;
}
int i4 = solverVariable.id;
if (this.variables[i3] == i4) {
int[] iArr2 = this.keys;
int[] iArr3 = this.nextKeys;
iArr2[i2] = iArr3[i3];
iArr3[i3] = -1;
return;
}
while (true) {
iArr = this.nextKeys;
i = iArr[i3];
if (i == -1 || this.variables[i] == i4) {
break;
} else {
i3 = i;
}
}
if (i == -1 || this.variables[i] != i4) {
return;
}
iArr[i3] = iArr[i];
iArr[i] = -1;
}
private void addVariable(int i, SolverVariable solverVariable, float f) {
this.variables[i] = solverVariable.id;
this.values[i] = f;
this.previous[i] = -1;
this.next[i] = -1;
solverVariable.addToRow(this.mRow);
solverVariable.usageInRowCount++;
this.mCount++;
}
private int findEmptySlot() {
for (int i = 0; i < this.SIZE; i++) {
if (this.variables[i] == -1) {
return i;
}
}
return -1;
}
private void insertVariable(int i, SolverVariable solverVariable, float f) {
int findEmptySlot = findEmptySlot();
addVariable(findEmptySlot, solverVariable, f);
if (i != -1) {
this.previous[findEmptySlot] = i;
int[] iArr = this.next;
iArr[findEmptySlot] = iArr[i];
iArr[i] = findEmptySlot;
} else {
this.previous[findEmptySlot] = -1;
if (this.mCount > 0) {
this.next[findEmptySlot] = this.head;
this.head = findEmptySlot;
} else {
this.next[findEmptySlot] = -1;
}
}
int i2 = this.next[findEmptySlot];
if (i2 != -1) {
this.previous[i2] = findEmptySlot;
}
addToHashMap(solverVariable, findEmptySlot);
}
@Override // androidx.constraintlayout.core.ArrayRow.ArrayRowVariables
public void put(SolverVariable solverVariable, float f) {
float f2 = epsilon;
if (f > (-f2) && f < f2) {
remove(solverVariable, HASH);
return;
}
if (this.mCount == 0) {
addVariable(0, solverVariable, f);
addToHashMap(solverVariable, 0);
this.head = 0;
return;
}
int indexOf = indexOf(solverVariable);
if (indexOf != -1) {
this.values[indexOf] = f;
return;
}
if (this.mCount + 1 >= this.SIZE) {
increaseSize();
}
int i = this.mCount;
int i2 = this.head;
int i3 = -1;
for (int i4 = 0; i4 < i; i4++) {
if (this.variables[i2] == solverVariable.id) {
this.values[i2] = f;
return;
}
if (this.variables[i2] < solverVariable.id) {
i3 = i2;
}
i2 = this.next[i2];
if (i2 == -1) {
break;
}
}
insertVariable(i3, solverVariable, f);
}
@Override // androidx.constraintlayout.core.ArrayRow.ArrayRowVariables
public float remove(SolverVariable solverVariable, boolean z) {
int indexOf = indexOf(solverVariable);
if (indexOf == -1) {
return 0.0f;
}
removeFromHashMap(solverVariable);
float f = this.values[indexOf];
if (this.head == indexOf) {
this.head = this.next[indexOf];
}
this.variables[indexOf] = -1;
int[] iArr = this.previous;
int i = iArr[indexOf];
if (i != -1) {
int[] iArr2 = this.next;
iArr2[i] = iArr2[indexOf];
}
int i2 = this.next[indexOf];
if (i2 != -1) {
iArr[i2] = iArr[indexOf];
}
this.mCount--;
solverVariable.usageInRowCount--;
if (z) {
solverVariable.removeFromRow(this.mRow);
}
return f;
}
@Override // androidx.constraintlayout.core.ArrayRow.ArrayRowVariables
public void add(SolverVariable solverVariable, float f, boolean z) {
float f2 = epsilon;
if (f <= (-f2) || f >= f2) {
int indexOf = indexOf(solverVariable);
if (indexOf == -1) {
put(solverVariable, f);
return;
}
float[] fArr = this.values;
float f3 = fArr[indexOf] + f;
fArr[indexOf] = f3;
float f4 = epsilon;
if (f3 <= (-f4) || f3 >= f4) {
return;
}
fArr[indexOf] = 0.0f;
remove(solverVariable, z);
}
}
@Override // androidx.constraintlayout.core.ArrayRow.ArrayRowVariables
public float use(ArrayRow arrayRow, boolean z) {
float f = get(arrayRow.variable);
remove(arrayRow.variable, z);
SolverVariableValues solverVariableValues = (SolverVariableValues) arrayRow.variables;
int currentSize = solverVariableValues.getCurrentSize();
int i = solverVariableValues.head;
int i2 = 0;
int i3 = 0;
while (i2 < currentSize) {
if (solverVariableValues.variables[i3] != -1) {
add(this.mCache.mIndexedVariables[solverVariableValues.variables[i3]], solverVariableValues.values[i3] * f, z);
i2++;
}
i3++;
}
return f;
}
@Override // androidx.constraintlayout.core.ArrayRow.ArrayRowVariables
public void invert() {
int i = this.mCount;
int i2 = this.head;
for (int i3 = 0; i3 < i; i3++) {
float[] fArr = this.values;
fArr[i2] = fArr[i2] * (-1.0f);
i2 = this.next[i2];
if (i2 == -1) {
return;
}
}
}
@Override // androidx.constraintlayout.core.ArrayRow.ArrayRowVariables
public void divideByAmount(float f) {
int i = this.mCount;
int i2 = this.head;
for (int i3 = 0; i3 < i; i3++) {
float[] fArr = this.values;
fArr[i2] = fArr[i2] / f;
i2 = this.next[i2];
if (i2 == -1) {
return;
}
}
}
}

View File

@ -0,0 +1,252 @@
package androidx.constraintlayout.core.motion;
import androidx.core.view.ViewCompat;
/* loaded from: classes.dex */
public class CustomAttribute {
private static final String TAG = "TransitionLayout";
boolean mBooleanValue;
private int mColorValue;
private float mFloatValue;
private int mIntegerValue;
private boolean mMethod;
String mName;
private String mStringValue;
private AttributeType mType;
public enum AttributeType {
INT_TYPE,
FLOAT_TYPE,
COLOR_TYPE,
COLOR_DRAWABLE_TYPE,
STRING_TYPE,
BOOLEAN_TYPE,
DIMENSION_TYPE,
REFERENCE_TYPE
}
private static int clamp(int i) {
int i2 = (i & (~(i >> 31))) - 255;
return (i2 & (i2 >> 31)) + 255;
}
public static int hsvToRgb(float f, float f2, float f3) {
float f4 = f * 6.0f;
int i = (int) f4;
float f5 = f4 - i;
float f6 = f3 * 255.0f;
int i2 = (int) (((1.0f - f2) * f6) + 0.5f);
int i3 = (int) (((1.0f - (f5 * f2)) * f6) + 0.5f);
int i4 = (int) (((1.0f - ((1.0f - f5) * f2)) * f6) + 0.5f);
int i5 = (int) (f6 + 0.5f);
if (i == 0) {
return ((i5 << 16) + (i4 << 8) + i2) | ViewCompat.MEASURED_STATE_MASK;
}
if (i == 1) {
return ((i3 << 16) + (i5 << 8) + i2) | ViewCompat.MEASURED_STATE_MASK;
}
if (i == 2) {
return ((i2 << 16) + (i5 << 8) + i4) | ViewCompat.MEASURED_STATE_MASK;
}
if (i == 3) {
return ((i2 << 16) + (i3 << 8) + i5) | ViewCompat.MEASURED_STATE_MASK;
}
if (i == 4) {
return ((i4 << 16) + (i2 << 8) + i5) | ViewCompat.MEASURED_STATE_MASK;
}
if (i != 5) {
return 0;
}
return ((i5 << 16) + (i2 << 8) + i3) | ViewCompat.MEASURED_STATE_MASK;
}
public AttributeType getType() {
return this.mType;
}
public void setColorValue(int i) {
this.mColorValue = i;
}
public void setFloatValue(float f) {
this.mFloatValue = f;
}
public void setIntValue(int i) {
this.mIntegerValue = i;
}
public void setStringValue(String str) {
this.mStringValue = str;
}
public boolean isContinuous() {
int i = AnonymousClass1.$SwitchMap$androidx$constraintlayout$core$motion$CustomAttribute$AttributeType[this.mType.ordinal()];
return (i == 1 || i == 2 || i == 3) ? false : true;
}
public int numberOfInterpolatedValues() {
int i = AnonymousClass1.$SwitchMap$androidx$constraintlayout$core$motion$CustomAttribute$AttributeType[this.mType.ordinal()];
return (i == 4 || i == 5) ? 4 : 1;
}
public float getValueToInterpolate() {
switch (this.mType) {
case BOOLEAN_TYPE:
return this.mBooleanValue ? 1.0f : 0.0f;
case STRING_TYPE:
throw new RuntimeException("Cannot interpolate String");
case COLOR_TYPE:
case COLOR_DRAWABLE_TYPE:
throw new RuntimeException("Color does not have a single color to interpolate");
case INT_TYPE:
return this.mIntegerValue;
case FLOAT_TYPE:
return this.mFloatValue;
case DIMENSION_TYPE:
return this.mFloatValue;
default:
return Float.NaN;
}
}
public void getValuesToInterpolate(float[] fArr) {
switch (this.mType) {
case BOOLEAN_TYPE:
fArr[0] = this.mBooleanValue ? 1.0f : 0.0f;
return;
case STRING_TYPE:
throw new RuntimeException("Color does not have a single color to interpolate");
case COLOR_TYPE:
case COLOR_DRAWABLE_TYPE:
int i = (this.mColorValue >> 24) & 255;
float pow = (float) Math.pow(((r0 >> 16) & 255) / 255.0f, 2.2d);
float pow2 = (float) Math.pow(((r0 >> 8) & 255) / 255.0f, 2.2d);
float pow3 = (float) Math.pow((r0 & 255) / 255.0f, 2.2d);
fArr[0] = pow;
fArr[1] = pow2;
fArr[2] = pow3;
fArr[3] = i / 255.0f;
return;
case INT_TYPE:
fArr[0] = this.mIntegerValue;
return;
case FLOAT_TYPE:
fArr[0] = this.mFloatValue;
return;
case DIMENSION_TYPE:
fArr[0] = this.mFloatValue;
return;
default:
return;
}
}
public void setValue(float[] fArr) {
switch (AnonymousClass1.$SwitchMap$androidx$constraintlayout$core$motion$CustomAttribute$AttributeType[this.mType.ordinal()]) {
case 1:
case 6:
this.mIntegerValue = (int) fArr[0];
return;
case 2:
this.mBooleanValue = ((double) fArr[0]) > 0.5d;
return;
case 3:
throw new RuntimeException("Color does not have a single color to interpolate");
case 4:
case 5:
int hsvToRgb = hsvToRgb(fArr[0], fArr[1], fArr[2]);
this.mColorValue = hsvToRgb;
this.mColorValue = (clamp((int) (fArr[3] * 255.0f)) << 24) | (hsvToRgb & ViewCompat.MEASURED_SIZE_MASK);
return;
case 7:
this.mFloatValue = fArr[0];
return;
case 8:
this.mFloatValue = fArr[0];
return;
default:
return;
}
}
public boolean diff(CustomAttribute customAttribute) {
if (customAttribute == null || this.mType != customAttribute.mType) {
return false;
}
switch (AnonymousClass1.$SwitchMap$androidx$constraintlayout$core$motion$CustomAttribute$AttributeType[this.mType.ordinal()]) {
case 1:
case 6:
if (this.mIntegerValue == customAttribute.mIntegerValue) {
}
break;
case 2:
if (this.mBooleanValue == customAttribute.mBooleanValue) {
}
break;
case 3:
if (this.mIntegerValue == customAttribute.mIntegerValue) {
}
break;
case 4:
case 5:
if (this.mColorValue == customAttribute.mColorValue) {
}
break;
case 7:
if (this.mFloatValue == customAttribute.mFloatValue) {
}
break;
case 8:
if (this.mFloatValue == customAttribute.mFloatValue) {
}
break;
}
return false;
}
public CustomAttribute(String str, AttributeType attributeType) {
this.mMethod = false;
this.mName = str;
this.mType = attributeType;
}
public CustomAttribute(String str, AttributeType attributeType, Object obj, boolean z) {
this.mName = str;
this.mType = attributeType;
this.mMethod = z;
setValue(obj);
}
public CustomAttribute(CustomAttribute customAttribute, Object obj) {
this.mMethod = false;
this.mName = customAttribute.mName;
this.mType = customAttribute.mType;
setValue(obj);
}
public void setValue(Object obj) {
switch (AnonymousClass1.$SwitchMap$androidx$constraintlayout$core$motion$CustomAttribute$AttributeType[this.mType.ordinal()]) {
case 1:
case 6:
this.mIntegerValue = ((Integer) obj).intValue();
break;
case 2:
this.mBooleanValue = ((Boolean) obj).booleanValue();
break;
case 3:
this.mStringValue = (String) obj;
break;
case 4:
case 5:
this.mColorValue = ((Integer) obj).intValue();
break;
case 7:
this.mFloatValue = ((Float) obj).floatValue();
break;
case 8:
this.mFloatValue = ((Float) obj).floatValue();
break;
}
}
}

View File

@ -0,0 +1,394 @@
package androidx.constraintlayout.core.motion;
import androidx.constraintlayout.core.motion.utils.TypedValues;
import androidx.core.view.ViewCompat;
/* loaded from: classes.dex */
public class CustomVariable {
private static final String TAG = "TransitionLayout";
boolean mBooleanValue;
private float mFloatValue;
private int mIntegerValue;
String mName;
private String mStringValue;
private int mType;
private static int clamp(int i) {
int i2 = (i & (~(i >> 31))) - 255;
return (i2 & (i2 >> 31)) + 255;
}
public static int hsvToRgb(float f, float f2, float f3) {
float f4 = f * 6.0f;
int i = (int) f4;
float f5 = f4 - i;
float f6 = f3 * 255.0f;
int i2 = (int) (((1.0f - f2) * f6) + 0.5f);
int i3 = (int) (((1.0f - (f5 * f2)) * f6) + 0.5f);
int i4 = (int) (((1.0f - ((1.0f - f5) * f2)) * f6) + 0.5f);
int i5 = (int) (f6 + 0.5f);
if (i == 0) {
return ((i5 << 16) + (i4 << 8) + i2) | ViewCompat.MEASURED_STATE_MASK;
}
if (i == 1) {
return ((i3 << 16) + (i5 << 8) + i2) | ViewCompat.MEASURED_STATE_MASK;
}
if (i == 2) {
return ((i2 << 16) + (i5 << 8) + i4) | ViewCompat.MEASURED_STATE_MASK;
}
if (i == 3) {
return ((i2 << 16) + (i3 << 8) + i5) | ViewCompat.MEASURED_STATE_MASK;
}
if (i == 4) {
return ((i4 << 16) + (i2 << 8) + i5) | ViewCompat.MEASURED_STATE_MASK;
}
if (i != 5) {
return 0;
}
return ((i5 << 16) + (i2 << 8) + i3) | ViewCompat.MEASURED_STATE_MASK;
}
public boolean getBooleanValue() {
return this.mBooleanValue;
}
public int getColorValue() {
return this.mIntegerValue;
}
public float getFloatValue() {
return this.mFloatValue;
}
public int getIntegerValue() {
return this.mIntegerValue;
}
public String getName() {
return this.mName;
}
public String getStringValue() {
return this.mStringValue;
}
public int getType() {
return this.mType;
}
public boolean isContinuous() {
int i = this.mType;
return (i == 903 || i == 904 || i == 906) ? false : true;
}
public int numberOfInterpolatedValues() {
return this.mType != 902 ? 1 : 4;
}
public void setBooleanValue(boolean z) {
this.mBooleanValue = z;
}
public void setFloatValue(float f) {
this.mFloatValue = f;
}
public void setIntValue(int i) {
this.mIntegerValue = i;
}
public void setStringValue(String str) {
this.mStringValue = str;
}
public CustomVariable copy() {
return new CustomVariable(this);
}
public CustomVariable(CustomVariable customVariable) {
this.mIntegerValue = Integer.MIN_VALUE;
this.mFloatValue = Float.NaN;
this.mStringValue = null;
this.mName = customVariable.mName;
this.mType = customVariable.mType;
this.mIntegerValue = customVariable.mIntegerValue;
this.mFloatValue = customVariable.mFloatValue;
this.mStringValue = customVariable.mStringValue;
this.mBooleanValue = customVariable.mBooleanValue;
}
public CustomVariable(String str, int i, String str2) {
this.mIntegerValue = Integer.MIN_VALUE;
this.mFloatValue = Float.NaN;
this.mName = str;
this.mType = i;
this.mStringValue = str2;
}
public CustomVariable(String str, int i, int i2) {
this.mIntegerValue = Integer.MIN_VALUE;
this.mFloatValue = Float.NaN;
this.mStringValue = null;
this.mName = str;
this.mType = i;
if (i == 901) {
this.mFloatValue = i2;
} else {
this.mIntegerValue = i2;
}
}
public CustomVariable(String str, int i, float f) {
this.mIntegerValue = Integer.MIN_VALUE;
this.mStringValue = null;
this.mName = str;
this.mType = i;
this.mFloatValue = f;
}
public CustomVariable(String str, int i, boolean z) {
this.mIntegerValue = Integer.MIN_VALUE;
this.mFloatValue = Float.NaN;
this.mStringValue = null;
this.mName = str;
this.mType = i;
this.mBooleanValue = z;
}
public static String colorString(int i) {
return "#" + ("00000000" + Integer.toHexString(i)).substring(r2.length() - 8);
}
public String toString() {
String str = this.mName + ':';
switch (this.mType) {
case TypedValues.Custom.TYPE_INT /* 900 */:
return str + this.mIntegerValue;
case TypedValues.Custom.TYPE_FLOAT /* 901 */:
return str + this.mFloatValue;
case TypedValues.Custom.TYPE_COLOR /* 902 */:
return str + colorString(this.mIntegerValue);
case TypedValues.Custom.TYPE_STRING /* 903 */:
return str + this.mStringValue;
case TypedValues.Custom.TYPE_BOOLEAN /* 904 */:
return str + Boolean.valueOf(this.mBooleanValue);
case TypedValues.Custom.TYPE_DIMENSION /* 905 */:
return str + this.mFloatValue;
default:
return str + "????";
}
}
public float getValueToInterpolate() {
switch (this.mType) {
case TypedValues.Custom.TYPE_INT /* 900 */:
return this.mIntegerValue;
case TypedValues.Custom.TYPE_FLOAT /* 901 */:
return this.mFloatValue;
case TypedValues.Custom.TYPE_COLOR /* 902 */:
throw new RuntimeException("Color does not have a single color to interpolate");
case TypedValues.Custom.TYPE_STRING /* 903 */:
throw new RuntimeException("Cannot interpolate String");
case TypedValues.Custom.TYPE_BOOLEAN /* 904 */:
return this.mBooleanValue ? 1.0f : 0.0f;
case TypedValues.Custom.TYPE_DIMENSION /* 905 */:
return this.mFloatValue;
default:
return Float.NaN;
}
}
public void getValuesToInterpolate(float[] fArr) {
switch (this.mType) {
case TypedValues.Custom.TYPE_INT /* 900 */:
fArr[0] = this.mIntegerValue;
return;
case TypedValues.Custom.TYPE_FLOAT /* 901 */:
fArr[0] = this.mFloatValue;
return;
case TypedValues.Custom.TYPE_COLOR /* 902 */:
int i = (this.mIntegerValue >> 24) & 255;
float pow = (float) Math.pow(((r0 >> 16) & 255) / 255.0f, 2.2d);
float pow2 = (float) Math.pow(((r0 >> 8) & 255) / 255.0f, 2.2d);
float pow3 = (float) Math.pow((r0 & 255) / 255.0f, 2.2d);
fArr[0] = pow;
fArr[1] = pow2;
fArr[2] = pow3;
fArr[3] = i / 255.0f;
return;
case TypedValues.Custom.TYPE_STRING /* 903 */:
throw new RuntimeException("Cannot interpolate String");
case TypedValues.Custom.TYPE_BOOLEAN /* 904 */:
fArr[0] = this.mBooleanValue ? 1.0f : 0.0f;
return;
case TypedValues.Custom.TYPE_DIMENSION /* 905 */:
fArr[0] = this.mFloatValue;
return;
default:
return;
}
}
public void setValue(float[] fArr) {
switch (this.mType) {
case TypedValues.Custom.TYPE_INT /* 900 */:
case TypedValues.Custom.TYPE_REFERENCE /* 906 */:
this.mIntegerValue = (int) fArr[0];
return;
case TypedValues.Custom.TYPE_FLOAT /* 901 */:
case TypedValues.Custom.TYPE_DIMENSION /* 905 */:
this.mFloatValue = fArr[0];
return;
case TypedValues.Custom.TYPE_COLOR /* 902 */:
this.mIntegerValue = ((Math.round(fArr[3] * 255.0f) & 255) << 24) | ((Math.round(((float) Math.pow(fArr[0], 0.5d)) * 255.0f) & 255) << 16) | ((Math.round(((float) Math.pow(fArr[1], 0.5d)) * 255.0f) & 255) << 8) | (Math.round(((float) Math.pow(fArr[2], 0.5d)) * 255.0f) & 255);
return;
case TypedValues.Custom.TYPE_STRING /* 903 */:
throw new RuntimeException("Cannot interpolate String");
case TypedValues.Custom.TYPE_BOOLEAN /* 904 */:
this.mBooleanValue = ((double) fArr[0]) > 0.5d;
return;
default:
return;
}
}
public boolean diff(CustomVariable customVariable) {
int i;
if (customVariable == null || (i = this.mType) != customVariable.mType) {
return false;
}
switch (i) {
case TypedValues.Custom.TYPE_INT /* 900 */:
case TypedValues.Custom.TYPE_REFERENCE /* 906 */:
if (this.mIntegerValue == customVariable.mIntegerValue) {
}
break;
case TypedValues.Custom.TYPE_FLOAT /* 901 */:
if (this.mFloatValue == customVariable.mFloatValue) {
}
break;
case TypedValues.Custom.TYPE_COLOR /* 902 */:
if (this.mIntegerValue == customVariable.mIntegerValue) {
}
break;
case TypedValues.Custom.TYPE_STRING /* 903 */:
if (this.mIntegerValue == customVariable.mIntegerValue) {
}
break;
case TypedValues.Custom.TYPE_BOOLEAN /* 904 */:
if (this.mBooleanValue == customVariable.mBooleanValue) {
}
break;
case TypedValues.Custom.TYPE_DIMENSION /* 905 */:
if (this.mFloatValue == customVariable.mFloatValue) {
}
break;
}
return false;
}
public CustomVariable(String str, int i) {
this.mIntegerValue = Integer.MIN_VALUE;
this.mFloatValue = Float.NaN;
this.mStringValue = null;
this.mName = str;
this.mType = i;
}
public CustomVariable(String str, int i, Object obj) {
this.mIntegerValue = Integer.MIN_VALUE;
this.mFloatValue = Float.NaN;
this.mStringValue = null;
this.mName = str;
this.mType = i;
setValue(obj);
}
public CustomVariable(CustomVariable customVariable, Object obj) {
this.mIntegerValue = Integer.MIN_VALUE;
this.mFloatValue = Float.NaN;
this.mStringValue = null;
this.mName = customVariable.mName;
this.mType = customVariable.mType;
setValue(obj);
}
public void setValue(Object obj) {
switch (this.mType) {
case TypedValues.Custom.TYPE_INT /* 900 */:
case TypedValues.Custom.TYPE_REFERENCE /* 906 */:
this.mIntegerValue = ((Integer) obj).intValue();
break;
case TypedValues.Custom.TYPE_FLOAT /* 901 */:
this.mFloatValue = ((Float) obj).floatValue();
break;
case TypedValues.Custom.TYPE_COLOR /* 902 */:
this.mIntegerValue = ((Integer) obj).intValue();
break;
case TypedValues.Custom.TYPE_STRING /* 903 */:
this.mStringValue = (String) obj;
break;
case TypedValues.Custom.TYPE_BOOLEAN /* 904 */:
this.mBooleanValue = ((Boolean) obj).booleanValue();
break;
case TypedValues.Custom.TYPE_DIMENSION /* 905 */:
this.mFloatValue = ((Float) obj).floatValue();
break;
}
}
public int getInterpolatedColor(float[] fArr) {
return (clamp((int) (fArr[3] * 255.0f)) << 24) | (clamp((int) (((float) Math.pow(fArr[0], 0.45454545454545453d)) * 255.0f)) << 16) | (clamp((int) (((float) Math.pow(fArr[1], 0.45454545454545453d)) * 255.0f)) << 8) | clamp((int) (((float) Math.pow(fArr[2], 0.45454545454545453d)) * 255.0f));
}
public void setInterpolatedValue(MotionWidget motionWidget, float[] fArr) {
int i = this.mType;
switch (i) {
case TypedValues.Custom.TYPE_INT /* 900 */:
motionWidget.setCustomAttribute(this.mName, i, (int) fArr[0]);
return;
case TypedValues.Custom.TYPE_FLOAT /* 901 */:
case TypedValues.Custom.TYPE_DIMENSION /* 905 */:
motionWidget.setCustomAttribute(this.mName, i, fArr[0]);
return;
case TypedValues.Custom.TYPE_COLOR /* 902 */:
motionWidget.setCustomAttribute(this.mName, this.mType, (clamp((int) (fArr[3] * 255.0f)) << 24) | (clamp((int) (((float) Math.pow(fArr[0], 0.45454545454545453d)) * 255.0f)) << 16) | (clamp((int) (((float) Math.pow(fArr[1], 0.45454545454545453d)) * 255.0f)) << 8) | clamp((int) (((float) Math.pow(fArr[2], 0.45454545454545453d)) * 255.0f)));
return;
case TypedValues.Custom.TYPE_STRING /* 903 */:
case TypedValues.Custom.TYPE_REFERENCE /* 906 */:
throw new RuntimeException("unable to interpolate " + this.mName);
case TypedValues.Custom.TYPE_BOOLEAN /* 904 */:
motionWidget.setCustomAttribute(this.mName, i, fArr[0] > 0.5f);
return;
default:
return;
}
}
public static int rgbaTocColor(float f, float f2, float f3, float f4) {
int clamp = clamp((int) (f * 255.0f));
int clamp2 = clamp((int) (f2 * 255.0f));
return (clamp << 16) | (clamp((int) (f4 * 255.0f)) << 24) | (clamp2 << 8) | clamp((int) (f3 * 255.0f));
}
public void applyToWidget(MotionWidget motionWidget) {
int i = this.mType;
switch (i) {
case TypedValues.Custom.TYPE_INT /* 900 */:
case TypedValues.Custom.TYPE_COLOR /* 902 */:
case TypedValues.Custom.TYPE_REFERENCE /* 906 */:
motionWidget.setCustomAttribute(this.mName, i, this.mIntegerValue);
break;
case TypedValues.Custom.TYPE_FLOAT /* 901 */:
case TypedValues.Custom.TYPE_DIMENSION /* 905 */:
motionWidget.setCustomAttribute(this.mName, i, this.mFloatValue);
break;
case TypedValues.Custom.TYPE_STRING /* 903 */:
motionWidget.setCustomAttribute(this.mName, i, this.mStringValue);
break;
case TypedValues.Custom.TYPE_BOOLEAN /* 904 */:
motionWidget.setCustomAttribute(this.mName, i, this.mBooleanValue);
break;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,351 @@
package androidx.constraintlayout.core.motion;
import androidx.constraintlayout.core.motion.utils.Easing;
import androidx.constraintlayout.core.motion.utils.Rect;
import androidx.constraintlayout.core.motion.utils.SplineSet;
import androidx.constraintlayout.core.motion.utils.Utils;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
/* loaded from: classes.dex */
class MotionConstrainedPoint implements Comparable<MotionConstrainedPoint> {
static final int CARTESIAN = 2;
public static final boolean DEBUG = false;
static final int PERPENDICULAR = 1;
public static final String TAG = "MotionPaths";
static String[] names = {"position", "x", "y", "width", "height", "pathRotate"};
private float height;
private Easing mKeyFrameEasing;
private float position;
int visibility;
private float width;
private float x;
private float y;
private float alpha = 1.0f;
int mVisibilityMode = 0;
private boolean applyElevation = false;
private float elevation = 0.0f;
private float rotation = 0.0f;
private float rotationX = 0.0f;
public float rotationY = 0.0f;
private float scaleX = 1.0f;
private float scaleY = 1.0f;
private float mPivotX = Float.NaN;
private float mPivotY = Float.NaN;
private float translationX = 0.0f;
private float translationY = 0.0f;
private float translationZ = 0.0f;
private int mDrawPath = 0;
private float mPathRotate = Float.NaN;
private float mProgress = Float.NaN;
private int mAnimateRelativeTo = -1;
LinkedHashMap<String, CustomVariable> mCustomVariable = new LinkedHashMap<>();
int mMode = 0;
double[] mTempValue = new double[18];
double[] mTempDelta = new double[18];
void setBounds(float f, float f2, float f3, float f4) {
this.x = f;
this.y = f2;
this.width = f3;
this.height = f4;
}
private boolean diff(float f, float f2) {
return (Float.isNaN(f) || Float.isNaN(f2)) ? Float.isNaN(f) != Float.isNaN(f2) : Math.abs(f - f2) > 1.0E-6f;
}
void different(MotionConstrainedPoint motionConstrainedPoint, HashSet<String> hashSet) {
if (diff(this.alpha, motionConstrainedPoint.alpha)) {
hashSet.add("alpha");
}
if (diff(this.elevation, motionConstrainedPoint.elevation)) {
hashSet.add("translationZ");
}
int i = this.visibility;
int i2 = motionConstrainedPoint.visibility;
if (i != i2 && this.mVisibilityMode == 0 && (i == 4 || i2 == 4)) {
hashSet.add("alpha");
}
if (diff(this.rotation, motionConstrainedPoint.rotation)) {
hashSet.add("rotationZ");
}
if (!Float.isNaN(this.mPathRotate) || !Float.isNaN(motionConstrainedPoint.mPathRotate)) {
hashSet.add("pathRotate");
}
if (!Float.isNaN(this.mProgress) || !Float.isNaN(motionConstrainedPoint.mProgress)) {
hashSet.add("progress");
}
if (diff(this.rotationX, motionConstrainedPoint.rotationX)) {
hashSet.add("rotationX");
}
if (diff(this.rotationY, motionConstrainedPoint.rotationY)) {
hashSet.add("rotationY");
}
if (diff(this.mPivotX, motionConstrainedPoint.mPivotX)) {
hashSet.add("pivotX");
}
if (diff(this.mPivotY, motionConstrainedPoint.mPivotY)) {
hashSet.add("pivotY");
}
if (diff(this.scaleX, motionConstrainedPoint.scaleX)) {
hashSet.add("scaleX");
}
if (diff(this.scaleY, motionConstrainedPoint.scaleY)) {
hashSet.add("scaleY");
}
if (diff(this.translationX, motionConstrainedPoint.translationX)) {
hashSet.add("translationX");
}
if (diff(this.translationY, motionConstrainedPoint.translationY)) {
hashSet.add("translationY");
}
if (diff(this.translationZ, motionConstrainedPoint.translationZ)) {
hashSet.add("translationZ");
}
if (diff(this.elevation, motionConstrainedPoint.elevation)) {
hashSet.add("elevation");
}
}
void different(MotionConstrainedPoint motionConstrainedPoint, boolean[] zArr, String[] strArr) {
zArr[0] = zArr[0] | diff(this.position, motionConstrainedPoint.position);
zArr[1] = zArr[1] | diff(this.x, motionConstrainedPoint.x);
zArr[2] = zArr[2] | diff(this.y, motionConstrainedPoint.y);
zArr[3] = zArr[3] | diff(this.width, motionConstrainedPoint.width);
zArr[4] = diff(this.height, motionConstrainedPoint.height) | zArr[4];
}
void fillStandard(double[] dArr, int[] iArr) {
float[] fArr = {this.position, this.x, this.y, this.width, this.height, this.alpha, this.elevation, this.rotation, this.rotationX, this.rotationY, this.scaleX, this.scaleY, this.mPivotX, this.mPivotY, this.translationX, this.translationY, this.translationZ, this.mPathRotate};
int i = 0;
for (int i2 : iArr) {
if (i2 < 18) {
dArr[i] = fArr[r4];
i++;
}
}
}
boolean hasCustomData(String str) {
return this.mCustomVariable.containsKey(str);
}
int getCustomDataCount(String str) {
return this.mCustomVariable.get(str).numberOfInterpolatedValues();
}
int getCustomData(String str, double[] dArr, int i) {
CustomVariable customVariable = this.mCustomVariable.get(str);
if (customVariable.numberOfInterpolatedValues() == 1) {
dArr[i] = customVariable.getValueToInterpolate();
return 1;
}
int numberOfInterpolatedValues = customVariable.numberOfInterpolatedValues();
customVariable.getValuesToInterpolate(new float[numberOfInterpolatedValues]);
int i2 = 0;
while (i2 < numberOfInterpolatedValues) {
dArr[i] = r1[i2];
i2++;
i++;
}
return numberOfInterpolatedValues;
}
@Override // java.lang.Comparable
public int compareTo(MotionConstrainedPoint motionConstrainedPoint) {
return Float.compare(this.position, motionConstrainedPoint.position);
}
public void applyParameters(MotionWidget motionWidget) {
this.visibility = motionWidget.getVisibility();
this.alpha = motionWidget.getVisibility() != 4 ? 0.0f : motionWidget.getAlpha();
this.applyElevation = false;
this.rotation = motionWidget.getRotationZ();
this.rotationX = motionWidget.getRotationX();
this.rotationY = motionWidget.getRotationY();
this.scaleX = motionWidget.getScaleX();
this.scaleY = motionWidget.getScaleY();
this.mPivotX = motionWidget.getPivotX();
this.mPivotY = motionWidget.getPivotY();
this.translationX = motionWidget.getTranslationX();
this.translationY = motionWidget.getTranslationY();
this.translationZ = motionWidget.getTranslationZ();
for (String str : motionWidget.getCustomAttributeNames()) {
CustomVariable customAttribute = motionWidget.getCustomAttribute(str);
if (customAttribute != null && customAttribute.isContinuous()) {
this.mCustomVariable.put(str, customAttribute);
}
}
}
/* JADX WARN: Failed to restore switch over string. Please report as a decompilation issue */
public void addValues(HashMap<String, SplineSet> hashMap, int i) {
for (String str : hashMap.keySet()) {
SplineSet splineSet = hashMap.get(str);
str.hashCode();
char c = 65535;
switch (str.hashCode()) {
case -1249320806:
if (str.equals("rotationX")) {
c = 0;
break;
}
break;
case -1249320805:
if (str.equals("rotationY")) {
c = 1;
break;
}
break;
case -1249320804:
if (str.equals("rotationZ")) {
c = 2;
break;
}
break;
case -1225497657:
if (str.equals("translationX")) {
c = 3;
break;
}
break;
case -1225497656:
if (str.equals("translationY")) {
c = 4;
break;
}
break;
case -1225497655:
if (str.equals("translationZ")) {
c = 5;
break;
}
break;
case -1001078227:
if (str.equals("progress")) {
c = 6;
break;
}
break;
case -987906986:
if (str.equals("pivotX")) {
c = 7;
break;
}
break;
case -987906985:
if (str.equals("pivotY")) {
c = '\b';
break;
}
break;
case -908189618:
if (str.equals("scaleX")) {
c = '\t';
break;
}
break;
case -908189617:
if (str.equals("scaleY")) {
c = '\n';
break;
}
break;
case 92909918:
if (str.equals("alpha")) {
c = 11;
break;
}
break;
case 803192288:
if (str.equals("pathRotate")) {
c = '\f';
break;
}
break;
}
switch (c) {
case 0:
splineSet.setPoint(i, Float.isNaN(this.rotationX) ? 0.0f : this.rotationX);
break;
case 1:
splineSet.setPoint(i, Float.isNaN(this.rotationY) ? 0.0f : this.rotationY);
break;
case 2:
splineSet.setPoint(i, Float.isNaN(this.rotation) ? 0.0f : this.rotation);
break;
case 3:
splineSet.setPoint(i, Float.isNaN(this.translationX) ? 0.0f : this.translationX);
break;
case 4:
splineSet.setPoint(i, Float.isNaN(this.translationY) ? 0.0f : this.translationY);
break;
case 5:
splineSet.setPoint(i, Float.isNaN(this.translationZ) ? 0.0f : this.translationZ);
break;
case 6:
splineSet.setPoint(i, Float.isNaN(this.mProgress) ? 0.0f : this.mProgress);
break;
case 7:
splineSet.setPoint(i, Float.isNaN(this.mPivotX) ? 0.0f : this.mPivotX);
break;
case '\b':
splineSet.setPoint(i, Float.isNaN(this.mPivotY) ? 0.0f : this.mPivotY);
break;
case '\t':
splineSet.setPoint(i, Float.isNaN(this.scaleX) ? 1.0f : this.scaleX);
break;
case '\n':
splineSet.setPoint(i, Float.isNaN(this.scaleY) ? 1.0f : this.scaleY);
break;
case 11:
splineSet.setPoint(i, Float.isNaN(this.alpha) ? 1.0f : this.alpha);
break;
case '\f':
splineSet.setPoint(i, Float.isNaN(this.mPathRotate) ? 0.0f : this.mPathRotate);
break;
default:
if (!str.startsWith("CUSTOM")) {
Utils.loge("MotionPaths", "UNKNOWN spline " + str);
break;
} else {
String str2 = str.split(",")[1];
if (this.mCustomVariable.containsKey(str2)) {
CustomVariable customVariable = this.mCustomVariable.get(str2);
if (splineSet instanceof SplineSet.CustomSpline) {
((SplineSet.CustomSpline) splineSet).setPoint(i, customVariable);
break;
} else {
Utils.loge("MotionPaths", str + " ViewSpline not a CustomSet frame = " + i + ", value" + customVariable.getValueToInterpolate() + splineSet);
break;
}
} else {
break;
}
}
}
}
}
public void setState(MotionWidget motionWidget) {
setBounds(motionWidget.getX(), motionWidget.getY(), motionWidget.getWidth(), motionWidget.getHeight());
applyParameters(motionWidget);
}
public void setState(Rect rect, MotionWidget motionWidget, int i, float f) {
setBounds(rect.left, rect.top, rect.width(), rect.height());
applyParameters(motionWidget);
this.mPivotX = Float.NaN;
this.mPivotY = Float.NaN;
if (i == 1) {
this.rotation = f - 90.0f;
} else {
if (i != 2) {
return;
}
this.rotation = f + 90.0f;
}
}
}

View File

@ -0,0 +1,676 @@
package androidx.constraintlayout.core.motion;
import androidx.constraintlayout.core.motion.key.MotionKeyPosition;
import androidx.constraintlayout.core.motion.utils.Easing;
import java.util.Arrays;
import java.util.HashMap;
/* loaded from: classes.dex */
public class MotionPaths implements Comparable<MotionPaths> {
public static final int CARTESIAN = 0;
public static final boolean DEBUG = false;
static final int OFF_HEIGHT = 4;
static final int OFF_PATH_ROTATE = 5;
static final int OFF_POSITION = 0;
static final int OFF_WIDTH = 3;
static final int OFF_X = 1;
static final int OFF_Y = 2;
public static final boolean OLD_WAY = false;
public static final int PERPENDICULAR = 1;
public static final int SCREEN = 2;
public static final String TAG = "MotionPaths";
static String[] names = {"position", "x", "y", "width", "height", "pathRotate"};
HashMap<String, CustomVariable> customAttributes;
float height;
int mAnimateCircleAngleTo;
int mAnimateRelativeTo;
int mDrawPath;
Easing mKeyFrameEasing;
int mMode;
int mPathMotionArc;
float mPathRotate;
float mProgress;
float mRelativeAngle;
Motion mRelativeToController;
double[] mTempDelta;
double[] mTempValue;
float position;
float time;
float width;
float x;
float y;
private static final float xRotate(float f, float f2, float f3, float f4, float f5, float f6) {
return (((f5 - f3) * f2) - ((f6 - f4) * f)) + f3;
}
private static final float yRotate(float f, float f2, float f3, float f4, float f5, float f6) {
return ((f5 - f3) * f) + ((f6 - f4) * f2) + f4;
}
void setBounds(float f, float f2, float f3, float f4) {
this.x = f;
this.y = f2;
this.width = f3;
this.height = f4;
}
public MotionPaths() {
this.mDrawPath = 0;
this.mPathRotate = Float.NaN;
this.mProgress = Float.NaN;
this.mPathMotionArc = -1;
this.mAnimateRelativeTo = -1;
this.mRelativeAngle = Float.NaN;
this.mRelativeToController = null;
this.customAttributes = new HashMap<>();
this.mMode = 0;
this.mTempValue = new double[18];
this.mTempDelta = new double[18];
}
void initCartesian(MotionKeyPosition motionKeyPosition, MotionPaths motionPaths, MotionPaths motionPaths2) {
float f = motionKeyPosition.mFramePosition / 100.0f;
this.time = f;
this.mDrawPath = motionKeyPosition.mDrawPath;
float f2 = Float.isNaN(motionKeyPosition.mPercentWidth) ? f : motionKeyPosition.mPercentWidth;
float f3 = Float.isNaN(motionKeyPosition.mPercentHeight) ? f : motionKeyPosition.mPercentHeight;
float f4 = motionPaths2.width;
float f5 = motionPaths.width;
float f6 = motionPaths2.height;
float f7 = motionPaths.height;
this.position = this.time;
float f8 = motionPaths.x;
float f9 = motionPaths.y;
float f10 = (motionPaths2.x + (f4 / 2.0f)) - ((f5 / 2.0f) + f8);
float f11 = (motionPaths2.y + (f6 / 2.0f)) - (f9 + (f7 / 2.0f));
float f12 = ((f4 - f5) * f2) / 2.0f;
this.x = (int) ((f8 + (f10 * f)) - f12);
float f13 = ((f6 - f7) * f3) / 2.0f;
this.y = (int) ((f9 + (f11 * f)) - f13);
this.width = (int) (f5 + r9);
this.height = (int) (f7 + r12);
float f14 = Float.isNaN(motionKeyPosition.mPercentX) ? f : motionKeyPosition.mPercentX;
float f15 = Float.isNaN(motionKeyPosition.mAltPercentY) ? 0.0f : motionKeyPosition.mAltPercentY;
if (!Float.isNaN(motionKeyPosition.mPercentY)) {
f = motionKeyPosition.mPercentY;
}
float f16 = Float.isNaN(motionKeyPosition.mAltPercentX) ? 0.0f : motionKeyPosition.mAltPercentX;
this.mMode = 0;
this.x = (int) (((motionPaths.x + (f14 * f10)) + (f16 * f11)) - f12);
this.y = (int) (((motionPaths.y + (f10 * f15)) + (f11 * f)) - f13);
this.mKeyFrameEasing = Easing.getInterpolator(motionKeyPosition.mTransitionEasing);
this.mPathMotionArc = motionKeyPosition.mPathMotionArc;
}
public MotionPaths(int i, int i2, MotionKeyPosition motionKeyPosition, MotionPaths motionPaths, MotionPaths motionPaths2) {
this.mDrawPath = 0;
this.mPathRotate = Float.NaN;
this.mProgress = Float.NaN;
this.mPathMotionArc = -1;
this.mAnimateRelativeTo = -1;
this.mRelativeAngle = Float.NaN;
this.mRelativeToController = null;
this.customAttributes = new HashMap<>();
this.mMode = 0;
this.mTempValue = new double[18];
this.mTempDelta = new double[18];
if (motionPaths.mAnimateRelativeTo != -1) {
initPolar(i, i2, motionKeyPosition, motionPaths, motionPaths2);
return;
}
int i3 = motionKeyPosition.mPositionType;
if (i3 == 1) {
initPath(motionKeyPosition, motionPaths, motionPaths2);
} else if (i3 == 2) {
initScreen(i, i2, motionKeyPosition, motionPaths, motionPaths2);
} else {
initCartesian(motionKeyPosition, motionPaths, motionPaths2);
}
}
void initPolar(int i, int i2, MotionKeyPosition motionKeyPosition, MotionPaths motionPaths, MotionPaths motionPaths2) {
float min;
float f;
float f2 = motionKeyPosition.mFramePosition / 100.0f;
this.time = f2;
this.mDrawPath = motionKeyPosition.mDrawPath;
this.mMode = motionKeyPosition.mPositionType;
float f3 = Float.isNaN(motionKeyPosition.mPercentWidth) ? f2 : motionKeyPosition.mPercentWidth;
float f4 = Float.isNaN(motionKeyPosition.mPercentHeight) ? f2 : motionKeyPosition.mPercentHeight;
float f5 = motionPaths2.width;
float f6 = motionPaths.width;
float f7 = motionPaths2.height;
float f8 = motionPaths.height;
this.position = this.time;
this.width = (int) (f6 + ((f5 - f6) * f3));
this.height = (int) (f8 + ((f7 - f8) * f4));
int i3 = motionKeyPosition.mPositionType;
if (i3 == 1) {
float f9 = Float.isNaN(motionKeyPosition.mPercentX) ? f2 : motionKeyPosition.mPercentX;
float f10 = motionPaths2.x;
float f11 = motionPaths.x;
this.x = (f9 * (f10 - f11)) + f11;
if (!Float.isNaN(motionKeyPosition.mPercentY)) {
f2 = motionKeyPosition.mPercentY;
}
float f12 = motionPaths2.y;
float f13 = motionPaths.y;
this.y = (f2 * (f12 - f13)) + f13;
} else if (i3 == 2) {
if (Float.isNaN(motionKeyPosition.mPercentX)) {
float f14 = motionPaths2.x;
float f15 = motionPaths.x;
min = ((f14 - f15) * f2) + f15;
} else {
min = Math.min(f4, f3) * motionKeyPosition.mPercentX;
}
this.x = min;
if (Float.isNaN(motionKeyPosition.mPercentY)) {
float f16 = motionPaths2.y;
float f17 = motionPaths.y;
f = (f2 * (f16 - f17)) + f17;
} else {
f = motionKeyPosition.mPercentY;
}
this.y = f;
} else {
float f18 = Float.isNaN(motionKeyPosition.mPercentX) ? f2 : motionKeyPosition.mPercentX;
float f19 = motionPaths2.x;
float f20 = motionPaths.x;
this.x = (f18 * (f19 - f20)) + f20;
if (!Float.isNaN(motionKeyPosition.mPercentY)) {
f2 = motionKeyPosition.mPercentY;
}
float f21 = motionPaths2.y;
float f22 = motionPaths.y;
this.y = (f2 * (f21 - f22)) + f22;
}
this.mAnimateRelativeTo = motionPaths.mAnimateRelativeTo;
this.mKeyFrameEasing = Easing.getInterpolator(motionKeyPosition.mTransitionEasing);
this.mPathMotionArc = motionKeyPosition.mPathMotionArc;
}
public void setupRelative(Motion motion, MotionPaths motionPaths) {
double d = ((this.x + (this.width / 2.0f)) - motionPaths.x) - (motionPaths.width / 2.0f);
double d2 = ((this.y + (this.height / 2.0f)) - motionPaths.y) - (motionPaths.height / 2.0f);
this.mRelativeToController = motion;
this.x = (float) Math.hypot(d2, d);
if (Float.isNaN(this.mRelativeAngle)) {
this.y = (float) (Math.atan2(d2, d) + 1.5707963267948966d);
} else {
this.y = (float) Math.toRadians(this.mRelativeAngle);
}
}
void initScreen(int i, int i2, MotionKeyPosition motionKeyPosition, MotionPaths motionPaths, MotionPaths motionPaths2) {
float f = motionKeyPosition.mFramePosition / 100.0f;
this.time = f;
this.mDrawPath = motionKeyPosition.mDrawPath;
float f2 = Float.isNaN(motionKeyPosition.mPercentWidth) ? f : motionKeyPosition.mPercentWidth;
float f3 = Float.isNaN(motionKeyPosition.mPercentHeight) ? f : motionKeyPosition.mPercentHeight;
float f4 = motionPaths2.width;
float f5 = motionPaths.width;
float f6 = motionPaths2.height;
float f7 = motionPaths.height;
this.position = this.time;
float f8 = motionPaths.x;
float f9 = motionPaths.y;
float f10 = motionPaths2.x + (f4 / 2.0f);
float f11 = motionPaths2.y + (f6 / 2.0f);
float f12 = (f4 - f5) * f2;
this.x = (int) ((f8 + ((f10 - ((f5 / 2.0f) + f8)) * f)) - (f12 / 2.0f));
float f13 = (f6 - f7) * f3;
this.y = (int) ((f9 + ((f11 - (f9 + (f7 / 2.0f))) * f)) - (f13 / 2.0f));
this.width = (int) (f5 + f12);
this.height = (int) (f7 + f13);
this.mMode = 2;
if (!Float.isNaN(motionKeyPosition.mPercentX)) {
this.x = (int) (motionKeyPosition.mPercentX * ((int) (i - this.width)));
}
if (!Float.isNaN(motionKeyPosition.mPercentY)) {
this.y = (int) (motionKeyPosition.mPercentY * ((int) (i2 - this.height)));
}
this.mAnimateRelativeTo = this.mAnimateRelativeTo;
this.mKeyFrameEasing = Easing.getInterpolator(motionKeyPosition.mTransitionEasing);
this.mPathMotionArc = motionKeyPosition.mPathMotionArc;
}
void initPath(MotionKeyPosition motionKeyPosition, MotionPaths motionPaths, MotionPaths motionPaths2) {
float f = motionKeyPosition.mFramePosition / 100.0f;
this.time = f;
this.mDrawPath = motionKeyPosition.mDrawPath;
float f2 = Float.isNaN(motionKeyPosition.mPercentWidth) ? f : motionKeyPosition.mPercentWidth;
float f3 = Float.isNaN(motionKeyPosition.mPercentHeight) ? f : motionKeyPosition.mPercentHeight;
float f4 = motionPaths2.width - motionPaths.width;
float f5 = motionPaths2.height - motionPaths.height;
this.position = this.time;
if (!Float.isNaN(motionKeyPosition.mPercentX)) {
f = motionKeyPosition.mPercentX;
}
float f6 = motionPaths.x;
float f7 = motionPaths.width;
float f8 = motionPaths.y;
float f9 = motionPaths.height;
float f10 = (motionPaths2.x + (motionPaths2.width / 2.0f)) - ((f7 / 2.0f) + f6);
float f11 = (motionPaths2.y + (motionPaths2.height / 2.0f)) - ((f9 / 2.0f) + f8);
float f12 = f10 * f;
float f13 = (f4 * f2) / 2.0f;
this.x = (int) ((f6 + f12) - f13);
float f14 = f * f11;
float f15 = (f5 * f3) / 2.0f;
this.y = (int) ((f8 + f14) - f15);
this.width = (int) (f7 + r7);
this.height = (int) (f9 + r8);
float f16 = Float.isNaN(motionKeyPosition.mPercentY) ? 0.0f : motionKeyPosition.mPercentY;
this.mMode = 1;
float f17 = (int) ((motionPaths.x + f12) - f13);
this.x = f17;
float f18 = (int) ((motionPaths.y + f14) - f15);
this.x = f17 + ((-f11) * f16);
this.y = f18 + (f10 * f16);
this.mAnimateRelativeTo = this.mAnimateRelativeTo;
this.mKeyFrameEasing = Easing.getInterpolator(motionKeyPosition.mTransitionEasing);
this.mPathMotionArc = motionKeyPosition.mPathMotionArc;
}
private boolean diff(float f, float f2) {
return (Float.isNaN(f) || Float.isNaN(f2)) ? Float.isNaN(f) != Float.isNaN(f2) : Math.abs(f - f2) > 1.0E-6f;
}
void different(MotionPaths motionPaths, boolean[] zArr, String[] strArr, boolean z) {
boolean diff = diff(this.x, motionPaths.x);
boolean diff2 = diff(this.y, motionPaths.y);
zArr[0] = zArr[0] | diff(this.position, motionPaths.position);
boolean z2 = diff | diff2 | z;
zArr[1] = zArr[1] | z2;
zArr[2] = z2 | zArr[2];
zArr[3] = zArr[3] | diff(this.width, motionPaths.width);
zArr[4] = diff(this.height, motionPaths.height) | zArr[4];
}
void getCenter(double d, int[] iArr, double[] dArr, float[] fArr, int i) {
float f = this.x;
float f2 = this.y;
float f3 = this.width;
float f4 = this.height;
for (int i2 = 0; i2 < iArr.length; i2++) {
float f5 = (float) dArr[i2];
int i3 = iArr[i2];
if (i3 == 1) {
f = f5;
} else if (i3 == 2) {
f2 = f5;
} else if (i3 == 3) {
f3 = f5;
} else if (i3 == 4) {
f4 = f5;
}
}
Motion motion = this.mRelativeToController;
if (motion != null) {
float[] fArr2 = new float[2];
motion.getCenter(d, fArr2, new float[2]);
float f6 = fArr2[0];
float f7 = fArr2[1];
double d2 = f6;
double d3 = f;
double d4 = f2;
f = (float) ((d2 + (Math.sin(d4) * d3)) - (f3 / 2.0f));
f2 = (float) ((f7 - (d3 * Math.cos(d4))) - (f4 / 2.0f));
}
fArr[i] = f + (f3 / 2.0f) + 0.0f;
fArr[i + 1] = f2 + (f4 / 2.0f) + 0.0f;
}
void getCenter(double d, int[] iArr, double[] dArr, float[] fArr, double[] dArr2, float[] fArr2) {
float f;
float f2 = this.x;
float f3 = this.y;
float f4 = this.width;
float f5 = this.height;
float f6 = 0.0f;
float f7 = 0.0f;
float f8 = 0.0f;
float f9 = 0.0f;
for (int i = 0; i < iArr.length; i++) {
float f10 = (float) dArr[i];
float f11 = (float) dArr2[i];
int i2 = iArr[i];
if (i2 == 1) {
f2 = f10;
f6 = f11;
} else if (i2 == 2) {
f3 = f10;
f8 = f11;
} else if (i2 == 3) {
f4 = f10;
f7 = f11;
} else if (i2 == 4) {
f5 = f10;
f9 = f11;
}
}
float f12 = 2.0f;
float f13 = (f7 / 2.0f) + f6;
float f14 = (f9 / 2.0f) + f8;
Motion motion = this.mRelativeToController;
if (motion != null) {
float[] fArr3 = new float[2];
float[] fArr4 = new float[2];
motion.getCenter(d, fArr3, fArr4);
float f15 = fArr3[0];
float f16 = fArr3[1];
float f17 = fArr4[0];
float f18 = fArr4[1];
double d2 = f2;
double d3 = f3;
f = f4;
float sin = (float) ((f15 + (Math.sin(d3) * d2)) - (f4 / 2.0f));
float cos = (float) ((f16 - (d2 * Math.cos(d3))) - (f5 / 2.0f));
double d4 = f6;
double d5 = f8;
float sin2 = (float) (f17 + (Math.sin(d3) * d4) + (Math.cos(d3) * d5));
f14 = (float) ((f18 - (d4 * Math.cos(d3))) + (Math.sin(d3) * d5));
f13 = sin2;
f2 = sin;
f3 = cos;
f12 = 2.0f;
} else {
f = f4;
}
fArr[0] = f2 + (f / f12) + 0.0f;
fArr[1] = f3 + (f5 / f12) + 0.0f;
fArr2[0] = f13;
fArr2[1] = f14;
}
void getCenterVelocity(double d, int[] iArr, double[] dArr, float[] fArr, int i) {
float f = this.x;
float f2 = this.y;
float f3 = this.width;
float f4 = this.height;
for (int i2 = 0; i2 < iArr.length; i2++) {
float f5 = (float) dArr[i2];
int i3 = iArr[i2];
if (i3 == 1) {
f = f5;
} else if (i3 == 2) {
f2 = f5;
} else if (i3 == 3) {
f3 = f5;
} else if (i3 == 4) {
f4 = f5;
}
}
Motion motion = this.mRelativeToController;
if (motion != null) {
float[] fArr2 = new float[2];
motion.getCenter(d, fArr2, new float[2]);
float f6 = fArr2[0];
float f7 = fArr2[1];
double d2 = f6;
double d3 = f;
double d4 = f2;
f = (float) ((d2 + (Math.sin(d4) * d3)) - (f3 / 2.0f));
f2 = (float) ((f7 - (d3 * Math.cos(d4))) - (f4 / 2.0f));
}
fArr[i] = f + (f3 / 2.0f) + 0.0f;
fArr[i + 1] = f2 + (f4 / 2.0f) + 0.0f;
}
void getBounds(int[] iArr, double[] dArr, float[] fArr, int i) {
float f = this.width;
float f2 = this.height;
for (int i2 = 0; i2 < iArr.length; i2++) {
float f3 = (float) dArr[i2];
int i3 = iArr[i2];
if (i3 == 3) {
f = f3;
} else if (i3 == 4) {
f2 = f3;
}
}
fArr[i] = f;
fArr[i + 1] = f2;
}
void setView(float f, MotionWidget motionWidget, int[] iArr, double[] dArr, double[] dArr2, double[] dArr3) {
float f2;
float f3;
float f4 = this.x;
float f5 = this.y;
float f6 = this.width;
float f7 = this.height;
if (iArr.length != 0 && this.mTempValue.length <= iArr[iArr.length - 1]) {
int i = iArr[iArr.length - 1] + 1;
this.mTempValue = new double[i];
this.mTempDelta = new double[i];
}
Arrays.fill(this.mTempValue, Double.NaN);
for (int i2 = 0; i2 < iArr.length; i2++) {
double[] dArr4 = this.mTempValue;
int i3 = iArr[i2];
dArr4[i3] = dArr[i2];
this.mTempDelta[i3] = dArr2[i2];
}
float f8 = Float.NaN;
int i4 = 0;
float f9 = 0.0f;
float f10 = 0.0f;
float f11 = 0.0f;
float f12 = 0.0f;
while (true) {
double[] dArr5 = this.mTempValue;
if (i4 >= dArr5.length) {
break;
}
if (Double.isNaN(dArr5[i4]) && (dArr3 == null || dArr3[i4] == 0.0d)) {
f3 = f8;
} else {
double d = dArr3 != null ? dArr3[i4] : 0.0d;
if (!Double.isNaN(this.mTempValue[i4])) {
d = this.mTempValue[i4] + d;
}
f3 = f8;
float f13 = (float) d;
float f14 = (float) this.mTempDelta[i4];
if (i4 == 1) {
f8 = f3;
f9 = f14;
f4 = f13;
} else if (i4 == 2) {
f8 = f3;
f10 = f14;
f5 = f13;
} else if (i4 == 3) {
f8 = f3;
f11 = f14;
f6 = f13;
} else if (i4 == 4) {
f8 = f3;
f12 = f14;
f7 = f13;
} else if (i4 == 5) {
f8 = f13;
}
i4++;
}
f8 = f3;
i4++;
}
float f15 = f8;
Motion motion = this.mRelativeToController;
if (motion != null) {
float[] fArr = new float[2];
float[] fArr2 = new float[2];
motion.getCenter(f, fArr, fArr2);
float f16 = fArr[0];
float f17 = fArr[1];
float f18 = fArr2[0];
float f19 = fArr2[1];
double d2 = f4;
double d3 = f5;
float sin = (float) ((f16 + (Math.sin(d3) * d2)) - (f6 / 2.0f));
f2 = f7;
float cos = (float) ((f17 - (Math.cos(d3) * d2)) - (f7 / 2.0f));
double d4 = f9;
double d5 = f10;
float sin2 = (float) (f18 + (Math.sin(d3) * d4) + (Math.cos(d3) * d2 * d5));
float cos2 = (float) ((f19 - (d4 * Math.cos(d3))) + (d2 * Math.sin(d3) * d5));
if (dArr2.length >= 2) {
dArr2[0] = sin2;
dArr2[1] = cos2;
}
if (!Float.isNaN(f15)) {
motionWidget.setRotationZ((float) (f15 + Math.toDegrees(Math.atan2(cos2, sin2))));
}
f4 = sin;
f5 = cos;
} else {
f2 = f7;
if (!Float.isNaN(f15)) {
motionWidget.setRotationZ((float) (0.0f + f15 + Math.toDegrees(Math.atan2(f10 + (f12 / 2.0f), f9 + (f11 / 2.0f)))));
}
}
float f20 = f4 + 0.5f;
float f21 = f5 + 0.5f;
motionWidget.layout((int) f20, (int) f21, (int) (f20 + f6), (int) (f21 + f2));
}
void getRect(int[] iArr, double[] dArr, float[] fArr, int i) {
float f = this.x;
float f2 = this.y;
float f3 = this.width;
float f4 = this.height;
for (int i2 = 0; i2 < iArr.length; i2++) {
float f5 = (float) dArr[i2];
int i3 = iArr[i2];
if (i3 == 1) {
f = f5;
} else if (i3 == 2) {
f2 = f5;
} else if (i3 == 3) {
f3 = f5;
} else if (i3 == 4) {
f4 = f5;
}
}
Motion motion = this.mRelativeToController;
if (motion != null) {
float centerX = motion.getCenterX();
float centerY = this.mRelativeToController.getCenterY();
double d = f;
double d2 = f2;
float sin = (float) ((centerX + (Math.sin(d2) * d)) - (f3 / 2.0f));
f2 = (float) ((centerY - (d * Math.cos(d2))) - (f4 / 2.0f));
f = sin;
}
float f6 = f3 + f;
float f7 = f4 + f2;
Float.isNaN(Float.NaN);
Float.isNaN(Float.NaN);
fArr[i] = f + 0.0f;
fArr[i + 1] = f2 + 0.0f;
fArr[i + 2] = f6 + 0.0f;
fArr[i + 3] = f2 + 0.0f;
fArr[i + 4] = f6 + 0.0f;
fArr[i + 5] = f7 + 0.0f;
fArr[i + 6] = f + 0.0f;
fArr[i + 7] = f7 + 0.0f;
}
void setDpDt(float f, float f2, float[] fArr, int[] iArr, double[] dArr, double[] dArr2) {
float f3 = 0.0f;
float f4 = 0.0f;
float f5 = 0.0f;
float f6 = 0.0f;
for (int i = 0; i < iArr.length; i++) {
float f7 = (float) dArr[i];
double d = dArr2[i];
int i2 = iArr[i];
if (i2 == 1) {
f3 = f7;
} else if (i2 == 2) {
f5 = f7;
} else if (i2 == 3) {
f4 = f7;
} else if (i2 == 4) {
f6 = f7;
}
}
float f8 = f3 - ((0.0f * f4) / 2.0f);
float f9 = f5 - ((0.0f * f6) / 2.0f);
fArr[0] = (f8 * (1.0f - f)) + (((f4 * 1.0f) + f8) * f) + 0.0f;
fArr[1] = (f9 * (1.0f - f2)) + (((f6 * 1.0f) + f9) * f2) + 0.0f;
}
void fillStandard(double[] dArr, int[] iArr) {
float[] fArr = {this.position, this.x, this.y, this.width, this.height, this.mPathRotate};
int i = 0;
for (int i2 : iArr) {
if (i2 < 6) {
dArr[i] = fArr[r4];
i++;
}
}
}
boolean hasCustomData(String str) {
return this.customAttributes.containsKey(str);
}
int getCustomDataCount(String str) {
CustomVariable customVariable = this.customAttributes.get(str);
if (customVariable == null) {
return 0;
}
return customVariable.numberOfInterpolatedValues();
}
int getCustomData(String str, double[] dArr, int i) {
CustomVariable customVariable = this.customAttributes.get(str);
int i2 = 0;
if (customVariable == null) {
return 0;
}
if (customVariable.numberOfInterpolatedValues() == 1) {
dArr[i] = customVariable.getValueToInterpolate();
return 1;
}
int numberOfInterpolatedValues = customVariable.numberOfInterpolatedValues();
customVariable.getValuesToInterpolate(new float[numberOfInterpolatedValues]);
while (i2 < numberOfInterpolatedValues) {
dArr[i] = r2[i2];
i2++;
i++;
}
return numberOfInterpolatedValues;
}
@Override // java.lang.Comparable
public int compareTo(MotionPaths motionPaths) {
return Float.compare(this.position, motionPaths.position);
}
public void applyParameters(MotionWidget motionWidget) {
this.mKeyFrameEasing = Easing.getInterpolator(motionWidget.motion.mTransitionEasing);
this.mPathMotionArc = motionWidget.motion.mPathMotionArc;
this.mAnimateRelativeTo = motionWidget.motion.mAnimateRelativeTo;
this.mPathRotate = motionWidget.motion.mPathRotate;
this.mDrawPath = motionWidget.motion.mDrawPath;
this.mAnimateCircleAngleTo = motionWidget.motion.mAnimateCircleAngleTo;
this.mProgress = motionWidget.propertySet.mProgress;
this.mRelativeAngle = 0.0f;
for (String str : motionWidget.getCustomAttributeNames()) {
CustomVariable customAttribute = motionWidget.getCustomAttribute(str);
if (customAttribute != null && customAttribute.isContinuous()) {
this.customAttributes.put(str, customAttribute);
}
}
}
public void configureRelativeTo(Motion motion) {
motion.getPos(this.mProgress);
}
}

View File

@ -0,0 +1,430 @@
package androidx.constraintlayout.core.motion;
import androidx.constraintlayout.core.motion.utils.TypedValues;
import androidx.constraintlayout.core.state.WidgetFrame;
import androidx.constraintlayout.core.widgets.ConstraintWidget;
import java.util.Set;
/* loaded from: classes.dex */
public class MotionWidget implements TypedValues {
public static final int FILL_PARENT = -1;
public static final int GONE_UNSET = Integer.MIN_VALUE;
private static final int INTERNAL_MATCH_CONSTRAINT = -3;
private static final int INTERNAL_MATCH_PARENT = -1;
private static final int INTERNAL_WRAP_CONTENT = -2;
private static final int INTERNAL_WRAP_CONTENT_CONSTRAINED = -4;
public static final int INVISIBLE = 0;
public static final int MATCH_CONSTRAINT = 0;
public static final int MATCH_CONSTRAINT_WRAP = 1;
public static final int MATCH_PARENT = -1;
public static final int PARENT_ID = 0;
public static final int ROTATE_LEFT_OF_PORTRATE = 4;
public static final int ROTATE_NONE = 0;
public static final int ROTATE_PORTRATE_OF_LEFT = 2;
public static final int ROTATE_PORTRATE_OF_RIGHT = 1;
public static final int ROTATE_RIGHT_OF_PORTRATE = 3;
public static final int UNSET = -1;
public static final int VISIBILITY_MODE_IGNORE = 1;
public static final int VISIBILITY_MODE_NORMAL = 0;
public static final int VISIBLE = 4;
public static final int WRAP_CONTENT = -2;
private float mProgress;
float mTransitionPathRotate;
Motion motion;
PropertySet propertySet;
WidgetFrame widgetFrame;
public static class Motion {
private static final int INTERPOLATOR_REFERENCE_ID = -2;
private static final int INTERPOLATOR_UNDEFINED = -3;
private static final int SPLINE_STRING = -1;
public int mAnimateRelativeTo = -1;
public int mAnimateCircleAngleTo = 0;
public String mTransitionEasing = null;
public int mPathMotionArc = -1;
public int mDrawPath = 0;
public float mMotionStagger = Float.NaN;
public int mPolarRelativeTo = -1;
public float mPathRotate = Float.NaN;
public float mQuantizeMotionPhase = Float.NaN;
public int mQuantizeMotionSteps = -1;
public String mQuantizeInterpolatorString = null;
public int mQuantizeInterpolatorType = -3;
public int mQuantizeInterpolatorID = -1;
}
public static class PropertySet {
public int visibility = 4;
public int mVisibilityMode = 0;
public float alpha = 1.0f;
public float mProgress = Float.NaN;
}
public MotionWidget findViewById(int i) {
return null;
}
public MotionWidget getParent() {
return null;
}
public WidgetFrame getWidgetFrame() {
return this.widgetFrame;
}
@Override // androidx.constraintlayout.core.motion.utils.TypedValues
public boolean setValue(int i, boolean z) {
return false;
}
public MotionWidget() {
this.widgetFrame = new WidgetFrame();
this.motion = new Motion();
this.propertySet = new PropertySet();
}
public void setVisibility(int i) {
this.propertySet.visibility = i;
}
public String getName() {
return this.widgetFrame.getId();
}
public void layout(int i, int i2, int i3, int i4) {
setBounds(i, i2, i3, i4);
}
public String toString() {
return this.widgetFrame.left + ", " + this.widgetFrame.top + ", " + this.widgetFrame.right + ", " + this.widgetFrame.bottom;
}
public void setBounds(int i, int i2, int i3, int i4) {
if (this.widgetFrame == null) {
this.widgetFrame = new WidgetFrame((ConstraintWidget) null);
}
this.widgetFrame.top = i2;
this.widgetFrame.left = i;
this.widgetFrame.right = i3;
this.widgetFrame.bottom = i4;
}
public MotionWidget(WidgetFrame widgetFrame) {
this.widgetFrame = new WidgetFrame();
this.motion = new Motion();
this.propertySet = new PropertySet();
this.widgetFrame = widgetFrame;
}
@Override // androidx.constraintlayout.core.motion.utils.TypedValues
public boolean setValue(int i, int i2) {
return setValueAttributes(i, i2);
}
@Override // androidx.constraintlayout.core.motion.utils.TypedValues
public boolean setValue(int i, float f) {
if (setValueAttributes(i, f)) {
return true;
}
return setValueMotion(i, f);
}
@Override // androidx.constraintlayout.core.motion.utils.TypedValues
public boolean setValue(int i, String str) {
return setValueMotion(i, str);
}
public boolean setValueMotion(int i, int i2) {
switch (i) {
case TypedValues.MotionType.TYPE_ANIMATE_RELATIVE_TO /* 605 */:
this.motion.mAnimateRelativeTo = i2;
return true;
case TypedValues.MotionType.TYPE_ANIMATE_CIRCLEANGLE_TO /* 606 */:
this.motion.mAnimateCircleAngleTo = i2;
return true;
case TypedValues.MotionType.TYPE_PATHMOTION_ARC /* 607 */:
this.motion.mPathMotionArc = i2;
return true;
case TypedValues.MotionType.TYPE_DRAW_PATH /* 608 */:
this.motion.mDrawPath = i2;
return true;
case TypedValues.MotionType.TYPE_POLAR_RELATIVETO /* 609 */:
this.motion.mPolarRelativeTo = i2;
return true;
case TypedValues.MotionType.TYPE_QUANTIZE_MOTIONSTEPS /* 610 */:
this.motion.mQuantizeMotionSteps = i2;
return true;
case TypedValues.MotionType.TYPE_QUANTIZE_INTERPOLATOR_TYPE /* 611 */:
this.motion.mQuantizeInterpolatorType = i2;
return true;
case TypedValues.MotionType.TYPE_QUANTIZE_INTERPOLATOR_ID /* 612 */:
this.motion.mQuantizeInterpolatorID = i2;
return true;
default:
return false;
}
}
public boolean setValueMotion(int i, String str) {
if (i == 603) {
this.motion.mTransitionEasing = str;
return true;
}
if (i != 604) {
return false;
}
this.motion.mQuantizeInterpolatorString = str;
return true;
}
public boolean setValueMotion(int i, float f) {
switch (i) {
case 600:
this.motion.mMotionStagger = f;
return true;
case 601:
this.motion.mPathRotate = f;
return true;
case TypedValues.MotionType.TYPE_QUANTIZE_MOTION_PHASE /* 602 */:
this.motion.mQuantizeMotionPhase = f;
return true;
default:
return false;
}
}
public boolean setValueAttributes(int i, float f) {
switch (i) {
case 303:
this.widgetFrame.alpha = f;
return true;
case 304:
this.widgetFrame.translationX = f;
return true;
case 305:
this.widgetFrame.translationY = f;
return true;
case 306:
this.widgetFrame.translationZ = f;
return true;
case 307:
default:
return false;
case 308:
this.widgetFrame.rotationX = f;
return true;
case 309:
this.widgetFrame.rotationY = f;
return true;
case 310:
this.widgetFrame.rotationZ = f;
return true;
case 311:
this.widgetFrame.scaleX = f;
return true;
case 312:
this.widgetFrame.scaleY = f;
return true;
case 313:
this.widgetFrame.pivotX = f;
return true;
case 314:
this.widgetFrame.pivotY = f;
return true;
case 315:
this.mProgress = f;
return true;
case TypedValues.AttributesType.TYPE_PATH_ROTATE /* 316 */:
this.mTransitionPathRotate = f;
return true;
}
}
public float getValueAttributes(int i) {
switch (i) {
case 303:
return this.widgetFrame.alpha;
case 304:
return this.widgetFrame.translationX;
case 305:
return this.widgetFrame.translationY;
case 306:
return this.widgetFrame.translationZ;
case 307:
default:
return Float.NaN;
case 308:
return this.widgetFrame.rotationX;
case 309:
return this.widgetFrame.rotationY;
case 310:
return this.widgetFrame.rotationZ;
case 311:
return this.widgetFrame.scaleX;
case 312:
return this.widgetFrame.scaleY;
case 313:
return this.widgetFrame.pivotX;
case 314:
return this.widgetFrame.pivotY;
case 315:
return this.mProgress;
case TypedValues.AttributesType.TYPE_PATH_ROTATE /* 316 */:
return this.mTransitionPathRotate;
}
}
@Override // androidx.constraintlayout.core.motion.utils.TypedValues
public int getId(String str) {
int id = TypedValues.AttributesType.CC.getId(str);
return id != -1 ? id : TypedValues.MotionType.CC.getId(str);
}
public int getTop() {
return this.widgetFrame.top;
}
public int getLeft() {
return this.widgetFrame.left;
}
public int getBottom() {
return this.widgetFrame.bottom;
}
public int getRight() {
return this.widgetFrame.right;
}
public void setPivotX(float f) {
this.widgetFrame.pivotX = f;
}
public void setPivotY(float f) {
this.widgetFrame.pivotY = f;
}
public float getRotationX() {
return this.widgetFrame.rotationX;
}
public void setRotationX(float f) {
this.widgetFrame.rotationX = f;
}
public float getRotationY() {
return this.widgetFrame.rotationY;
}
public void setRotationY(float f) {
this.widgetFrame.rotationY = f;
}
public float getRotationZ() {
return this.widgetFrame.rotationZ;
}
public void setRotationZ(float f) {
this.widgetFrame.rotationZ = f;
}
public float getTranslationX() {
return this.widgetFrame.translationX;
}
public void setTranslationX(float f) {
this.widgetFrame.translationX = f;
}
public float getTranslationY() {
return this.widgetFrame.translationY;
}
public void setTranslationY(float f) {
this.widgetFrame.translationY = f;
}
public void setTranslationZ(float f) {
this.widgetFrame.translationZ = f;
}
public float getTranslationZ() {
return this.widgetFrame.translationZ;
}
public float getScaleX() {
return this.widgetFrame.scaleX;
}
public void setScaleX(float f) {
this.widgetFrame.scaleX = f;
}
public float getScaleY() {
return this.widgetFrame.scaleY;
}
public void setScaleY(float f) {
this.widgetFrame.scaleY = f;
}
public int getVisibility() {
return this.propertySet.visibility;
}
public float getPivotX() {
return this.widgetFrame.pivotX;
}
public float getPivotY() {
return this.widgetFrame.pivotY;
}
public float getAlpha() {
return this.propertySet.alpha;
}
public int getX() {
return this.widgetFrame.left;
}
public int getY() {
return this.widgetFrame.top;
}
public int getWidth() {
return this.widgetFrame.right - this.widgetFrame.left;
}
public int getHeight() {
return this.widgetFrame.bottom - this.widgetFrame.top;
}
public Set<String> getCustomAttributeNames() {
return this.widgetFrame.getCustomAttributeNames();
}
public void setCustomAttribute(String str, int i, float f) {
this.widgetFrame.setCustomAttribute(str, i, f);
}
public void setCustomAttribute(String str, int i, int i2) {
this.widgetFrame.setCustomAttribute(str, i, i2);
}
public void setCustomAttribute(String str, int i, boolean z) {
this.widgetFrame.setCustomAttribute(str, i, z);
}
public void setCustomAttribute(String str, int i, String str2) {
this.widgetFrame.setCustomAttribute(str, i, str2);
}
public CustomVariable getCustomAttribute(String str) {
return this.widgetFrame.getCustomAttribute(str);
}
public void setInterpolatedValue(CustomAttribute customAttribute, float[] fArr) {
this.widgetFrame.setCustomAttribute(customAttribute.mName, TypedValues.Custom.TYPE_FLOAT, fArr[0]);
}
}

View File

@ -0,0 +1,18 @@
package androidx.constraintlayout.core.motion.key;
/* loaded from: classes.dex */
public class MotionConstraintSet {
private static final String ERROR_MESSAGE = "XML parser error must be within a Constraint ";
private static final int INTERNAL_MATCH_CONSTRAINT = -3;
private static final int INTERNAL_MATCH_PARENT = -1;
private static final int INTERNAL_WRAP_CONTENT = -2;
private static final int INTERNAL_WRAP_CONTENT_CONSTRAINED = -4;
public static final int ROTATE_LEFT_OF_PORTRATE = 4;
public static final int ROTATE_NONE = 0;
public static final int ROTATE_PORTRATE_OF_LEFT = 2;
public static final int ROTATE_PORTRATE_OF_RIGHT = 1;
public static final int ROTATE_RIGHT_OF_PORTRATE = 3;
public String mIdString;
public int mRotate = 0;
private boolean mValidate;
}

View File

@ -0,0 +1,131 @@
package androidx.constraintlayout.core.motion.key;
import androidx.constraintlayout.core.motion.CustomVariable;
import androidx.constraintlayout.core.motion.utils.SplineSet;
import androidx.constraintlayout.core.motion.utils.TypedValues;
import java.util.HashMap;
import java.util.HashSet;
/* loaded from: classes.dex */
public abstract class MotionKey implements TypedValues {
public static final String ALPHA = "alpha";
public static final String CUSTOM = "CUSTOM";
public static final String ELEVATION = "elevation";
public static final String ROTATION = "rotationZ";
public static final String ROTATION_X = "rotationX";
public static final String SCALE_X = "scaleX";
public static final String SCALE_Y = "scaleY";
public static final String TRANSITION_PATH_ROTATE = "transitionPathRotate";
public static final String TRANSLATION_X = "translationX";
public static final String TRANSLATION_Y = "translationY";
public static int UNSET = -1;
public static final String VISIBILITY = "visibility";
public HashMap<String, CustomVariable> mCustom;
public int mFramePosition;
int mTargetId;
String mTargetString;
public int mType;
public abstract void addValues(HashMap<String, SplineSet> hashMap);
@Override //
/* renamed from: clone, reason: merged with bridge method [inline-methods] */
public abstract MotionKey mo47clone();
public abstract void getAttributeNames(HashSet<String> hashSet);
public int getFramePosition() {
return this.mFramePosition;
}
public void setFramePosition(int i) {
this.mFramePosition = i;
}
public void setInterpolation(HashMap<String, Integer> hashMap) {
}
@Override // androidx.constraintlayout.core.motion.utils.TypedValues
public boolean setValue(int i, float f) {
return false;
}
@Override // androidx.constraintlayout.core.motion.utils.TypedValues
public boolean setValue(int i, int i2) {
if (i != 100) {
return false;
}
this.mFramePosition = i2;
return true;
}
@Override // androidx.constraintlayout.core.motion.utils.TypedValues
public boolean setValue(int i, String str) {
if (i != 101) {
return false;
}
this.mTargetString = str;
return true;
}
@Override // androidx.constraintlayout.core.motion.utils.TypedValues
public boolean setValue(int i, boolean z) {
return false;
}
public MotionKey setViewId(int i) {
this.mTargetId = i;
return this;
}
public MotionKey() {
int i = UNSET;
this.mFramePosition = i;
this.mTargetId = i;
this.mTargetString = null;
}
boolean matches(String str) {
String str2 = this.mTargetString;
if (str2 == null || str == null) {
return false;
}
return str.matches(str2);
}
float toFloat(Object obj) {
return obj instanceof Float ? ((Float) obj).floatValue() : Float.parseFloat(obj.toString());
}
int toInt(Object obj) {
return obj instanceof Integer ? ((Integer) obj).intValue() : Integer.parseInt(obj.toString());
}
boolean toBoolean(Object obj) {
return obj instanceof Boolean ? ((Boolean) obj).booleanValue() : Boolean.parseBoolean(obj.toString());
}
public MotionKey copy(MotionKey motionKey) {
this.mFramePosition = motionKey.mFramePosition;
this.mTargetId = motionKey.mTargetId;
this.mTargetString = motionKey.mTargetString;
this.mType = motionKey.mType;
return this;
}
public void setCustomAttribute(String str, int i, float f) {
this.mCustom.put(str, new CustomVariable(str, i, f));
}
public void setCustomAttribute(String str, int i, int i2) {
this.mCustom.put(str, new CustomVariable(str, i, i2));
}
public void setCustomAttribute(String str, int i, boolean z) {
this.mCustom.put(str, new CustomVariable(str, i, z));
}
public void setCustomAttribute(String str, int i, String str2) {
this.mCustom.put(str, new CustomVariable(str, i, str2));
}
}

View File

@ -0,0 +1,309 @@
package androidx.constraintlayout.core.motion.key;
import androidx.constraintlayout.core.motion.utils.TypedValues;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
/* loaded from: classes.dex */
public class MotionKeyAttributes extends MotionKey {
private static final boolean DEBUG = false;
public static final int KEY_TYPE = 1;
static final String NAME = "KeyAttribute";
private static final String TAG = "KeyAttributes";
private String mTransitionEasing;
private int mCurveFit = -1;
private int mVisibility = 0;
private float mAlpha = Float.NaN;
private float mElevation = Float.NaN;
private float mRotation = Float.NaN;
private float mRotationX = Float.NaN;
private float mRotationY = Float.NaN;
private float mPivotX = Float.NaN;
private float mPivotY = Float.NaN;
private float mTransitionPathRotate = Float.NaN;
private float mScaleX = Float.NaN;
private float mScaleY = Float.NaN;
private float mTranslationX = Float.NaN;
private float mTranslationY = Float.NaN;
private float mTranslationZ = Float.NaN;
private float mProgress = Float.NaN;
@Override // androidx.constraintlayout.core.motion.key.MotionKey
/* renamed from: clone */
public MotionKey mo47clone() {
return null;
}
public int getCurveFit() {
return this.mCurveFit;
}
public MotionKeyAttributes() {
this.mType = 1;
this.mCustom = new HashMap<>();
}
@Override // androidx.constraintlayout.core.motion.key.MotionKey
public void getAttributeNames(HashSet<String> hashSet) {
if (!Float.isNaN(this.mAlpha)) {
hashSet.add("alpha");
}
if (!Float.isNaN(this.mElevation)) {
hashSet.add("elevation");
}
if (!Float.isNaN(this.mRotation)) {
hashSet.add("rotationZ");
}
if (!Float.isNaN(this.mRotationX)) {
hashSet.add("rotationX");
}
if (!Float.isNaN(this.mRotationY)) {
hashSet.add("rotationY");
}
if (!Float.isNaN(this.mPivotX)) {
hashSet.add("pivotX");
}
if (!Float.isNaN(this.mPivotY)) {
hashSet.add("pivotY");
}
if (!Float.isNaN(this.mTranslationX)) {
hashSet.add("translationX");
}
if (!Float.isNaN(this.mTranslationY)) {
hashSet.add("translationY");
}
if (!Float.isNaN(this.mTranslationZ)) {
hashSet.add("translationZ");
}
if (!Float.isNaN(this.mTransitionPathRotate)) {
hashSet.add("pathRotate");
}
if (!Float.isNaN(this.mScaleX)) {
hashSet.add("scaleX");
}
if (!Float.isNaN(this.mScaleY)) {
hashSet.add("scaleY");
}
if (!Float.isNaN(this.mProgress)) {
hashSet.add("progress");
}
if (this.mCustom.size() > 0) {
Iterator<String> it = this.mCustom.keySet().iterator();
while (it.hasNext()) {
hashSet.add("CUSTOM," + it.next());
}
}
}
/* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */
/* JADX WARN: Code restructure failed: missing block: B:135:0x009d, code lost:
if (r1.equals("pivotX") == false) goto L15;
*/
@Override // androidx.constraintlayout.core.motion.key.MotionKey
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public void addValues(java.util.HashMap<java.lang.String, androidx.constraintlayout.core.motion.utils.SplineSet> r7) {
/*
Method dump skipped, instructions count: 594
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.constraintlayout.core.motion.key.MotionKeyAttributes.addValues(java.util.HashMap):void");
}
@Override // androidx.constraintlayout.core.motion.key.MotionKey, androidx.constraintlayout.core.motion.utils.TypedValues
public boolean setValue(int i, int i2) {
if (i == 100) {
this.mFramePosition = i2;
return true;
}
if (i == 301) {
this.mCurveFit = i2;
return true;
}
if (i == 302) {
this.mVisibility = i2;
return true;
}
if (setValue(i, i2)) {
return true;
}
return super.setValue(i, i2);
}
@Override // androidx.constraintlayout.core.motion.key.MotionKey, androidx.constraintlayout.core.motion.utils.TypedValues
public boolean setValue(int i, float f) {
if (i == 100) {
this.mTransitionPathRotate = f;
return true;
}
switch (i) {
case 303:
this.mAlpha = f;
return true;
case 304:
this.mTranslationX = f;
return true;
case 305:
this.mTranslationY = f;
return true;
case 306:
this.mTranslationZ = f;
return true;
case 307:
this.mElevation = f;
return true;
case 308:
this.mRotationX = f;
return true;
case 309:
this.mRotationY = f;
return true;
case 310:
this.mRotation = f;
return true;
case 311:
this.mScaleX = f;
return true;
case 312:
this.mScaleY = f;
return true;
case 313:
this.mPivotX = f;
return true;
case 314:
this.mPivotY = f;
return true;
case 315:
this.mProgress = f;
return true;
case TypedValues.AttributesType.TYPE_PATH_ROTATE /* 316 */:
this.mTransitionPathRotate = f;
return true;
default:
return super.setValue(i, f);
}
}
@Override // androidx.constraintlayout.core.motion.key.MotionKey
public void setInterpolation(HashMap<String, Integer> hashMap) {
if (!Float.isNaN(this.mAlpha)) {
hashMap.put("alpha", Integer.valueOf(this.mCurveFit));
}
if (!Float.isNaN(this.mElevation)) {
hashMap.put("elevation", Integer.valueOf(this.mCurveFit));
}
if (!Float.isNaN(this.mRotation)) {
hashMap.put("rotationZ", Integer.valueOf(this.mCurveFit));
}
if (!Float.isNaN(this.mRotationX)) {
hashMap.put("rotationX", Integer.valueOf(this.mCurveFit));
}
if (!Float.isNaN(this.mRotationY)) {
hashMap.put("rotationY", Integer.valueOf(this.mCurveFit));
}
if (!Float.isNaN(this.mPivotX)) {
hashMap.put("pivotX", Integer.valueOf(this.mCurveFit));
}
if (!Float.isNaN(this.mPivotY)) {
hashMap.put("pivotY", Integer.valueOf(this.mCurveFit));
}
if (!Float.isNaN(this.mTranslationX)) {
hashMap.put("translationX", Integer.valueOf(this.mCurveFit));
}
if (!Float.isNaN(this.mTranslationY)) {
hashMap.put("translationY", Integer.valueOf(this.mCurveFit));
}
if (!Float.isNaN(this.mTranslationZ)) {
hashMap.put("translationZ", Integer.valueOf(this.mCurveFit));
}
if (!Float.isNaN(this.mTransitionPathRotate)) {
hashMap.put("pathRotate", Integer.valueOf(this.mCurveFit));
}
if (!Float.isNaN(this.mScaleX)) {
hashMap.put("scaleX", Integer.valueOf(this.mCurveFit));
}
if (!Float.isNaN(this.mScaleY)) {
hashMap.put("scaleY", Integer.valueOf(this.mCurveFit));
}
if (!Float.isNaN(this.mProgress)) {
hashMap.put("progress", Integer.valueOf(this.mCurveFit));
}
if (this.mCustom.size() > 0) {
Iterator<String> it = this.mCustom.keySet().iterator();
while (it.hasNext()) {
hashMap.put("CUSTOM," + it.next(), Integer.valueOf(this.mCurveFit));
}
}
}
@Override // androidx.constraintlayout.core.motion.key.MotionKey, androidx.constraintlayout.core.motion.utils.TypedValues
public boolean setValue(int i, String str) {
if (i == 101) {
this.mTargetString = str;
return true;
}
if (i != 317) {
return super.setValue(i, str);
}
this.mTransitionEasing = str;
return true;
}
@Override // androidx.constraintlayout.core.motion.utils.TypedValues
public int getId(String str) {
return TypedValues.AttributesType.CC.getId(str);
}
public void printAttributes() {
HashSet<String> hashSet = new HashSet<>();
getAttributeNames(hashSet);
System.out.println(" ------------- " + this.mFramePosition + " -------------");
String[] strArr = (String[]) hashSet.toArray(new String[0]);
for (int i = 0; i < strArr.length; i++) {
int id = TypedValues.AttributesType.CC.getId(strArr[i]);
System.out.println(strArr[i] + ":" + getFloatValue(id));
}
}
private float getFloatValue(int i) {
if (i == 100) {
return this.mFramePosition;
}
switch (i) {
case 303:
return this.mAlpha;
case 304:
return this.mTranslationX;
case 305:
return this.mTranslationY;
case 306:
return this.mTranslationZ;
case 307:
return this.mElevation;
case 308:
return this.mRotationX;
case 309:
return this.mRotationY;
case 310:
return this.mRotation;
case 311:
return this.mScaleX;
case 312:
return this.mScaleY;
case 313:
return this.mPivotX;
case 314:
return this.mPivotY;
case 315:
return this.mProgress;
case TypedValues.AttributesType.TYPE_PATH_ROTATE /* 316 */:
return this.mTransitionPathRotate;
default:
return Float.NaN;
}
}
}

View File

@ -0,0 +1,468 @@
package androidx.constraintlayout.core.motion.key;
import androidx.constraintlayout.core.motion.CustomVariable;
import androidx.constraintlayout.core.motion.utils.KeyCycleOscillator;
import androidx.constraintlayout.core.motion.utils.SplineSet;
import androidx.constraintlayout.core.motion.utils.TypedValues;
import androidx.constraintlayout.core.motion.utils.Utils;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
/* loaded from: classes.dex */
public class MotionKeyCycle extends MotionKey {
public static final int KEY_TYPE = 4;
static final String NAME = "KeyCycle";
public static final int SHAPE_BOUNCE = 6;
public static final int SHAPE_COS_WAVE = 5;
public static final int SHAPE_REVERSE_SAW_WAVE = 4;
public static final int SHAPE_SAW_WAVE = 3;
public static final int SHAPE_SIN_WAVE = 0;
public static final int SHAPE_SQUARE_WAVE = 1;
public static final int SHAPE_TRIANGLE_WAVE = 2;
private static final String TAG = "KeyCycle";
public static final String WAVE_OFFSET = "waveOffset";
public static final String WAVE_PERIOD = "wavePeriod";
public static final String WAVE_PHASE = "wavePhase";
public static final String WAVE_SHAPE = "waveShape";
private String mTransitionEasing = null;
private int mCurveFit = 0;
private int mWaveShape = -1;
private String mCustomWaveShape = null;
private float mWavePeriod = Float.NaN;
private float mWaveOffset = 0.0f;
private float mWavePhase = 0.0f;
private float mProgress = Float.NaN;
private float mAlpha = Float.NaN;
private float mElevation = Float.NaN;
private float mRotation = Float.NaN;
private float mTransitionPathRotate = Float.NaN;
private float mRotationX = Float.NaN;
private float mRotationY = Float.NaN;
private float mScaleX = Float.NaN;
private float mScaleY = Float.NaN;
private float mTranslationX = Float.NaN;
private float mTranslationY = Float.NaN;
private float mTranslationZ = Float.NaN;
@Override // androidx.constraintlayout.core.motion.key.MotionKey
public void addValues(HashMap<String, SplineSet> hashMap) {
}
@Override // androidx.constraintlayout.core.motion.key.MotionKey
/* renamed from: clone */
public MotionKey mo47clone() {
return null;
}
public MotionKeyCycle() {
this.mType = 4;
this.mCustom = new HashMap<>();
}
@Override // androidx.constraintlayout.core.motion.key.MotionKey
public void getAttributeNames(HashSet<String> hashSet) {
if (!Float.isNaN(this.mAlpha)) {
hashSet.add("alpha");
}
if (!Float.isNaN(this.mElevation)) {
hashSet.add("elevation");
}
if (!Float.isNaN(this.mRotation)) {
hashSet.add("rotationZ");
}
if (!Float.isNaN(this.mRotationX)) {
hashSet.add("rotationX");
}
if (!Float.isNaN(this.mRotationY)) {
hashSet.add("rotationY");
}
if (!Float.isNaN(this.mScaleX)) {
hashSet.add("scaleX");
}
if (!Float.isNaN(this.mScaleY)) {
hashSet.add("scaleY");
}
if (!Float.isNaN(this.mTransitionPathRotate)) {
hashSet.add("pathRotate");
}
if (!Float.isNaN(this.mTranslationX)) {
hashSet.add("translationX");
}
if (!Float.isNaN(this.mTranslationY)) {
hashSet.add("translationY");
}
if (!Float.isNaN(this.mTranslationZ)) {
hashSet.add("translationZ");
}
if (this.mCustom.size() > 0) {
Iterator<String> it = this.mCustom.keySet().iterator();
while (it.hasNext()) {
hashSet.add("CUSTOM," + it.next());
}
}
}
@Override // androidx.constraintlayout.core.motion.key.MotionKey, androidx.constraintlayout.core.motion.utils.TypedValues
public boolean setValue(int i, int i2) {
if (i == 401) {
this.mCurveFit = i2;
return true;
}
if (i == 421) {
this.mWaveShape = i2;
return true;
}
if (setValue(i, i2)) {
return true;
}
return super.setValue(i, i2);
}
@Override // androidx.constraintlayout.core.motion.key.MotionKey, androidx.constraintlayout.core.motion.utils.TypedValues
public boolean setValue(int i, String str) {
if (i == 420) {
this.mTransitionEasing = str;
return true;
}
if (i != 422) {
return super.setValue(i, str);
}
this.mCustomWaveShape = str;
return true;
}
@Override // androidx.constraintlayout.core.motion.key.MotionKey, androidx.constraintlayout.core.motion.utils.TypedValues
public boolean setValue(int i, float f) {
if (i == 315) {
this.mProgress = f;
return true;
}
if (i == 403) {
this.mAlpha = f;
return true;
}
if (i == 416) {
this.mTransitionPathRotate = f;
return true;
}
switch (i) {
case 304:
this.mTranslationX = f;
return true;
case 305:
this.mTranslationY = f;
return true;
case 306:
this.mTranslationZ = f;
return true;
case 307:
this.mElevation = f;
return true;
case 308:
this.mRotationX = f;
return true;
case 309:
this.mRotationY = f;
return true;
case 310:
this.mRotation = f;
return true;
case 311:
this.mScaleX = f;
return true;
case 312:
this.mScaleY = f;
return true;
default:
switch (i) {
case TypedValues.CycleType.TYPE_WAVE_PERIOD /* 423 */:
this.mWavePeriod = f;
return true;
case TypedValues.CycleType.TYPE_WAVE_OFFSET /* 424 */:
this.mWaveOffset = f;
return true;
case TypedValues.CycleType.TYPE_WAVE_PHASE /* 425 */:
this.mWavePhase = f;
return true;
default:
return super.setValue(i, f);
}
}
}
public float getValue(String str) {
str.hashCode();
switch (str) {
case "rotationX":
return this.mRotationX;
case "rotationY":
return this.mRotationY;
case "rotationZ":
return this.mRotation;
case "translationX":
return this.mTranslationX;
case "translationY":
return this.mTranslationY;
case "translationZ":
return this.mTranslationZ;
case "offset":
return this.mWaveOffset;
case "progress":
return this.mProgress;
case "scaleX":
return this.mScaleX;
case "scaleY":
return this.mScaleY;
case "elevation":
return this.mElevation;
case "alpha":
return this.mAlpha;
case "phase":
return this.mWavePhase;
case "pathRotate":
return this.mTransitionPathRotate;
default:
return Float.NaN;
}
}
/* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */
@Override // androidx.constraintlayout.core.motion.utils.TypedValues
public int getId(String str) {
char c;
str.hashCode();
switch (str.hashCode()) {
case -1581616630:
if (str.equals(TypedValues.CycleType.S_CUSTOM_WAVE_SHAPE)) {
c = 0;
break;
}
c = 65535;
break;
case -1310311125:
if (str.equals("easing")) {
c = 1;
break;
}
c = 65535;
break;
case -1249320806:
if (str.equals("rotationX")) {
c = 2;
break;
}
c = 65535;
break;
case -1249320805:
if (str.equals("rotationY")) {
c = 3;
break;
}
c = 65535;
break;
case -1249320804:
if (str.equals("rotationZ")) {
c = 4;
break;
}
c = 65535;
break;
case -1225497657:
if (str.equals("translationX")) {
c = 5;
break;
}
c = 65535;
break;
case -1225497656:
if (str.equals("translationY")) {
c = 6;
break;
}
c = 65535;
break;
case -1225497655:
if (str.equals("translationZ")) {
c = 7;
break;
}
c = 65535;
break;
case -1019779949:
if (str.equals(TypedValues.CycleType.S_WAVE_OFFSET)) {
c = '\b';
break;
}
c = 65535;
break;
case -1001078227:
if (str.equals("progress")) {
c = '\t';
break;
}
c = 65535;
break;
case -991726143:
if (str.equals(TypedValues.CycleType.S_WAVE_PERIOD)) {
c = '\n';
break;
}
c = 65535;
break;
case -987906986:
if (str.equals("pivotX")) {
c = 11;
break;
}
c = 65535;
break;
case -987906985:
if (str.equals("pivotY")) {
c = '\f';
break;
}
c = 65535;
break;
case -908189618:
if (str.equals("scaleX")) {
c = '\r';
break;
}
c = 65535;
break;
case -908189617:
if (str.equals("scaleY")) {
c = 14;
break;
}
c = 65535;
break;
case 92909918:
if (str.equals("alpha")) {
c = 15;
break;
}
c = 65535;
break;
case 106629499:
if (str.equals(TypedValues.CycleType.S_WAVE_PHASE)) {
c = 16;
break;
}
c = 65535;
break;
case 579057826:
if (str.equals("curveFit")) {
c = 17;
break;
}
c = 65535;
break;
case 803192288:
if (str.equals("pathRotate")) {
c = 18;
break;
}
c = 65535;
break;
case 1532805160:
if (str.equals("waveShape")) {
c = 19;
break;
}
c = 65535;
break;
case 1941332754:
if (str.equals("visibility")) {
c = 20;
break;
}
c = 65535;
break;
default:
c = 65535;
break;
}
switch (c) {
case 0:
return TypedValues.CycleType.TYPE_CUSTOM_WAVE_SHAPE;
case 1:
return TypedValues.CycleType.TYPE_EASING;
case 2:
return 308;
case 3:
return 309;
case 4:
return 310;
case 5:
return 304;
case 6:
return 305;
case 7:
return 306;
case '\b':
return TypedValues.CycleType.TYPE_WAVE_OFFSET;
case '\t':
return 315;
case '\n':
return TypedValues.CycleType.TYPE_WAVE_PERIOD;
case 11:
return 313;
case '\f':
return 314;
case '\r':
return 311;
case 14:
return 312;
case 15:
return TypedValues.CycleType.TYPE_ALPHA;
case 16:
return TypedValues.CycleType.TYPE_WAVE_PHASE;
case 17:
return TypedValues.CycleType.TYPE_CURVE_FIT;
case 18:
return TypedValues.CycleType.TYPE_PATH_ROTATE;
case 19:
return TypedValues.CycleType.TYPE_WAVE_SHAPE;
case 20:
return TypedValues.CycleType.TYPE_VISIBILITY;
default:
return -1;
}
}
public void addCycleValues(HashMap<String, KeyCycleOscillator> hashMap) {
KeyCycleOscillator keyCycleOscillator;
KeyCycleOscillator keyCycleOscillator2;
for (String str : hashMap.keySet()) {
if (str.startsWith("CUSTOM")) {
CustomVariable customVariable = this.mCustom.get(str.substring(7));
if (customVariable != null && customVariable.getType() == 901 && (keyCycleOscillator = hashMap.get(str)) != null) {
keyCycleOscillator.setPoint(this.mFramePosition, this.mWaveShape, this.mCustomWaveShape, -1, this.mWavePeriod, this.mWaveOffset, this.mWavePhase, customVariable.getValueToInterpolate(), customVariable);
}
} else {
float value = getValue(str);
if (!Float.isNaN(value) && (keyCycleOscillator2 = hashMap.get(str)) != null) {
keyCycleOscillator2.setPoint(this.mFramePosition, this.mWaveShape, this.mCustomWaveShape, -1, this.mWavePeriod, this.mWaveOffset, this.mWavePhase, value);
}
}
}
}
public void dump() {
System.out.println("MotionKeyCycle{mWaveShape=" + this.mWaveShape + ", mWavePeriod=" + this.mWavePeriod + ", mWaveOffset=" + this.mWaveOffset + ", mWavePhase=" + this.mWavePhase + ", mRotation=" + this.mRotation + '}');
}
public void printAttributes() {
HashSet<String> hashSet = new HashSet<>();
getAttributeNames(hashSet);
Utils.log(" ------------- " + this.mFramePosition + " -------------");
Utils.log("MotionKeyCycle{Shape=" + this.mWaveShape + ", Period=" + this.mWavePeriod + ", Offset=" + this.mWaveOffset + ", Phase=" + this.mWavePhase + '}');
String[] strArr = (String[]) hashSet.toArray(new String[0]);
for (int i = 0; i < strArr.length; i++) {
TypedValues.AttributesType.CC.getId(strArr[i]);
Utils.log(strArr[i] + ":" + getValue(strArr[i]));
}
}
}

View File

@ -0,0 +1,265 @@
package androidx.constraintlayout.core.motion.key;
import androidx.constraintlayout.core.motion.MotionWidget;
import androidx.constraintlayout.core.motion.utils.FloatRect;
import androidx.constraintlayout.core.motion.utils.SplineSet;
import androidx.constraintlayout.core.motion.utils.TypedValues;
import java.util.HashMap;
import java.util.HashSet;
/* loaded from: classes.dex */
public class MotionKeyPosition extends MotionKey {
static final int KEY_TYPE = 2;
static final String NAME = "KeyPosition";
protected static final float SELECTION_SLOPE = 20.0f;
public static final int TYPE_CARTESIAN = 0;
public static final int TYPE_PATH = 1;
public static final int TYPE_SCREEN = 2;
public int mCurveFit = UNSET;
public String mTransitionEasing = null;
public int mPathMotionArc = UNSET;
public int mDrawPath = 0;
public float mPercentWidth = Float.NaN;
public float mPercentHeight = Float.NaN;
public float mPercentX = Float.NaN;
public float mPercentY = Float.NaN;
public float mAltPercentX = Float.NaN;
public float mAltPercentY = Float.NaN;
public int mPositionType = 0;
private float mCalculatedPositionX = Float.NaN;
private float mCalculatedPositionY = Float.NaN;
private void calcPathPosition(float f, float f2, float f3, float f4) {
float f5 = f3 - f;
float f6 = f4 - f2;
float f7 = this.mPercentX;
float f8 = this.mPercentY;
this.mCalculatedPositionX = f + (f5 * f7) + ((-f6) * f8);
this.mCalculatedPositionY = f2 + (f6 * f7) + (f5 * f8);
}
private void calcScreenPosition(int i, int i2) {
float f = this.mPercentX;
float f2 = 0;
this.mCalculatedPositionX = (i * f) + f2;
this.mCalculatedPositionY = (i2 * f) + f2;
}
@Override // androidx.constraintlayout.core.motion.key.MotionKey
public void addValues(HashMap<String, SplineSet> hashMap) {
}
@Override // androidx.constraintlayout.core.motion.key.MotionKey
public void getAttributeNames(HashSet<String> hashSet) {
}
float getPositionX() {
return this.mCalculatedPositionX;
}
float getPositionY() {
return this.mCalculatedPositionY;
}
public MotionKeyPosition() {
this.mType = 2;
}
private void calcCartesianPosition(float f, float f2, float f3, float f4) {
float f5 = f3 - f;
float f6 = f4 - f2;
float f7 = Float.isNaN(this.mPercentX) ? 0.0f : this.mPercentX;
float f8 = Float.isNaN(this.mAltPercentY) ? 0.0f : this.mAltPercentY;
float f9 = Float.isNaN(this.mPercentY) ? 0.0f : this.mPercentY;
this.mCalculatedPositionX = (int) (f + (f7 * f5) + ((Float.isNaN(this.mAltPercentX) ? 0.0f : this.mAltPercentX) * f6));
this.mCalculatedPositionY = (int) (f2 + (f5 * f8) + (f6 * f9));
}
public void positionAttributes(MotionWidget motionWidget, FloatRect floatRect, FloatRect floatRect2, float f, float f2, String[] strArr, float[] fArr) {
int i = this.mPositionType;
if (i == 1) {
positionPathAttributes(floatRect, floatRect2, f, f2, strArr, fArr);
} else if (i == 2) {
positionScreenAttributes(motionWidget, floatRect, floatRect2, f, f2, strArr, fArr);
} else {
positionCartAttributes(floatRect, floatRect2, f, f2, strArr, fArr);
}
}
void positionPathAttributes(FloatRect floatRect, FloatRect floatRect2, float f, float f2, String[] strArr, float[] fArr) {
float centerX = floatRect.centerX();
float centerY = floatRect.centerY();
float centerX2 = floatRect2.centerX() - centerX;
float centerY2 = floatRect2.centerY() - centerY;
float hypot = (float) Math.hypot(centerX2, centerY2);
if (hypot < 1.0E-4d) {
System.out.println("distance ~ 0");
fArr[0] = 0.0f;
fArr[1] = 0.0f;
return;
}
float f3 = centerX2 / hypot;
float f4 = centerY2 / hypot;
float f5 = f2 - centerY;
float f6 = f - centerX;
float f7 = ((f3 * f5) - (f6 * f4)) / hypot;
float f8 = ((f3 * f6) + (f4 * f5)) / hypot;
String str = strArr[0];
if (str != null) {
if ("percentX".equals(str)) {
fArr[0] = f8;
fArr[1] = f7;
return;
}
return;
}
strArr[0] = "percentX";
strArr[1] = "percentY";
fArr[0] = f8;
fArr[1] = f7;
}
void positionScreenAttributes(MotionWidget motionWidget, FloatRect floatRect, FloatRect floatRect2, float f, float f2, String[] strArr, float[] fArr) {
floatRect.centerX();
floatRect.centerY();
floatRect2.centerX();
floatRect2.centerY();
MotionWidget parent = motionWidget.getParent();
int width = parent.getWidth();
int height = parent.getHeight();
String str = strArr[0];
if (str != null) {
if ("percentX".equals(str)) {
fArr[0] = f / width;
fArr[1] = f2 / height;
return;
} else {
fArr[1] = f / width;
fArr[0] = f2 / height;
return;
}
}
strArr[0] = "percentX";
fArr[0] = f / width;
strArr[1] = "percentY";
fArr[1] = f2 / height;
}
void positionCartAttributes(FloatRect floatRect, FloatRect floatRect2, float f, float f2, String[] strArr, float[] fArr) {
float centerX = floatRect.centerX();
float centerY = floatRect.centerY();
float centerX2 = floatRect2.centerX() - centerX;
float centerY2 = floatRect2.centerY() - centerY;
String str = strArr[0];
if (str != null) {
if ("percentX".equals(str)) {
fArr[0] = (f - centerX) / centerX2;
fArr[1] = (f2 - centerY) / centerY2;
return;
} else {
fArr[1] = (f - centerX) / centerX2;
fArr[0] = (f2 - centerY) / centerY2;
return;
}
}
strArr[0] = "percentX";
fArr[0] = (f - centerX) / centerX2;
strArr[1] = "percentY";
fArr[1] = (f2 - centerY) / centerY2;
}
public boolean intersects(int i, int i2, FloatRect floatRect, FloatRect floatRect2, float f, float f2) {
calcPosition(i, i2, floatRect.centerX(), floatRect.centerY(), floatRect2.centerX(), floatRect2.centerY());
return Math.abs(f - this.mCalculatedPositionX) < SELECTION_SLOPE && Math.abs(f2 - this.mCalculatedPositionY) < SELECTION_SLOPE;
}
@Override // androidx.constraintlayout.core.motion.key.MotionKey
public MotionKey copy(MotionKey motionKey) {
super.copy(motionKey);
MotionKeyPosition motionKeyPosition = (MotionKeyPosition) motionKey;
this.mTransitionEasing = motionKeyPosition.mTransitionEasing;
this.mPathMotionArc = motionKeyPosition.mPathMotionArc;
this.mDrawPath = motionKeyPosition.mDrawPath;
this.mPercentWidth = motionKeyPosition.mPercentWidth;
this.mPercentHeight = Float.NaN;
this.mPercentX = motionKeyPosition.mPercentX;
this.mPercentY = motionKeyPosition.mPercentY;
this.mAltPercentX = motionKeyPosition.mAltPercentX;
this.mAltPercentY = motionKeyPosition.mAltPercentY;
this.mCalculatedPositionX = motionKeyPosition.mCalculatedPositionX;
this.mCalculatedPositionY = motionKeyPosition.mCalculatedPositionY;
return this;
}
@Override // androidx.constraintlayout.core.motion.key.MotionKey
/* renamed from: clone */
public MotionKey mo47clone() {
return new MotionKeyPosition().copy(this);
}
void calcPosition(int i, int i2, float f, float f2, float f3, float f4) {
int i3 = this.mPositionType;
if (i3 == 1) {
calcPathPosition(f, f2, f3, f4);
} else if (i3 == 2) {
calcScreenPosition(i, i2);
} else {
calcCartesianPosition(f, f2, f3, f4);
}
}
@Override // androidx.constraintlayout.core.motion.key.MotionKey, androidx.constraintlayout.core.motion.utils.TypedValues
public boolean setValue(int i, int i2) {
if (i == 100) {
this.mFramePosition = i2;
return true;
}
if (i == 508) {
this.mCurveFit = i2;
return true;
}
if (i != 510) {
return super.setValue(i, i2);
}
this.mPositionType = i2;
return true;
}
@Override // androidx.constraintlayout.core.motion.key.MotionKey, androidx.constraintlayout.core.motion.utils.TypedValues
public boolean setValue(int i, float f) {
switch (i) {
case TypedValues.PositionType.TYPE_PERCENT_WIDTH /* 503 */:
this.mPercentWidth = f;
return true;
case TypedValues.PositionType.TYPE_PERCENT_HEIGHT /* 504 */:
this.mPercentHeight = f;
return true;
case TypedValues.PositionType.TYPE_SIZE_PERCENT /* 505 */:
this.mPercentWidth = f;
this.mPercentHeight = f;
return true;
case TypedValues.PositionType.TYPE_PERCENT_X /* 506 */:
this.mPercentX = f;
return true;
case TypedValues.PositionType.TYPE_PERCENT_Y /* 507 */:
this.mPercentY = f;
return true;
default:
return super.setValue(i, f);
}
}
@Override // androidx.constraintlayout.core.motion.key.MotionKey, androidx.constraintlayout.core.motion.utils.TypedValues
public boolean setValue(int i, String str) {
if (i == 501) {
this.mTransitionEasing = str.toString();
return true;
}
return super.setValue(i, str);
}
@Override // androidx.constraintlayout.core.motion.utils.TypedValues
public int getId(String str) {
return TypedValues.PositionType.CC.getId(str);
}
}

View File

@ -0,0 +1,227 @@
package androidx.constraintlayout.core.motion.key;
import androidx.constraintlayout.core.motion.utils.SplineSet;
import androidx.constraintlayout.core.motion.utils.TypedValues;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
/* loaded from: classes.dex */
public class MotionKeyTimeCycle extends MotionKey {
public static final int KEY_TYPE = 3;
static final String NAME = "KeyTimeCycle";
private static final String TAG = "KeyTimeCycle";
private String mTransitionEasing;
private int mCurveFit = -1;
private float mAlpha = Float.NaN;
private float mElevation = Float.NaN;
private float mRotation = Float.NaN;
private float mRotationX = Float.NaN;
private float mRotationY = Float.NaN;
private float mTransitionPathRotate = Float.NaN;
private float mScaleX = Float.NaN;
private float mScaleY = Float.NaN;
private float mTranslationX = Float.NaN;
private float mTranslationY = Float.NaN;
private float mTranslationZ = Float.NaN;
private float mProgress = Float.NaN;
private int mWaveShape = 0;
private String mCustomWaveShape = null;
private float mWavePeriod = Float.NaN;
private float mWaveOffset = 0.0f;
@Override // androidx.constraintlayout.core.motion.key.MotionKey
public void addValues(HashMap<String, SplineSet> hashMap) {
}
public MotionKeyTimeCycle() {
this.mType = 3;
this.mCustom = new HashMap<>();
}
/* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */
/* JADX WARN: Code restructure failed: missing block: B:115:0x008c, code lost:
if (r1.equals("scaleX") == false) goto L15;
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public void addTimeValues(java.util.HashMap<java.lang.String, androidx.constraintlayout.core.motion.utils.TimeCycleSplineSet> r11) {
/*
Method dump skipped, instructions count: 604
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.constraintlayout.core.motion.key.MotionKeyTimeCycle.addTimeValues(java.util.HashMap):void");
}
@Override // androidx.constraintlayout.core.motion.key.MotionKey, androidx.constraintlayout.core.motion.utils.TypedValues
public boolean setValue(int i, int i2) {
if (i == 100) {
this.mFramePosition = i2;
return true;
}
if (i != 421) {
return super.setValue(i, i2);
}
this.mWaveShape = i2;
return true;
}
@Override // androidx.constraintlayout.core.motion.key.MotionKey, androidx.constraintlayout.core.motion.utils.TypedValues
public boolean setValue(int i, float f) {
if (i == 315) {
this.mProgress = toFloat(Float.valueOf(f));
return true;
}
if (i == 401) {
this.mCurveFit = toInt(Float.valueOf(f));
return true;
}
if (i == 403) {
this.mAlpha = f;
return true;
}
if (i == 416) {
this.mTransitionPathRotate = toFloat(Float.valueOf(f));
return true;
}
if (i == 423) {
this.mWavePeriod = toFloat(Float.valueOf(f));
return true;
}
if (i != 424) {
switch (i) {
case 304:
this.mTranslationX = toFloat(Float.valueOf(f));
return true;
case 305:
this.mTranslationY = toFloat(Float.valueOf(f));
return true;
case 306:
this.mTranslationZ = toFloat(Float.valueOf(f));
return true;
case 307:
this.mElevation = toFloat(Float.valueOf(f));
return true;
case 308:
this.mRotationX = toFloat(Float.valueOf(f));
return true;
case 309:
this.mRotationY = toFloat(Float.valueOf(f));
return true;
case 310:
this.mRotation = toFloat(Float.valueOf(f));
return true;
case 311:
this.mScaleX = toFloat(Float.valueOf(f));
return true;
case 312:
this.mScaleY = toFloat(Float.valueOf(f));
return true;
default:
return super.setValue(i, f);
}
}
this.mWaveOffset = toFloat(Float.valueOf(f));
return true;
}
@Override // androidx.constraintlayout.core.motion.key.MotionKey, androidx.constraintlayout.core.motion.utils.TypedValues
public boolean setValue(int i, String str) {
if (i == 420) {
this.mTransitionEasing = str;
return true;
}
if (i != 421) {
return super.setValue(i, str);
}
this.mWaveShape = 7;
this.mCustomWaveShape = str;
return true;
}
@Override // androidx.constraintlayout.core.motion.key.MotionKey, androidx.constraintlayout.core.motion.utils.TypedValues
public boolean setValue(int i, boolean z) {
return super.setValue(i, z);
}
@Override // androidx.constraintlayout.core.motion.key.MotionKey
public MotionKeyTimeCycle copy(MotionKey motionKey) {
super.copy(motionKey);
MotionKeyTimeCycle motionKeyTimeCycle = (MotionKeyTimeCycle) motionKey;
this.mTransitionEasing = motionKeyTimeCycle.mTransitionEasing;
this.mCurveFit = motionKeyTimeCycle.mCurveFit;
this.mWaveShape = motionKeyTimeCycle.mWaveShape;
this.mWavePeriod = motionKeyTimeCycle.mWavePeriod;
this.mWaveOffset = motionKeyTimeCycle.mWaveOffset;
this.mProgress = motionKeyTimeCycle.mProgress;
this.mAlpha = motionKeyTimeCycle.mAlpha;
this.mElevation = motionKeyTimeCycle.mElevation;
this.mRotation = motionKeyTimeCycle.mRotation;
this.mTransitionPathRotate = motionKeyTimeCycle.mTransitionPathRotate;
this.mRotationX = motionKeyTimeCycle.mRotationX;
this.mRotationY = motionKeyTimeCycle.mRotationY;
this.mScaleX = motionKeyTimeCycle.mScaleX;
this.mScaleY = motionKeyTimeCycle.mScaleY;
this.mTranslationX = motionKeyTimeCycle.mTranslationX;
this.mTranslationY = motionKeyTimeCycle.mTranslationY;
this.mTranslationZ = motionKeyTimeCycle.mTranslationZ;
return this;
}
@Override // androidx.constraintlayout.core.motion.key.MotionKey
public void getAttributeNames(HashSet<String> hashSet) {
if (!Float.isNaN(this.mAlpha)) {
hashSet.add("alpha");
}
if (!Float.isNaN(this.mElevation)) {
hashSet.add("elevation");
}
if (!Float.isNaN(this.mRotation)) {
hashSet.add("rotationZ");
}
if (!Float.isNaN(this.mRotationX)) {
hashSet.add("rotationX");
}
if (!Float.isNaN(this.mRotationY)) {
hashSet.add("rotationY");
}
if (!Float.isNaN(this.mScaleX)) {
hashSet.add("scaleX");
}
if (!Float.isNaN(this.mScaleY)) {
hashSet.add("scaleY");
}
if (!Float.isNaN(this.mTransitionPathRotate)) {
hashSet.add("pathRotate");
}
if (!Float.isNaN(this.mTranslationX)) {
hashSet.add("translationX");
}
if (!Float.isNaN(this.mTranslationY)) {
hashSet.add("translationY");
}
if (!Float.isNaN(this.mTranslationZ)) {
hashSet.add("translationZ");
}
if (this.mCustom.size() > 0) {
Iterator<String> it = this.mCustom.keySet().iterator();
while (it.hasNext()) {
hashSet.add("CUSTOM," + it.next());
}
}
}
@Override // androidx.constraintlayout.core.motion.key.MotionKey
/* renamed from: clone */
public MotionKey mo47clone() {
return new MotionKeyTimeCycle().copy((MotionKey) this);
}
@Override // androidx.constraintlayout.core.motion.utils.TypedValues
public int getId(String str) {
return TypedValues.CycleType.CC.getId(str);
}
}

View File

@ -0,0 +1,298 @@
package androidx.constraintlayout.core.motion.key;
import androidx.constraintlayout.core.motion.CustomVariable;
import androidx.constraintlayout.core.motion.MotionWidget;
import androidx.constraintlayout.core.motion.utils.FloatRect;
import androidx.constraintlayout.core.motion.utils.SplineSet;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Locale;
/* loaded from: classes.dex */
public class MotionKeyTrigger extends MotionKey {
public static final String CROSS = "CROSS";
public static final int KEY_TYPE = 5;
public static final String NEGATIVE_CROSS = "negativeCross";
public static final String POSITIVE_CROSS = "positiveCross";
public static final String POST_LAYOUT = "postLayout";
private static final String TAG = "KeyTrigger";
public static final String TRIGGER_COLLISION_ID = "triggerCollisionId";
public static final String TRIGGER_COLLISION_VIEW = "triggerCollisionView";
public static final String TRIGGER_ID = "triggerID";
public static final String TRIGGER_RECEIVER = "triggerReceiver";
public static final String TRIGGER_SLACK = "triggerSlack";
public static final int TYPE_CROSS = 312;
public static final int TYPE_NEGATIVE_CROSS = 310;
public static final int TYPE_POSITIVE_CROSS = 309;
public static final int TYPE_POST_LAYOUT = 304;
public static final int TYPE_TRIGGER_COLLISION_ID = 307;
public static final int TYPE_TRIGGER_COLLISION_VIEW = 306;
public static final int TYPE_TRIGGER_ID = 308;
public static final int TYPE_TRIGGER_RECEIVER = 311;
public static final int TYPE_TRIGGER_SLACK = 305;
public static final int TYPE_VIEW_TRANSITION_ON_CROSS = 301;
public static final int TYPE_VIEW_TRANSITION_ON_NEGATIVE_CROSS = 303;
public static final int TYPE_VIEW_TRANSITION_ON_POSITIVE_CROSS = 302;
public static final String VIEW_TRANSITION_ON_CROSS = "viewTransitionOnCross";
public static final String VIEW_TRANSITION_ON_NEGATIVE_CROSS = "viewTransitionOnNegativeCross";
public static final String VIEW_TRANSITION_ON_POSITIVE_CROSS = "viewTransitionOnPositiveCross";
private float mFireLastPos;
private int mCurveFit = -1;
private String mCross = null;
private int mTriggerReceiver = UNSET;
private String mNegativeCross = null;
private String mPositiveCross = null;
private int mTriggerID = UNSET;
private int mTriggerCollisionId = UNSET;
float mTriggerSlack = 0.1f;
private boolean mFireCrossReset = true;
private boolean mFireNegativeReset = true;
private boolean mFirePositiveReset = true;
private float mFireThreshold = Float.NaN;
private boolean mPostLayout = false;
int mViewTransitionOnNegativeCross = UNSET;
int mViewTransitionOnPositiveCross = UNSET;
int mViewTransitionOnCross = UNSET;
FloatRect mCollisionRect = new FloatRect();
FloatRect mTargetRect = new FloatRect();
@Override // androidx.constraintlayout.core.motion.key.MotionKey
public void addValues(HashMap<String, SplineSet> hashMap) {
}
public void conditionallyFire(float f, MotionWidget motionWidget) {
}
@Override // androidx.constraintlayout.core.motion.key.MotionKey
public void getAttributeNames(HashSet<String> hashSet) {
}
public MotionKeyTrigger() {
this.mType = 5;
this.mCustom = new HashMap<>();
}
/* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */
@Override // androidx.constraintlayout.core.motion.utils.TypedValues
public int getId(String str) {
char c;
str.hashCode();
switch (str.hashCode()) {
case -1594793529:
if (str.equals("positiveCross")) {
c = 0;
break;
}
c = 65535;
break;
case -966421266:
if (str.equals("viewTransitionOnPositiveCross")) {
c = 1;
break;
}
c = 65535;
break;
case -786670827:
if (str.equals("triggerCollisionId")) {
c = 2;
break;
}
c = 65535;
break;
case -648752941:
if (str.equals("triggerID")) {
c = 3;
break;
}
c = 65535;
break;
case -638126837:
if (str.equals("negativeCross")) {
c = 4;
break;
}
c = 65535;
break;
case -76025313:
if (str.equals("triggerCollisionView")) {
c = 5;
break;
}
c = 65535;
break;
case -9754574:
if (str.equals("viewTransitionOnNegativeCross")) {
c = 6;
break;
}
c = 65535;
break;
case 364489912:
if (str.equals("triggerSlack")) {
c = 7;
break;
}
c = 65535;
break;
case 1301930599:
if (str.equals("viewTransitionOnCross")) {
c = '\b';
break;
}
c = 65535;
break;
case 1401391082:
if (str.equals("postLayout")) {
c = '\t';
break;
}
c = 65535;
break;
case 1535404999:
if (str.equals("triggerReceiver")) {
c = '\n';
break;
}
c = 65535;
break;
default:
c = 65535;
break;
}
switch (c) {
case 0:
return 309;
case 1:
return 302;
case 2:
return 307;
case 3:
return 308;
case 4:
return 310;
case 5:
return 306;
case 6:
return 303;
case 7:
return 305;
case '\b':
return 301;
case '\t':
return 304;
case '\n':
return 311;
default:
return -1;
}
}
@Override // androidx.constraintlayout.core.motion.key.MotionKey
public MotionKeyTrigger copy(MotionKey motionKey) {
super.copy(motionKey);
MotionKeyTrigger motionKeyTrigger = (MotionKeyTrigger) motionKey;
this.mCurveFit = motionKeyTrigger.mCurveFit;
this.mCross = motionKeyTrigger.mCross;
this.mTriggerReceiver = motionKeyTrigger.mTriggerReceiver;
this.mNegativeCross = motionKeyTrigger.mNegativeCross;
this.mPositiveCross = motionKeyTrigger.mPositiveCross;
this.mTriggerID = motionKeyTrigger.mTriggerID;
this.mTriggerCollisionId = motionKeyTrigger.mTriggerCollisionId;
this.mTriggerSlack = motionKeyTrigger.mTriggerSlack;
this.mFireCrossReset = motionKeyTrigger.mFireCrossReset;
this.mFireNegativeReset = motionKeyTrigger.mFireNegativeReset;
this.mFirePositiveReset = motionKeyTrigger.mFirePositiveReset;
this.mFireThreshold = motionKeyTrigger.mFireThreshold;
this.mFireLastPos = motionKeyTrigger.mFireLastPos;
this.mPostLayout = motionKeyTrigger.mPostLayout;
this.mCollisionRect = motionKeyTrigger.mCollisionRect;
this.mTargetRect = motionKeyTrigger.mTargetRect;
return this;
}
@Override // androidx.constraintlayout.core.motion.key.MotionKey
/* renamed from: clone */
public MotionKey mo47clone() {
return new MotionKeyTrigger().copy((MotionKey) this);
}
private void fireCustom(String str, MotionWidget motionWidget) {
boolean z = str.length() == 1;
if (!z) {
str = str.substring(1).toLowerCase(Locale.ROOT);
}
for (String str2 : this.mCustom.keySet()) {
String lowerCase = str2.toLowerCase(Locale.ROOT);
if (z || lowerCase.matches(str)) {
CustomVariable customVariable = this.mCustom.get(str2);
if (customVariable != null) {
customVariable.applyToWidget(motionWidget);
}
}
}
}
@Override // androidx.constraintlayout.core.motion.key.MotionKey, androidx.constraintlayout.core.motion.utils.TypedValues
public boolean setValue(int i, int i2) {
if (i == 307) {
this.mTriggerCollisionId = i2;
return true;
}
if (i == 308) {
this.mTriggerID = toInt(Integer.valueOf(i2));
return true;
}
if (i == 311) {
this.mTriggerReceiver = i2;
return true;
}
switch (i) {
case 301:
this.mViewTransitionOnCross = i2;
return true;
case 302:
this.mViewTransitionOnPositiveCross = i2;
return true;
case 303:
this.mViewTransitionOnNegativeCross = i2;
return true;
default:
return super.setValue(i, i2);
}
}
@Override // androidx.constraintlayout.core.motion.key.MotionKey, androidx.constraintlayout.core.motion.utils.TypedValues
public boolean setValue(int i, float f) {
if (i != 305) {
return super.setValue(i, f);
}
this.mTriggerSlack = f;
return true;
}
@Override // androidx.constraintlayout.core.motion.key.MotionKey, androidx.constraintlayout.core.motion.utils.TypedValues
public boolean setValue(int i, String str) {
if (i == 309) {
this.mPositiveCross = str;
return true;
}
if (i == 310) {
this.mNegativeCross = str;
return true;
}
if (i != 312) {
return super.setValue(i, str);
}
this.mCross = str;
return true;
}
@Override // androidx.constraintlayout.core.motion.key.MotionKey, androidx.constraintlayout.core.motion.utils.TypedValues
public boolean setValue(int i, boolean z) {
if (i != 304) {
return super.setValue(i, z);
}
this.mPostLayout = z;
return true;
}
}

View File

@ -0,0 +1,75 @@
package androidx.constraintlayout.core.motion.parse;
import androidx.constraintlayout.core.motion.utils.TypedBundle;
import androidx.constraintlayout.core.motion.utils.TypedValues;
import androidx.constraintlayout.core.parser.CLElement;
import androidx.constraintlayout.core.parser.CLKey;
import androidx.constraintlayout.core.parser.CLObject;
import androidx.constraintlayout.core.parser.CLParser;
import androidx.constraintlayout.core.parser.CLParsingException;
/* loaded from: classes.dex */
public class KeyParser {
/* JADX INFO: Access modifiers changed from: private */
interface DataType {
int get(int i);
}
/* JADX INFO: Access modifiers changed from: private */
interface Ids {
int get(String str);
}
private static TypedBundle parse(String str, Ids ids, DataType dataType) {
TypedBundle typedBundle = new TypedBundle();
try {
CLObject parse = CLParser.parse(str);
int size = parse.size();
for (int i = 0; i < size; i++) {
CLKey cLKey = (CLKey) parse.get(i);
String content = cLKey.content();
CLElement value = cLKey.getValue();
int i2 = ids.get(content);
if (i2 == -1) {
System.err.println("unknown type " + content);
} else {
int i3 = dataType.get(i2);
if (i3 == 1) {
typedBundle.add(i2, parse.getBoolean(i));
} else if (i3 == 2) {
typedBundle.add(i2, value.getInt());
System.out.println("parse " + content + " INT_MASK > " + value.getInt());
} else if (i3 == 4) {
typedBundle.add(i2, value.getFloat());
System.out.println("parse " + content + " FLOAT_MASK > " + value.getFloat());
} else if (i3 == 8) {
typedBundle.add(i2, value.content());
System.out.println("parse " + content + " STRING_MASK > " + value.content());
}
}
}
} catch (CLParsingException e) {
e.printStackTrace();
}
return typedBundle;
}
public static TypedBundle parseAttributes(String str) {
return parse(str, new Ids() { // from class: androidx.constraintlayout.core.motion.parse.KeyParser$$ExternalSyntheticLambda0
@Override // androidx.constraintlayout.core.motion.parse.KeyParser.Ids
public final int get(String str2) {
return TypedValues.AttributesType.CC.getId(str2);
}
}, new DataType() { // from class: androidx.constraintlayout.core.motion.parse.KeyParser$$ExternalSyntheticLambda1
@Override // androidx.constraintlayout.core.motion.parse.KeyParser.DataType
public final int get(int i) {
return TypedValues.AttributesType.CC.getType(i);
}
});
}
public static void main(String[] strArr) {
parseAttributes("{frame:22,\ntarget:'widget1',\neasing:'easeIn',\ncurveFit:'spline',\nprogress:0.3,\nalpha:0.2,\nelevation:0.7,\nrotationZ:23,\nrotationX:25.0,\nrotationY:27.0,\npivotX:15,\npivotY:17,\npivotTarget:'32',\npathRotate:23,\nscaleX:0.5,\nscaleY:0.7,\ntranslationX:5,\ntranslationY:7,\ntranslationZ:11,\n}");
}
}

View File

@ -0,0 +1,516 @@
package androidx.constraintlayout.core.motion.utils;
import java.util.Arrays;
/* loaded from: classes.dex */
public class ArcCurveFit extends CurveFit {
public static final int ARC_START_FLIP = 3;
public static final int ARC_START_HORIZONTAL = 2;
public static final int ARC_START_LINEAR = 0;
public static final int ARC_START_VERTICAL = 1;
private static final int START_HORIZONTAL = 2;
private static final int START_LINEAR = 3;
private static final int START_VERTICAL = 1;
Arc[] mArcs;
private boolean mExtrapolate = true;
private final double[] mTime;
@Override // androidx.constraintlayout.core.motion.utils.CurveFit
public double[] getTimePoints() {
return this.mTime;
}
@Override // androidx.constraintlayout.core.motion.utils.CurveFit
public void getPos(double d, double[] dArr) {
if (!this.mExtrapolate) {
if (d < this.mArcs[0].mTime1) {
d = this.mArcs[0].mTime1;
}
Arc[] arcArr = this.mArcs;
if (d > arcArr[arcArr.length - 1].mTime2) {
Arc[] arcArr2 = this.mArcs;
d = arcArr2[arcArr2.length - 1].mTime2;
}
} else {
if (d < this.mArcs[0].mTime1) {
double d2 = this.mArcs[0].mTime1;
double d3 = d - this.mArcs[0].mTime1;
if (this.mArcs[0].linear) {
dArr[0] = this.mArcs[0].getLinearX(d2) + (this.mArcs[0].getLinearDX(d2) * d3);
dArr[1] = this.mArcs[0].getLinearY(d2) + (d3 * this.mArcs[0].getLinearDY(d2));
return;
} else {
this.mArcs[0].setPoint(d2);
dArr[0] = this.mArcs[0].getX() + (this.mArcs[0].getDX() * d3);
dArr[1] = this.mArcs[0].getY() + (d3 * this.mArcs[0].getDY());
return;
}
}
Arc[] arcArr3 = this.mArcs;
if (d > arcArr3[arcArr3.length - 1].mTime2) {
Arc[] arcArr4 = this.mArcs;
double d4 = arcArr4[arcArr4.length - 1].mTime2;
double d5 = d - d4;
Arc[] arcArr5 = this.mArcs;
int length = arcArr5.length - 1;
if (arcArr5[length].linear) {
dArr[0] = this.mArcs[length].getLinearX(d4) + (this.mArcs[length].getLinearDX(d4) * d5);
dArr[1] = this.mArcs[length].getLinearY(d4) + (d5 * this.mArcs[length].getLinearDY(d4));
return;
} else {
this.mArcs[length].setPoint(d);
dArr[0] = this.mArcs[length].getX() + (this.mArcs[length].getDX() * d5);
dArr[1] = this.mArcs[length].getY() + (d5 * this.mArcs[length].getDY());
return;
}
}
}
int i = 0;
while (true) {
Arc[] arcArr6 = this.mArcs;
if (i >= arcArr6.length) {
return;
}
if (d <= arcArr6[i].mTime2) {
if (this.mArcs[i].linear) {
dArr[0] = this.mArcs[i].getLinearX(d);
dArr[1] = this.mArcs[i].getLinearY(d);
return;
} else {
this.mArcs[i].setPoint(d);
dArr[0] = this.mArcs[i].getX();
dArr[1] = this.mArcs[i].getY();
return;
}
}
i++;
}
}
@Override // androidx.constraintlayout.core.motion.utils.CurveFit
public void getPos(double d, float[] fArr) {
if (this.mExtrapolate) {
if (d < this.mArcs[0].mTime1) {
double d2 = this.mArcs[0].mTime1;
double d3 = d - this.mArcs[0].mTime1;
if (this.mArcs[0].linear) {
fArr[0] = (float) (this.mArcs[0].getLinearX(d2) + (this.mArcs[0].getLinearDX(d2) * d3));
fArr[1] = (float) (this.mArcs[0].getLinearY(d2) + (d3 * this.mArcs[0].getLinearDY(d2)));
return;
} else {
this.mArcs[0].setPoint(d2);
fArr[0] = (float) (this.mArcs[0].getX() + (this.mArcs[0].getDX() * d3));
fArr[1] = (float) (this.mArcs[0].getY() + (d3 * this.mArcs[0].getDY()));
return;
}
}
Arc[] arcArr = this.mArcs;
if (d > arcArr[arcArr.length - 1].mTime2) {
Arc[] arcArr2 = this.mArcs;
double d4 = arcArr2[arcArr2.length - 1].mTime2;
double d5 = d - d4;
Arc[] arcArr3 = this.mArcs;
int length = arcArr3.length - 1;
if (arcArr3[length].linear) {
fArr[0] = (float) (this.mArcs[length].getLinearX(d4) + (this.mArcs[length].getLinearDX(d4) * d5));
fArr[1] = (float) (this.mArcs[length].getLinearY(d4) + (d5 * this.mArcs[length].getLinearDY(d4)));
return;
} else {
this.mArcs[length].setPoint(d);
fArr[0] = (float) this.mArcs[length].getX();
fArr[1] = (float) this.mArcs[length].getY();
return;
}
}
} else if (d < this.mArcs[0].mTime1) {
d = this.mArcs[0].mTime1;
} else {
Arc[] arcArr4 = this.mArcs;
if (d > arcArr4[arcArr4.length - 1].mTime2) {
Arc[] arcArr5 = this.mArcs;
d = arcArr5[arcArr5.length - 1].mTime2;
}
}
int i = 0;
while (true) {
Arc[] arcArr6 = this.mArcs;
if (i >= arcArr6.length) {
return;
}
if (d <= arcArr6[i].mTime2) {
if (this.mArcs[i].linear) {
fArr[0] = (float) this.mArcs[i].getLinearX(d);
fArr[1] = (float) this.mArcs[i].getLinearY(d);
return;
} else {
this.mArcs[i].setPoint(d);
fArr[0] = (float) this.mArcs[i].getX();
fArr[1] = (float) this.mArcs[i].getY();
return;
}
}
i++;
}
}
@Override // androidx.constraintlayout.core.motion.utils.CurveFit
public void getSlope(double d, double[] dArr) {
if (d < this.mArcs[0].mTime1) {
d = this.mArcs[0].mTime1;
} else {
Arc[] arcArr = this.mArcs;
if (d > arcArr[arcArr.length - 1].mTime2) {
Arc[] arcArr2 = this.mArcs;
d = arcArr2[arcArr2.length - 1].mTime2;
}
}
int i = 0;
while (true) {
Arc[] arcArr3 = this.mArcs;
if (i >= arcArr3.length) {
return;
}
if (d <= arcArr3[i].mTime2) {
if (this.mArcs[i].linear) {
dArr[0] = this.mArcs[i].getLinearDX(d);
dArr[1] = this.mArcs[i].getLinearDY(d);
return;
} else {
this.mArcs[i].setPoint(d);
dArr[0] = this.mArcs[i].getDX();
dArr[1] = this.mArcs[i].getDY();
return;
}
}
i++;
}
}
@Override // androidx.constraintlayout.core.motion.utils.CurveFit
public double getPos(double d, int i) {
double d2;
double linearY;
double linearDY;
double y;
double dy;
int i2 = 0;
if (this.mExtrapolate) {
if (d < this.mArcs[0].mTime1) {
double d3 = this.mArcs[0].mTime1;
d2 = d - this.mArcs[0].mTime1;
if (!this.mArcs[0].linear) {
this.mArcs[0].setPoint(d3);
if (i == 0) {
y = this.mArcs[0].getX();
dy = this.mArcs[0].getDX();
} else {
y = this.mArcs[0].getY();
dy = this.mArcs[0].getDY();
}
return y + (d2 * dy);
}
if (i == 0) {
linearY = this.mArcs[0].getLinearX(d3);
linearDY = this.mArcs[0].getLinearDX(d3);
} else {
linearY = this.mArcs[0].getLinearY(d3);
linearDY = this.mArcs[0].getLinearDY(d3);
}
} else {
if (d > this.mArcs[r0.length - 1].mTime2) {
double d4 = this.mArcs[r0.length - 1].mTime2;
d2 = d - d4;
Arc[] arcArr = this.mArcs;
int length = arcArr.length - 1;
if (i == 0) {
linearY = arcArr[length].getLinearX(d4);
linearDY = this.mArcs[length].getLinearDX(d4);
} else {
linearY = arcArr[length].getLinearY(d4);
linearDY = this.mArcs[length].getLinearDY(d4);
}
}
}
return linearY + (d2 * linearDY);
}
if (d < this.mArcs[0].mTime1) {
d = this.mArcs[0].mTime1;
} else {
if (d > this.mArcs[r0.length - 1].mTime2) {
d = this.mArcs[r7.length - 1].mTime2;
}
}
while (true) {
Arc[] arcArr2 = this.mArcs;
if (i2 >= arcArr2.length) {
return Double.NaN;
}
if (d <= arcArr2[i2].mTime2) {
if (this.mArcs[i2].linear) {
if (i == 0) {
return this.mArcs[i2].getLinearX(d);
}
return this.mArcs[i2].getLinearY(d);
}
this.mArcs[i2].setPoint(d);
if (i == 0) {
return this.mArcs[i2].getX();
}
return this.mArcs[i2].getY();
}
i2++;
}
}
@Override // androidx.constraintlayout.core.motion.utils.CurveFit
public double getSlope(double d, int i) {
int i2 = 0;
if (d < this.mArcs[0].mTime1) {
d = this.mArcs[0].mTime1;
}
if (d > this.mArcs[r0.length - 1].mTime2) {
d = this.mArcs[r5.length - 1].mTime2;
}
while (true) {
Arc[] arcArr = this.mArcs;
if (i2 >= arcArr.length) {
return Double.NaN;
}
if (d <= arcArr[i2].mTime2) {
if (this.mArcs[i2].linear) {
if (i == 0) {
return this.mArcs[i2].getLinearDX(d);
}
return this.mArcs[i2].getLinearDY(d);
}
this.mArcs[i2].setPoint(d);
if (i == 0) {
return this.mArcs[i2].getDX();
}
return this.mArcs[i2].getDY();
}
i2++;
}
}
public ArcCurveFit(int[] iArr, double[] dArr, double[][] dArr2) {
this.mTime = dArr;
this.mArcs = new Arc[dArr.length - 1];
int i = 0;
int i2 = 1;
int i3 = 1;
while (true) {
Arc[] arcArr = this.mArcs;
if (i >= arcArr.length) {
return;
}
int i4 = iArr[i];
if (i4 == 0) {
i3 = 3;
} else if (i4 == 1) {
i2 = 1;
i3 = 1;
} else if (i4 == 2) {
i2 = 2;
i3 = 2;
} else if (i4 == 3) {
i2 = i2 == 1 ? 2 : 1;
i3 = i2;
}
double d = dArr[i];
int i5 = i + 1;
double d2 = dArr[i5];
double[] dArr3 = dArr2[i];
double d3 = dArr3[0];
double d4 = dArr3[1];
double[] dArr4 = dArr2[i5];
arcArr[i] = new Arc(i3, d, d2, d3, d4, dArr4[0], dArr4[1]);
i = i5;
}
}
private static class Arc {
private static final double EPSILON = 0.001d;
private static final String TAG = "Arc";
private static double[] ourPercent = new double[91];
boolean linear;
double mArcDistance;
double mArcVelocity;
double mEllipseA;
double mEllipseB;
double mEllipseCenterX;
double mEllipseCenterY;
double[] mLut;
double mOneOverDeltaTime;
double mTime1;
double mTime2;
double mTmpCosAngle;
double mTmpSinAngle;
boolean mVertical;
double mX1;
double mX2;
double mY1;
double mY2;
public double getLinearDX(double d) {
return this.mEllipseCenterX;
}
public double getLinearDY(double d) {
return this.mEllipseCenterY;
}
public double getLinearX(double d) {
double d2 = (d - this.mTime1) * this.mOneOverDeltaTime;
double d3 = this.mX1;
return d3 + (d2 * (this.mX2 - d3));
}
public double getLinearY(double d) {
double d2 = (d - this.mTime1) * this.mOneOverDeltaTime;
double d3 = this.mY1;
return d3 + (d2 * (this.mY2 - d3));
}
double getX() {
return this.mEllipseCenterX + (this.mEllipseA * this.mTmpSinAngle);
}
double getY() {
return this.mEllipseCenterY + (this.mEllipseB * this.mTmpCosAngle);
}
Arc(int i, double d, double d2, double d3, double d4, double d5, double d6) {
this.linear = false;
this.mVertical = i == 1;
this.mTime1 = d;
this.mTime2 = d2;
this.mOneOverDeltaTime = 1.0d / (d2 - d);
if (3 == i) {
this.linear = true;
}
double d7 = d5 - d3;
double d8 = d6 - d4;
if (this.linear || Math.abs(d7) < EPSILON || Math.abs(d8) < EPSILON) {
this.linear = true;
this.mX1 = d3;
this.mX2 = d5;
this.mY1 = d4;
this.mY2 = d6;
double hypot = Math.hypot(d8, d7);
this.mArcDistance = hypot;
this.mArcVelocity = hypot * this.mOneOverDeltaTime;
double d9 = this.mTime2;
double d10 = this.mTime1;
this.mEllipseCenterX = d7 / (d9 - d10);
this.mEllipseCenterY = d8 / (d9 - d10);
return;
}
this.mLut = new double[101];
boolean z = this.mVertical;
this.mEllipseA = d7 * (z ? -1 : 1);
this.mEllipseB = d8 * (z ? 1 : -1);
this.mEllipseCenterX = z ? d5 : d3;
this.mEllipseCenterY = z ? d4 : d6;
buildTable(d3, d4, d5, d6);
this.mArcVelocity = this.mArcDistance * this.mOneOverDeltaTime;
}
void setPoint(double d) {
double lookup = lookup((this.mVertical ? this.mTime2 - d : d - this.mTime1) * this.mOneOverDeltaTime) * 1.5707963267948966d;
this.mTmpSinAngle = Math.sin(lookup);
this.mTmpCosAngle = Math.cos(lookup);
}
double getDX() {
double d = this.mEllipseA * this.mTmpCosAngle;
double hypot = this.mArcVelocity / Math.hypot(d, (-this.mEllipseB) * this.mTmpSinAngle);
if (this.mVertical) {
d = -d;
}
return d * hypot;
}
double getDY() {
double d = this.mEllipseA * this.mTmpCosAngle;
double d2 = (-this.mEllipseB) * this.mTmpSinAngle;
double hypot = this.mArcVelocity / Math.hypot(d, d2);
return this.mVertical ? (-d2) * hypot : d2 * hypot;
}
double lookup(double d) {
if (d <= 0.0d) {
return 0.0d;
}
if (d >= 1.0d) {
return 1.0d;
}
double[] dArr = this.mLut;
double length = d * (dArr.length - 1);
int i = (int) length;
double d2 = length - i;
double d3 = dArr[i];
return d3 + (d2 * (dArr[i + 1] - d3));
}
private void buildTable(double d, double d2, double d3, double d4) {
double d5;
double d6 = d3 - d;
double d7 = d2 - d4;
int i = 0;
double d8 = 0.0d;
double d9 = 0.0d;
double d10 = 0.0d;
while (true) {
if (i >= ourPercent.length) {
break;
}
double d11 = d8;
double radians = Math.toRadians((i * 90.0d) / (r15.length - 1));
double sin = Math.sin(radians) * d6;
double cos = Math.cos(radians) * d7;
if (i > 0) {
d5 = Math.hypot(sin - d9, cos - d10) + d11;
ourPercent[i] = d5;
} else {
d5 = d11;
}
i++;
d10 = cos;
d8 = d5;
d9 = sin;
}
double d12 = d8;
this.mArcDistance = d12;
int i2 = 0;
while (true) {
double[] dArr = ourPercent;
if (i2 >= dArr.length) {
break;
}
dArr[i2] = dArr[i2] / d12;
i2++;
}
int i3 = 0;
while (true) {
if (i3 >= this.mLut.length) {
return;
}
double length = i3 / (r1.length - 1);
int binarySearch = Arrays.binarySearch(ourPercent, length);
if (binarySearch >= 0) {
this.mLut[i3] = binarySearch / (ourPercent.length - 1);
} else if (binarySearch == -1) {
this.mLut[i3] = 0.0d;
} else {
int i4 = -binarySearch;
int i5 = i4 - 2;
double[] dArr2 = ourPercent;
double d13 = dArr2[i5];
this.mLut[i3] = (i5 + ((length - d13) / (dArr2[i4 - 1] - d13))) / (dArr2.length - 1);
}
i3++;
}
}
}
}

View File

@ -0,0 +1,88 @@
package androidx.constraintlayout.core.motion.utils;
/* loaded from: classes.dex */
public abstract class CurveFit {
public static final int CONSTANT = 2;
public static final int LINEAR = 1;
public static final int SPLINE = 0;
public abstract double getPos(double d, int i);
public abstract void getPos(double d, double[] dArr);
public abstract void getPos(double d, float[] fArr);
public abstract double getSlope(double d, int i);
public abstract void getSlope(double d, double[] dArr);
public abstract double[] getTimePoints();
public static CurveFit get(int i, double[] dArr, double[][] dArr2) {
if (dArr.length == 1) {
i = 2;
}
if (i == 0) {
return new MonotonicCurveFit(dArr, dArr2);
}
if (i == 2) {
return new Constant(dArr[0], dArr2[0]);
}
return new LinearCurveFit(dArr, dArr2);
}
public static CurveFit getArc(int[] iArr, double[] dArr, double[][] dArr2) {
return new ArcCurveFit(iArr, dArr, dArr2);
}
static class Constant extends CurveFit {
double mTime;
double[] mValue;
@Override // androidx.constraintlayout.core.motion.utils.CurveFit
public double getSlope(double d, int i) {
return 0.0d;
}
@Override // androidx.constraintlayout.core.motion.utils.CurveFit
public double[] getTimePoints() {
return new double[]{this.mTime};
}
Constant(double d, double[] dArr) {
this.mTime = d;
this.mValue = dArr;
}
@Override // androidx.constraintlayout.core.motion.utils.CurveFit
public void getPos(double d, double[] dArr) {
double[] dArr2 = this.mValue;
System.arraycopy(dArr2, 0, dArr, 0, dArr2.length);
}
@Override // androidx.constraintlayout.core.motion.utils.CurveFit
public void getPos(double d, float[] fArr) {
int i = 0;
while (true) {
double[] dArr = this.mValue;
if (i >= dArr.length) {
return;
}
fArr[i] = (float) dArr[i];
i++;
}
}
@Override // androidx.constraintlayout.core.motion.utils.CurveFit
public double getPos(double d, int i) {
return this.mValue[i];
}
@Override // androidx.constraintlayout.core.motion.utils.CurveFit
public void getSlope(double d, double[] dArr) {
for (int i = 0; i < this.mValue.length; i++) {
dArr[i] = 0.0d;
}
}
}
}

View File

@ -0,0 +1,8 @@
package androidx.constraintlayout.core.motion.utils;
/* loaded from: classes.dex */
public interface DifferentialInterpolator {
float getInterpolation(float f);
float getVelocity();
}

View File

@ -0,0 +1,163 @@
package androidx.constraintlayout.core.motion.utils;
import java.util.Arrays;
/* loaded from: classes.dex */
public class Easing {
private static final String ACCELERATE = "cubic(0.4, 0.05, 0.8, 0.7)";
private static final String ANTICIPATE = "cubic(0.36, 0, 0.66, -0.56)";
private static final String ANTICIPATE_NAME = "anticipate";
private static final String DECELERATE = "cubic(0.0, 0.0, 0.2, 0.95)";
private static final String LINEAR = "cubic(1, 1, 0, 0)";
private static final String OVERSHOOT = "cubic(0.34, 1.56, 0.64, 1)";
private static final String OVERSHOOT_NAME = "overshoot";
private static final String STANDARD = "cubic(0.4, 0.0, 0.2, 1)";
String str = "identity";
static Easing sDefault = new Easing();
private static final String STANDARD_NAME = "standard";
private static final String ACCELERATE_NAME = "accelerate";
private static final String DECELERATE_NAME = "decelerate";
private static final String LINEAR_NAME = "linear";
public static String[] NAMED_EASING = {STANDARD_NAME, ACCELERATE_NAME, DECELERATE_NAME, LINEAR_NAME};
public double get(double d) {
return d;
}
public double getDiff(double d) {
return 1.0d;
}
public String toString() {
return this.str;
}
public static Easing getInterpolator(String str) {
if (str == null) {
return null;
}
if (str.startsWith("cubic")) {
return new CubicEasing(str);
}
if (str.startsWith("spline")) {
return new StepCurve(str);
}
if (str.startsWith("Schlick")) {
return new Schlick(str);
}
str.hashCode();
switch (str) {
case "accelerate":
return new CubicEasing(ACCELERATE);
case "decelerate":
return new CubicEasing(DECELERATE);
case "anticipate":
return new CubicEasing(ANTICIPATE);
case "linear":
return new CubicEasing(LINEAR);
case "overshoot":
return new CubicEasing(OVERSHOOT);
case "standard":
return new CubicEasing(STANDARD);
default:
System.err.println("transitionEasing syntax error syntax:transitionEasing=\"cubic(1.0,0.5,0.0,0.6)\" or " + Arrays.toString(NAMED_EASING));
return sDefault;
}
}
static class CubicEasing extends Easing {
private static double d_error = 1.0E-4d;
private static double error = 0.01d;
double x1;
double x2;
double y1;
double y2;
private double getDiffX(double d) {
double d2 = 1.0d - d;
double d3 = this.x1;
double d4 = this.x2;
return (d2 * 3.0d * d2 * d3) + (d2 * 6.0d * d * (d4 - d3)) + (3.0d * d * d * (1.0d - d4));
}
private double getDiffY(double d) {
double d2 = 1.0d - d;
double d3 = this.y1;
double d4 = this.y2;
return (d2 * 3.0d * d2 * d3) + (d2 * 6.0d * d * (d4 - d3)) + (3.0d * d * d * (1.0d - d4));
}
private double getX(double d) {
double d2 = 1.0d - d;
double d3 = 3.0d * d2;
return (this.x1 * d2 * d3 * d) + (this.x2 * d3 * d * d) + (d * d * d);
}
private double getY(double d) {
double d2 = 1.0d - d;
double d3 = 3.0d * d2;
return (this.y1 * d2 * d3 * d) + (this.y2 * d3 * d * d) + (d * d * d);
}
void setup(double d, double d2, double d3, double d4) {
this.x1 = d;
this.y1 = d2;
this.x2 = d3;
this.y2 = d4;
}
CubicEasing(String str) {
this.str = str;
int indexOf = str.indexOf(40);
int indexOf2 = str.indexOf(44, indexOf);
this.x1 = Double.parseDouble(str.substring(indexOf + 1, indexOf2).trim());
int i = indexOf2 + 1;
int indexOf3 = str.indexOf(44, i);
this.y1 = Double.parseDouble(str.substring(i, indexOf3).trim());
int i2 = indexOf3 + 1;
int indexOf4 = str.indexOf(44, i2);
this.x2 = Double.parseDouble(str.substring(i2, indexOf4).trim());
int i3 = indexOf4 + 1;
this.y2 = Double.parseDouble(str.substring(i3, str.indexOf(41, i3)).trim());
}
public CubicEasing(double d, double d2, double d3, double d4) {
setup(d, d2, d3, d4);
}
@Override // androidx.constraintlayout.core.motion.utils.Easing
public double getDiff(double d) {
double d2 = 0.5d;
double d3 = 0.5d;
while (d2 > d_error) {
d2 *= 0.5d;
d3 = getX(d3) < d ? d3 + d2 : d3 - d2;
}
double d4 = d3 - d2;
double d5 = d3 + d2;
return (getY(d5) - getY(d4)) / (getX(d5) - getX(d4));
}
@Override // androidx.constraintlayout.core.motion.utils.Easing
public double get(double d) {
if (d <= 0.0d) {
return 0.0d;
}
if (d >= 1.0d) {
return 1.0d;
}
double d2 = 0.5d;
double d3 = 0.5d;
while (d2 > error) {
d2 *= 0.5d;
d3 = getX(d3) < d ? d3 + d2 : d3 - d2;
}
double d4 = d3 - d2;
double x = getX(d4);
double d5 = d3 + d2;
double x2 = getX(d5);
double y = getY(d4);
return (((getY(d5) - y) * (d - x)) / (x2 - x)) + y;
}
}
}

View File

@ -0,0 +1,17 @@
package androidx.constraintlayout.core.motion.utils;
/* loaded from: classes.dex */
public class FloatRect {
public float bottom;
public float left;
public float right;
public float top;
public final float centerX() {
return (this.left + this.right) * 0.5f;
}
public final float centerY() {
return (this.top + this.bottom) * 0.5f;
}
}

View File

@ -0,0 +1,237 @@
package androidx.constraintlayout.core.motion.utils;
import java.lang.reflect.Array;
/* loaded from: classes.dex */
public class HyperSpline {
double[][] mCtl;
Cubic[][] mCurve;
double[] mCurveLength;
int mDimensionality;
int mPoints;
double mTotalLength;
public HyperSpline(double[][] dArr) {
setup(dArr);
}
public HyperSpline() {
}
public void setup(double[][] dArr) {
int i;
int length = dArr[0].length;
this.mDimensionality = length;
int length2 = dArr.length;
this.mPoints = length2;
this.mCtl = (double[][]) Array.newInstance((Class<?>) Double.TYPE, length, length2);
this.mCurve = new Cubic[this.mDimensionality][];
for (int i2 = 0; i2 < this.mDimensionality; i2++) {
for (int i3 = 0; i3 < this.mPoints; i3++) {
this.mCtl[i2][i3] = dArr[i3][i2];
}
}
int i4 = 0;
while (true) {
i = this.mDimensionality;
if (i4 >= i) {
break;
}
Cubic[][] cubicArr = this.mCurve;
double[] dArr2 = this.mCtl[i4];
cubicArr[i4] = calcNaturalCubic(dArr2.length, dArr2);
i4++;
}
this.mCurveLength = new double[this.mPoints - 1];
this.mTotalLength = 0.0d;
Cubic[] cubicArr2 = new Cubic[i];
for (int i5 = 0; i5 < this.mCurveLength.length; i5++) {
for (int i6 = 0; i6 < this.mDimensionality; i6++) {
cubicArr2[i6] = this.mCurve[i6][i5];
}
double d = this.mTotalLength;
double[] dArr3 = this.mCurveLength;
double approxLength = approxLength(cubicArr2);
dArr3[i5] = approxLength;
this.mTotalLength = d + approxLength;
}
}
public void getVelocity(double d, double[] dArr) {
double d2 = d * this.mTotalLength;
int i = 0;
while (true) {
double[] dArr2 = this.mCurveLength;
if (i >= dArr2.length - 1) {
break;
}
double d3 = dArr2[i];
if (d3 >= d2) {
break;
}
d2 -= d3;
i++;
}
for (int i2 = 0; i2 < dArr.length; i2++) {
dArr[i2] = this.mCurve[i2][i].vel(d2 / this.mCurveLength[i]);
}
}
public void getPos(double d, double[] dArr) {
double d2 = d * this.mTotalLength;
int i = 0;
while (true) {
double[] dArr2 = this.mCurveLength;
if (i >= dArr2.length - 1) {
break;
}
double d3 = dArr2[i];
if (d3 >= d2) {
break;
}
d2 -= d3;
i++;
}
for (int i2 = 0; i2 < dArr.length; i2++) {
dArr[i2] = this.mCurve[i2][i].eval(d2 / this.mCurveLength[i]);
}
}
public void getPos(double d, float[] fArr) {
double d2 = d * this.mTotalLength;
int i = 0;
while (true) {
double[] dArr = this.mCurveLength;
if (i >= dArr.length - 1) {
break;
}
double d3 = dArr[i];
if (d3 >= d2) {
break;
}
d2 -= d3;
i++;
}
for (int i2 = 0; i2 < fArr.length; i2++) {
fArr[i2] = (float) this.mCurve[i2][i].eval(d2 / this.mCurveLength[i]);
}
}
public double getPos(double d, int i) {
double[] dArr;
double d2 = d * this.mTotalLength;
int i2 = 0;
while (true) {
dArr = this.mCurveLength;
if (i2 >= dArr.length - 1) {
break;
}
double d3 = dArr[i2];
if (d3 >= d2) {
break;
}
d2 -= d3;
i2++;
}
return this.mCurve[i][i2].eval(d2 / dArr[i2]);
}
public double approxLength(Cubic[] cubicArr) {
int i;
int length = cubicArr.length;
double[] dArr = new double[cubicArr.length];
double d = 0.0d;
double d2 = 0.0d;
double d3 = 0.0d;
while (true) {
i = 0;
if (d2 >= 1.0d) {
break;
}
double d4 = 0.0d;
while (i < cubicArr.length) {
double d5 = dArr[i];
double eval = cubicArr[i].eval(d2);
dArr[i] = eval;
double d6 = d5 - eval;
d4 += d6 * d6;
i++;
}
if (d2 > 0.0d) {
d3 += Math.sqrt(d4);
}
d2 += 0.1d;
}
while (i < cubicArr.length) {
double d7 = dArr[i];
double eval2 = cubicArr[i].eval(1.0d);
dArr[i] = eval2;
double d8 = d7 - eval2;
d += d8 * d8;
i++;
}
return d3 + Math.sqrt(d);
}
static Cubic[] calcNaturalCubic(int i, double[] dArr) {
double[] dArr2 = new double[i];
double[] dArr3 = new double[i];
double[] dArr4 = new double[i];
int i2 = i - 1;
int i3 = 0;
dArr2[0] = 0.5d;
int i4 = 1;
for (int i5 = 1; i5 < i2; i5++) {
dArr2[i5] = 1.0d / (4.0d - dArr2[i5 - 1]);
}
int i6 = i - 2;
dArr2[i2] = 1.0d / (2.0d - dArr2[i6]);
dArr3[0] = (dArr[1] - dArr[0]) * 3.0d * dArr2[0];
while (i4 < i2) {
int i7 = i4 + 1;
int i8 = i4 - 1;
dArr3[i4] = (((dArr[i7] - dArr[i8]) * 3.0d) - dArr3[i8]) * dArr2[i4];
i4 = i7;
}
double d = (((dArr[i2] - dArr[i6]) * 3.0d) - dArr3[i6]) * dArr2[i2];
dArr3[i2] = d;
dArr4[i2] = d;
while (i6 >= 0) {
dArr4[i6] = dArr3[i6] - (dArr2[i6] * dArr4[i6 + 1]);
i6--;
}
Cubic[] cubicArr = new Cubic[i2];
while (i3 < i2) {
double d2 = dArr[i3];
double d3 = dArr4[i3];
int i9 = i3 + 1;
double d4 = dArr[i9];
double d5 = dArr4[i9];
cubicArr[i3] = new Cubic((float) d2, d3, (((d4 - d2) * 3.0d) - (d3 * 2.0d)) - d5, ((d2 - d4) * 2.0d) + d3 + d5);
i3 = i9;
}
return cubicArr;
}
public static class Cubic {
double mA;
double mB;
double mC;
double mD;
public double eval(double d) {
return (((((this.mD * d) + this.mC) * d) + this.mB) * d) + this.mA;
}
public double vel(double d) {
return (((this.mD * 3.0d * d) + (this.mC * 2.0d)) * d) + this.mB;
}
public Cubic(double d, double d2, double d3, double d4) {
this.mA = d;
this.mB = d2;
this.mC = d3;
this.mD = d4;
}
}
}

View File

@ -0,0 +1,49 @@
package androidx.constraintlayout.core.motion.utils;
import java.util.Arrays;
import java.util.HashMap;
/* loaded from: classes.dex */
public class KeyCache {
HashMap<Object, HashMap<String, float[]>> map = new HashMap<>();
public void setFloatValue(Object obj, String str, int i, float f) {
if (!this.map.containsKey(obj)) {
HashMap<String, float[]> hashMap = new HashMap<>();
float[] fArr = new float[i + 1];
fArr[i] = f;
hashMap.put(str, fArr);
this.map.put(obj, hashMap);
return;
}
HashMap<String, float[]> hashMap2 = this.map.get(obj);
if (hashMap2 == null) {
hashMap2 = new HashMap<>();
}
if (!hashMap2.containsKey(str)) {
float[] fArr2 = new float[i + 1];
fArr2[i] = f;
hashMap2.put(str, fArr2);
this.map.put(obj, hashMap2);
return;
}
float[] fArr3 = hashMap2.get(str);
if (fArr3 == null) {
fArr3 = new float[0];
}
if (fArr3.length <= i) {
fArr3 = Arrays.copyOf(fArr3, i + 1);
}
fArr3[i] = f;
hashMap2.put(str, fArr3);
}
public float getFloatValue(Object obj, String str, int i) {
HashMap<String, float[]> hashMap;
float[] fArr;
if (this.map.containsKey(obj) && (hashMap = this.map.get(obj)) != null && hashMap.containsKey(str) && (fArr = hashMap.get(str)) != null && fArr.length > i) {
return fArr[i];
}
return Float.NaN;
}
}

View File

@ -0,0 +1,381 @@
package androidx.constraintlayout.core.motion.utils;
import androidx.constraintlayout.core.motion.MotionWidget;
import androidx.constraintlayout.core.motion.utils.TypedValues;
import java.lang.reflect.Array;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
/* loaded from: classes.dex */
public abstract class KeyCycleOscillator {
private static final String TAG = "KeyCycleOscillator";
private CurveFit mCurveFit;
private CycleOscillator mCycleOscillator;
private String mType;
private int mWaveShape = 0;
private String mWaveString = null;
public int mVariesBy = 0;
ArrayList<WavePoint> mWavePoints = new ArrayList<>();
public CurveFit getCurveFit() {
return this.mCurveFit;
}
protected void setCustom(Object obj) {
}
public void setProperty(MotionWidget motionWidget, float f) {
}
public void setType(String str) {
this.mType = str;
}
public boolean variesByPath() {
return this.mVariesBy == 1;
}
public static KeyCycleOscillator makeWidgetCycle(String str) {
if (str.equals("pathRotate")) {
return new PathRotateSet(str);
}
return new CoreSpline(str);
}
private static class CoreSpline extends KeyCycleOscillator {
String type;
int typeId;
public CoreSpline(String str) {
this.type = str;
this.typeId = TypedValues.CycleType.CC.getId(str);
}
@Override // androidx.constraintlayout.core.motion.utils.KeyCycleOscillator
public void setProperty(MotionWidget motionWidget, float f) {
motionWidget.setValue(this.typeId, get(f));
}
}
public static class PathRotateSet extends KeyCycleOscillator {
String type;
int typeId;
public PathRotateSet(String str) {
this.type = str;
this.typeId = TypedValues.CycleType.CC.getId(str);
}
@Override // androidx.constraintlayout.core.motion.utils.KeyCycleOscillator
public void setProperty(MotionWidget motionWidget, float f) {
motionWidget.setValue(this.typeId, get(f));
}
public void setPathRotate(MotionWidget motionWidget, float f, double d, double d2) {
motionWidget.setRotationZ(get(f) + ((float) Math.toDegrees(Math.atan2(d2, d))));
}
}
static class WavePoint {
float mOffset;
float mPeriod;
float mPhase;
int mPosition;
float mValue;
public WavePoint(int i, float f, float f2, float f3, float f4) {
this.mPosition = i;
this.mValue = f4;
this.mOffset = f2;
this.mPeriod = f;
this.mPhase = f3;
}
}
public String toString() {
String str = this.mType;
DecimalFormat decimalFormat = new DecimalFormat("##.##");
Iterator<WavePoint> it = this.mWavePoints.iterator();
while (it.hasNext()) {
str = str + "[" + it.next().mPosition + " , " + decimalFormat.format(r3.mValue) + "] ";
}
return str;
}
public float get(float f) {
return (float) this.mCycleOscillator.getValues(f);
}
public float getSlope(float f) {
return (float) this.mCycleOscillator.getSlope(f);
}
public void setPoint(int i, int i2, String str, int i3, float f, float f2, float f3, float f4, Object obj) {
this.mWavePoints.add(new WavePoint(i, f, f2, f3, f4));
if (i3 != -1) {
this.mVariesBy = i3;
}
this.mWaveShape = i2;
setCustom(obj);
this.mWaveString = str;
}
public void setPoint(int i, int i2, String str, int i3, float f, float f2, float f3, float f4) {
this.mWavePoints.add(new WavePoint(i, f, f2, f3, f4));
if (i3 != -1) {
this.mVariesBy = i3;
}
this.mWaveShape = i2;
this.mWaveString = str;
}
public void setup(float f) {
int size = this.mWavePoints.size();
if (size == 0) {
return;
}
Collections.sort(this.mWavePoints, new Comparator<WavePoint>() { // from class: androidx.constraintlayout.core.motion.utils.KeyCycleOscillator.1
@Override // java.util.Comparator
public int compare(WavePoint wavePoint, WavePoint wavePoint2) {
return Integer.compare(wavePoint.mPosition, wavePoint2.mPosition);
}
});
double[] dArr = new double[size];
double[][] dArr2 = (double[][]) Array.newInstance((Class<?>) Double.TYPE, size, 3);
this.mCycleOscillator = new CycleOscillator(this.mWaveShape, this.mWaveString, this.mVariesBy, size);
Iterator<WavePoint> it = this.mWavePoints.iterator();
int i = 0;
while (it.hasNext()) {
WavePoint next = it.next();
dArr[i] = next.mPeriod * 0.01d;
dArr2[i][0] = next.mValue;
dArr2[i][1] = next.mOffset;
dArr2[i][2] = next.mPhase;
this.mCycleOscillator.setPoint(i, next.mPosition, next.mPeriod, next.mOffset, next.mPhase, next.mValue);
i++;
}
this.mCycleOscillator.setup(f);
this.mCurveFit = CurveFit.get(0, dArr, dArr2);
}
private static class IntDoubleSort {
private IntDoubleSort() {
}
static void sort(int[] iArr, float[] fArr, int i, int i2) {
int[] iArr2 = new int[iArr.length + 10];
iArr2[0] = i2;
iArr2[1] = i;
int i3 = 2;
while (i3 > 0) {
int i4 = iArr2[i3 - 1];
int i5 = i3 - 2;
int i6 = iArr2[i5];
if (i4 < i6) {
int partition = partition(iArr, fArr, i4, i6);
iArr2[i5] = partition - 1;
iArr2[i3 - 1] = i4;
int i7 = i3 + 1;
iArr2[i3] = i6;
i3 += 2;
iArr2[i7] = partition + 1;
} else {
i3 = i5;
}
}
}
private static int partition(int[] iArr, float[] fArr, int i, int i2) {
int i3 = iArr[i2];
int i4 = i;
while (i < i2) {
if (iArr[i] <= i3) {
swap(iArr, fArr, i4, i);
i4++;
}
i++;
}
swap(iArr, fArr, i4, i2);
return i4;
}
private static void swap(int[] iArr, float[] fArr, int i, int i2) {
int i3 = iArr[i];
iArr[i] = iArr[i2];
iArr[i2] = i3;
float f = fArr[i];
fArr[i] = fArr[i2];
fArr[i2] = f;
}
}
private static class IntFloatFloatSort {
private IntFloatFloatSort() {
}
static void sort(int[] iArr, float[] fArr, float[] fArr2, int i, int i2) {
int[] iArr2 = new int[iArr.length + 10];
iArr2[0] = i2;
iArr2[1] = i;
int i3 = 2;
while (i3 > 0) {
int i4 = iArr2[i3 - 1];
int i5 = i3 - 2;
int i6 = iArr2[i5];
if (i4 < i6) {
int partition = partition(iArr, fArr, fArr2, i4, i6);
iArr2[i5] = partition - 1;
iArr2[i3 - 1] = i4;
int i7 = i3 + 1;
iArr2[i3] = i6;
i3 += 2;
iArr2[i7] = partition + 1;
} else {
i3 = i5;
}
}
}
private static int partition(int[] iArr, float[] fArr, float[] fArr2, int i, int i2) {
int i3 = iArr[i2];
int i4 = i;
while (i < i2) {
if (iArr[i] <= i3) {
swap(iArr, fArr, fArr2, i4, i);
i4++;
}
i++;
}
swap(iArr, fArr, fArr2, i4, i2);
return i4;
}
private static void swap(int[] iArr, float[] fArr, float[] fArr2, int i, int i2) {
int i3 = iArr[i];
iArr[i] = iArr[i2];
iArr[i2] = i3;
float f = fArr[i];
fArr[i] = fArr[i2];
fArr[i2] = f;
float f2 = fArr2[i];
fArr2[i] = fArr2[i2];
fArr2[i2] = f2;
}
}
static class CycleOscillator {
private static final String TAG = "CycleOscillator";
static final int UNSET = -1;
private final int OFFST;
private final int PHASE;
private final int VALUE;
CurveFit mCurveFit;
float[] mOffset;
Oscillator mOscillator;
float mPathLength;
float[] mPeriod;
float[] mPhase;
double[] mPosition;
float[] mScale;
double[] mSplineSlopeCache;
double[] mSplineValueCache;
float[] mValues;
private final int mVariesBy;
int mWaveShape;
CycleOscillator(int i, String str, int i2, int i3) {
Oscillator oscillator = new Oscillator();
this.mOscillator = oscillator;
this.OFFST = 0;
this.PHASE = 1;
this.VALUE = 2;
this.mWaveShape = i;
this.mVariesBy = i2;
oscillator.setType(i, str);
this.mValues = new float[i3];
this.mPosition = new double[i3];
this.mPeriod = new float[i3];
this.mOffset = new float[i3];
this.mPhase = new float[i3];
this.mScale = new float[i3];
}
public double getValues(float f) {
CurveFit curveFit = this.mCurveFit;
if (curveFit != null) {
curveFit.getPos(f, this.mSplineValueCache);
} else {
double[] dArr = this.mSplineValueCache;
dArr[0] = this.mOffset[0];
dArr[1] = this.mPhase[0];
dArr[2] = this.mValues[0];
}
double[] dArr2 = this.mSplineValueCache;
return dArr2[0] + (this.mOscillator.getValue(f, dArr2[1]) * this.mSplineValueCache[2]);
}
public double getLastPhase() {
return this.mSplineValueCache[1];
}
public double getSlope(float f) {
CurveFit curveFit = this.mCurveFit;
if (curveFit != null) {
double d = f;
curveFit.getSlope(d, this.mSplineSlopeCache);
this.mCurveFit.getPos(d, this.mSplineValueCache);
} else {
double[] dArr = this.mSplineSlopeCache;
dArr[0] = 0.0d;
dArr[1] = 0.0d;
dArr[2] = 0.0d;
}
double d2 = f;
double value = this.mOscillator.getValue(d2, this.mSplineValueCache[1]);
double slope = this.mOscillator.getSlope(d2, this.mSplineValueCache[1], this.mSplineSlopeCache[1]);
double[] dArr2 = this.mSplineSlopeCache;
return dArr2[0] + (value * dArr2[2]) + (slope * this.mSplineValueCache[2]);
}
public void setPoint(int i, int i2, float f, float f2, float f3, float f4) {
this.mPosition[i] = i2 / 100.0d;
this.mPeriod[i] = f;
this.mOffset[i] = f2;
this.mPhase[i] = f3;
this.mValues[i] = f4;
}
public void setup(float f) {
this.mPathLength = f;
double[][] dArr = (double[][]) Array.newInstance((Class<?>) Double.TYPE, this.mPosition.length, 3);
float[] fArr = this.mValues;
this.mSplineValueCache = new double[fArr.length + 2];
this.mSplineSlopeCache = new double[fArr.length + 2];
if (this.mPosition[0] > 0.0d) {
this.mOscillator.addPoint(0.0d, this.mPeriod[0]);
}
double[] dArr2 = this.mPosition;
int length = dArr2.length - 1;
if (dArr2[length] < 1.0d) {
this.mOscillator.addPoint(1.0d, this.mPeriod[length]);
}
for (int i = 0; i < dArr.length; i++) {
double[] dArr3 = dArr[i];
dArr3[0] = this.mOffset[i];
dArr3[1] = this.mPhase[i];
dArr3[2] = this.mValues[i];
this.mOscillator.addPoint(this.mPosition[i], this.mPeriod[i]);
}
this.mOscillator.normalize();
double[] dArr4 = this.mPosition;
if (dArr4.length > 1) {
this.mCurveFit = CurveFit.get(0, dArr4, dArr);
} else {
this.mCurveFit = null;
}
}
}
}

View File

@ -0,0 +1,247 @@
package androidx.constraintlayout.core.motion.utils;
import androidx.constraintlayout.core.motion.CustomAttribute;
import androidx.constraintlayout.core.motion.CustomVariable;
import java.io.PrintStream;
import java.util.Arrays;
/* loaded from: classes.dex */
public class KeyFrameArray {
public static class CustomArray {
private static final int EMPTY = 999;
int count;
int[] keys = new int[101];
CustomAttribute[] values = new CustomAttribute[101];
public int size() {
return this.count;
}
public CustomArray() {
clear();
}
public void clear() {
Arrays.fill(this.keys, EMPTY);
Arrays.fill(this.values, (Object) null);
this.count = 0;
}
public void dump() {
System.out.println("V: " + Arrays.toString(Arrays.copyOf(this.keys, this.count)));
System.out.print("K: [");
int i = 0;
while (i < this.count) {
PrintStream printStream = System.out;
StringBuilder sb = new StringBuilder();
sb.append(i == 0 ? "" : ", ");
sb.append(valueAt(i));
printStream.print(sb.toString());
i++;
}
System.out.println("]");
}
public CustomAttribute valueAt(int i) {
return this.values[this.keys[i]];
}
public int keyAt(int i) {
return this.keys[i];
}
public void append(int i, CustomAttribute customAttribute) {
if (this.values[i] != null) {
remove(i);
}
this.values[i] = customAttribute;
int[] iArr = this.keys;
int i2 = this.count;
this.count = i2 + 1;
iArr[i2] = i;
Arrays.sort(iArr);
}
public void remove(int i) {
this.values[i] = null;
int i2 = 0;
int i3 = 0;
while (true) {
int i4 = this.count;
if (i2 >= i4) {
this.count = i4 - 1;
return;
}
int[] iArr = this.keys;
if (i == iArr[i2]) {
iArr[i2] = EMPTY;
i3++;
}
if (i2 != i3) {
iArr[i2] = iArr[i3];
}
i3++;
i2++;
}
}
}
public static class CustomVar {
private static final int EMPTY = 999;
int count;
int[] keys = new int[101];
CustomVariable[] values = new CustomVariable[101];
public int size() {
return this.count;
}
public CustomVar() {
clear();
}
public void clear() {
Arrays.fill(this.keys, EMPTY);
Arrays.fill(this.values, (Object) null);
this.count = 0;
}
public void dump() {
System.out.println("V: " + Arrays.toString(Arrays.copyOf(this.keys, this.count)));
System.out.print("K: [");
int i = 0;
while (i < this.count) {
PrintStream printStream = System.out;
StringBuilder sb = new StringBuilder();
sb.append(i == 0 ? "" : ", ");
sb.append(valueAt(i));
printStream.print(sb.toString());
i++;
}
System.out.println("]");
}
public CustomVariable valueAt(int i) {
return this.values[this.keys[i]];
}
public int keyAt(int i) {
return this.keys[i];
}
public void append(int i, CustomVariable customVariable) {
if (this.values[i] != null) {
remove(i);
}
this.values[i] = customVariable;
int[] iArr = this.keys;
int i2 = this.count;
this.count = i2 + 1;
iArr[i2] = i;
Arrays.sort(iArr);
}
public void remove(int i) {
this.values[i] = null;
int i2 = 0;
int i3 = 0;
while (true) {
int i4 = this.count;
if (i2 >= i4) {
this.count = i4 - 1;
return;
}
int[] iArr = this.keys;
if (i == iArr[i2]) {
iArr[i2] = EMPTY;
i3++;
}
if (i2 != i3) {
iArr[i2] = iArr[i3];
}
i3++;
i2++;
}
}
}
static class FloatArray {
private static final int EMPTY = 999;
int count;
int[] keys = new int[101];
float[][] values = new float[101][];
public int size() {
return this.count;
}
public FloatArray() {
clear();
}
public void clear() {
Arrays.fill(this.keys, EMPTY);
Arrays.fill(this.values, (Object) null);
this.count = 0;
}
public void dump() {
System.out.println("V: " + Arrays.toString(Arrays.copyOf(this.keys, this.count)));
System.out.print("K: [");
int i = 0;
while (i < this.count) {
PrintStream printStream = System.out;
StringBuilder sb = new StringBuilder();
sb.append(i == 0 ? "" : ", ");
sb.append(Arrays.toString(valueAt(i)));
printStream.print(sb.toString());
i++;
}
System.out.println("]");
}
public float[] valueAt(int i) {
return this.values[this.keys[i]];
}
public int keyAt(int i) {
return this.keys[i];
}
public void append(int i, float[] fArr) {
if (this.values[i] != null) {
remove(i);
}
this.values[i] = fArr;
int[] iArr = this.keys;
int i2 = this.count;
this.count = i2 + 1;
iArr[i2] = i;
Arrays.sort(iArr);
}
public void remove(int i) {
this.values[i] = null;
int i2 = 0;
int i3 = 0;
while (true) {
int i4 = this.count;
if (i2 >= i4) {
this.count = i4 - 1;
return;
}
int[] iArr = this.keys;
if (i == iArr[i2]) {
iArr[i2] = EMPTY;
i3++;
}
if (i2 != i3) {
iArr[i2] = iArr[i3];
}
i3++;
i2++;
}
}
}
}

View File

@ -0,0 +1,385 @@
package androidx.constraintlayout.core.motion.utils;
/* loaded from: classes.dex */
public class LinearCurveFit extends CurveFit {
private static final String TAG = "LinearCurveFit";
private boolean mExtrapolate = true;
double[] mSlopeTemp;
private double[] mT;
private double mTotalLength;
private double[][] mY;
@Override // androidx.constraintlayout.core.motion.utils.CurveFit
public double[] getTimePoints() {
return this.mT;
}
public LinearCurveFit(double[] dArr, double[][] dArr2) {
this.mTotalLength = Double.NaN;
int length = dArr.length;
int length2 = dArr2[0].length;
this.mSlopeTemp = new double[length2];
this.mT = dArr;
this.mY = dArr2;
if (length2 > 2) {
double d = 0.0d;
double d2 = 0.0d;
int i = 0;
while (i < dArr.length) {
double d3 = dArr2[i][0];
if (i > 0) {
Math.hypot(d3 - d, d3 - d2);
}
i++;
d = d3;
d2 = d;
}
this.mTotalLength = 0.0d;
}
}
private double getLength2D(double d) {
if (Double.isNaN(this.mTotalLength)) {
return 0.0d;
}
double[] dArr = this.mT;
int length = dArr.length;
if (d <= dArr[0]) {
return 0.0d;
}
int i = length - 1;
if (d >= dArr[i]) {
return this.mTotalLength;
}
double d2 = 0.0d;
double d3 = 0.0d;
double d4 = 0.0d;
int i2 = 0;
while (i2 < i) {
double[] dArr2 = this.mY[i2];
double d5 = dArr2[0];
double d6 = dArr2[1];
if (i2 > 0) {
d2 += Math.hypot(d5 - d3, d6 - d4);
}
double[] dArr3 = this.mT;
double d7 = dArr3[i2];
if (d == d7) {
return d2;
}
int i3 = i2 + 1;
double d8 = dArr3[i3];
if (d < d8) {
double d9 = (d - d7) / (d8 - d7);
double[][] dArr4 = this.mY;
double[] dArr5 = dArr4[i2];
double d10 = dArr5[0];
double[] dArr6 = dArr4[i3];
double d11 = 1.0d - d9;
return d2 + Math.hypot(d6 - ((dArr5[1] * d11) + (dArr6[1] * d9)), d5 - ((d10 * d11) + (dArr6[0] * d9)));
}
i2 = i3;
d3 = d5;
d4 = d6;
}
return 0.0d;
}
@Override // androidx.constraintlayout.core.motion.utils.CurveFit
public void getPos(double d, double[] dArr) {
double[] dArr2 = this.mT;
int length = dArr2.length;
int i = 0;
int length2 = this.mY[0].length;
if (this.mExtrapolate) {
double d2 = dArr2[0];
if (d <= d2) {
getSlope(d2, this.mSlopeTemp);
for (int i2 = 0; i2 < length2; i2++) {
dArr[i2] = this.mY[0][i2] + ((d - this.mT[0]) * this.mSlopeTemp[i2]);
}
return;
}
int i3 = length - 1;
double d3 = dArr2[i3];
if (d >= d3) {
getSlope(d3, this.mSlopeTemp);
while (i < length2) {
dArr[i] = this.mY[i3][i] + ((d - this.mT[i3]) * this.mSlopeTemp[i]);
i++;
}
return;
}
} else {
if (d <= dArr2[0]) {
for (int i4 = 0; i4 < length2; i4++) {
dArr[i4] = this.mY[0][i4];
}
return;
}
int i5 = length - 1;
if (d >= dArr2[i5]) {
while (i < length2) {
dArr[i] = this.mY[i5][i];
i++;
}
return;
}
}
int i6 = 0;
while (i6 < length - 1) {
if (d == this.mT[i6]) {
for (int i7 = 0; i7 < length2; i7++) {
dArr[i7] = this.mY[i6][i7];
}
}
double[] dArr3 = this.mT;
int i8 = i6 + 1;
double d4 = dArr3[i8];
if (d < d4) {
double d5 = dArr3[i6];
double d6 = (d - d5) / (d4 - d5);
while (i < length2) {
double[][] dArr4 = this.mY;
dArr[i] = (dArr4[i6][i] * (1.0d - d6)) + (dArr4[i8][i] * d6);
i++;
}
return;
}
i6 = i8;
}
}
@Override // androidx.constraintlayout.core.motion.utils.CurveFit
public void getPos(double d, float[] fArr) {
double[] dArr = this.mT;
int length = dArr.length;
int i = 0;
int length2 = this.mY[0].length;
if (this.mExtrapolate) {
double d2 = dArr[0];
if (d <= d2) {
getSlope(d2, this.mSlopeTemp);
for (int i2 = 0; i2 < length2; i2++) {
fArr[i2] = (float) (this.mY[0][i2] + ((d - this.mT[0]) * this.mSlopeTemp[i2]));
}
return;
}
int i3 = length - 1;
double d3 = dArr[i3];
if (d >= d3) {
getSlope(d3, this.mSlopeTemp);
while (i < length2) {
fArr[i] = (float) (this.mY[i3][i] + ((d - this.mT[i3]) * this.mSlopeTemp[i]));
i++;
}
return;
}
} else {
if (d <= dArr[0]) {
for (int i4 = 0; i4 < length2; i4++) {
fArr[i4] = (float) this.mY[0][i4];
}
return;
}
int i5 = length - 1;
if (d >= dArr[i5]) {
while (i < length2) {
fArr[i] = (float) this.mY[i5][i];
i++;
}
return;
}
}
int i6 = 0;
while (i6 < length - 1) {
if (d == this.mT[i6]) {
for (int i7 = 0; i7 < length2; i7++) {
fArr[i7] = (float) this.mY[i6][i7];
}
}
double[] dArr2 = this.mT;
int i8 = i6 + 1;
double d4 = dArr2[i8];
if (d < d4) {
double d5 = dArr2[i6];
double d6 = (d - d5) / (d4 - d5);
while (i < length2) {
double[][] dArr3 = this.mY;
fArr[i] = (float) ((dArr3[i6][i] * (1.0d - d6)) + (dArr3[i8][i] * d6));
i++;
}
return;
}
i6 = i8;
}
}
@Override // androidx.constraintlayout.core.motion.utils.CurveFit
public double getPos(double d, int i) {
double d2;
double d3;
double slope;
double[] dArr = this.mT;
int length = dArr.length;
int i2 = 0;
if (this.mExtrapolate) {
double d4 = dArr[0];
if (d <= d4) {
d2 = this.mY[0][i];
d3 = d - d4;
slope = getSlope(d4, i);
} else {
int i3 = length - 1;
double d5 = dArr[i3];
if (d >= d5) {
d2 = this.mY[i3][i];
d3 = d - d5;
slope = getSlope(d5, i);
}
}
return d2 + (d3 * slope);
}
if (d <= dArr[0]) {
return this.mY[0][i];
}
int i4 = length - 1;
if (d >= dArr[i4]) {
return this.mY[i4][i];
}
while (i2 < length - 1) {
double[] dArr2 = this.mT;
double d6 = dArr2[i2];
if (d == d6) {
return this.mY[i2][i];
}
int i5 = i2 + 1;
double d7 = dArr2[i5];
if (d < d7) {
double d8 = (d - d6) / (d7 - d6);
double[][] dArr3 = this.mY;
return (dArr3[i2][i] * (1.0d - d8)) + (dArr3[i5][i] * d8);
}
i2 = i5;
}
return 0.0d;
}
/* JADX WARN: Code restructure failed: missing block: B:20:0x0017, code lost:
if (r13 >= r4) goto L4;
*/
@Override // androidx.constraintlayout.core.motion.utils.CurveFit
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public void getSlope(double r13, double[] r15) {
/*
r12 = this;
double[] r0 = r12.mT
int r1 = r0.length
double[][] r2 = r12.mY
r3 = 0
r2 = r2[r3]
int r2 = r2.length
r4 = r0[r3]
int r6 = (r13 > r4 ? 1 : (r13 == r4 ? 0 : -1))
if (r6 > 0) goto L11
Lf:
r13 = r4
goto L1a
L11:
int r4 = r1 + (-1)
r4 = r0[r4]
int r0 = (r13 > r4 ? 1 : (r13 == r4 ? 0 : -1))
if (r0 < 0) goto L1a
goto Lf
L1a:
r0 = 0
L1b:
int r4 = r1 + (-1)
if (r0 >= r4) goto L41
double[] r4 = r12.mT
int r5 = r0 + 1
r6 = r4[r5]
int r8 = (r13 > r6 ? 1 : (r13 == r6 ? 0 : -1))
if (r8 > 0) goto L3f
r13 = r4[r0]
double r6 = r6 - r13
L2c:
if (r3 >= r2) goto L41
double[][] r13 = r12.mY
r14 = r13[r0]
r8 = r14[r3]
r13 = r13[r5]
r10 = r13[r3]
double r10 = r10 - r8
double r10 = r10 / r6
r15[r3] = r10
int r3 = r3 + 1
goto L2c
L3f:
r0 = r5
goto L1b
L41:
return
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.constraintlayout.core.motion.utils.LinearCurveFit.getSlope(double, double[]):void");
}
/* JADX WARN: Code restructure failed: missing block: B:17:0x0012, code lost:
if (r8 >= r3) goto L4;
*/
@Override // androidx.constraintlayout.core.motion.utils.CurveFit
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public double getSlope(double r8, int r10) {
/*
r7 = this;
double[] r0 = r7.mT
int r1 = r0.length
r2 = 0
r3 = r0[r2]
int r5 = (r8 > r3 ? 1 : (r8 == r3 ? 0 : -1))
if (r5 >= 0) goto Lc
La:
r8 = r3
goto L15
Lc:
int r3 = r1 + (-1)
r3 = r0[r3]
int r0 = (r8 > r3 ? 1 : (r8 == r3 ? 0 : -1))
if (r0 < 0) goto L15
goto La
L15:
int r0 = r1 + (-1)
if (r2 >= r0) goto L35
double[] r0 = r7.mT
int r3 = r2 + 1
r4 = r0[r3]
int r6 = (r8 > r4 ? 1 : (r8 == r4 ? 0 : -1))
if (r6 > 0) goto L33
r8 = r0[r2]
double r4 = r4 - r8
double[][] r8 = r7.mY
r9 = r8[r2]
r0 = r9[r10]
r8 = r8[r3]
r9 = r8[r10]
double r9 = r9 - r0
double r9 = r9 / r4
return r9
L33:
r2 = r3
goto L15
L35:
r8 = 0
return r8
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.constraintlayout.core.motion.utils.LinearCurveFit.getSlope(double, int):double");
}
}

View File

@ -0,0 +1,381 @@
package androidx.constraintlayout.core.motion.utils;
import java.lang.reflect.Array;
import java.util.Arrays;
/* loaded from: classes.dex */
public class MonotonicCurveFit extends CurveFit {
private static final String TAG = "MonotonicCurveFit";
private boolean mExtrapolate = true;
double[] mSlopeTemp;
private double[] mT;
private double[][] mTangent;
private double[][] mY;
private static double diff(double d, double d2, double d3, double d4, double d5, double d6) {
double d7 = d2 * d2;
double d8 = d2 * 6.0d;
double d9 = 3.0d * d;
return ((((((((((-6.0d) * d7) * d4) + (d8 * d4)) + ((6.0d * d7) * d3)) - (d8 * d3)) + ((d9 * d6) * d7)) + ((d9 * d5) * d7)) - (((2.0d * d) * d6) * d2)) - (((4.0d * d) * d5) * d2)) + (d * d5);
}
private static double interpolate(double d, double d2, double d3, double d4, double d5, double d6) {
double d7 = d2 * d2;
double d8 = d7 * d2;
double d9 = 3.0d * d7;
double d10 = ((((((-2.0d) * d8) * d4) + (d9 * d4)) + ((d8 * 2.0d) * d3)) - (d9 * d3)) + d3;
double d11 = d * d6;
double d12 = d * d5;
return ((((d10 + (d11 * d8)) + (d8 * d12)) - (d11 * d7)) - (((d * 2.0d) * d5) * d7)) + (d12 * d2);
}
@Override // androidx.constraintlayout.core.motion.utils.CurveFit
public double[] getTimePoints() {
return this.mT;
}
public MonotonicCurveFit(double[] dArr, double[][] dArr2) {
int length = dArr.length;
int length2 = dArr2[0].length;
this.mSlopeTemp = new double[length2];
int i = length - 1;
double[][] dArr3 = (double[][]) Array.newInstance((Class<?>) Double.TYPE, i, length2);
double[][] dArr4 = (double[][]) Array.newInstance((Class<?>) Double.TYPE, length, length2);
for (int i2 = 0; i2 < length2; i2++) {
int i3 = 0;
while (i3 < i) {
int i4 = i3 + 1;
double d = dArr[i4] - dArr[i3];
double[] dArr5 = dArr3[i3];
double d2 = (dArr2[i4][i2] - dArr2[i3][i2]) / d;
dArr5[i2] = d2;
if (i3 == 0) {
dArr4[i3][i2] = d2;
} else {
dArr4[i3][i2] = (dArr3[i3 - 1][i2] + d2) * 0.5d;
}
i3 = i4;
}
dArr4[i][i2] = dArr3[length - 2][i2];
}
for (int i5 = 0; i5 < i; i5++) {
for (int i6 = 0; i6 < length2; i6++) {
double d3 = dArr3[i5][i6];
if (d3 == 0.0d) {
dArr4[i5][i6] = 0.0d;
dArr4[i5 + 1][i6] = 0.0d;
} else {
double d4 = dArr4[i5][i6] / d3;
int i7 = i5 + 1;
double d5 = dArr4[i7][i6] / d3;
double hypot = Math.hypot(d4, d5);
if (hypot > 9.0d) {
double d6 = 3.0d / hypot;
double[] dArr6 = dArr4[i5];
double[] dArr7 = dArr3[i5];
dArr6[i6] = d4 * d6 * dArr7[i6];
dArr4[i7][i6] = d6 * d5 * dArr7[i6];
}
}
}
}
this.mT = dArr;
this.mY = dArr2;
this.mTangent = dArr4;
}
@Override // androidx.constraintlayout.core.motion.utils.CurveFit
public void getPos(double d, double[] dArr) {
double[] dArr2 = this.mT;
int length = dArr2.length;
int i = 0;
int length2 = this.mY[0].length;
if (this.mExtrapolate) {
double d2 = dArr2[0];
if (d <= d2) {
getSlope(d2, this.mSlopeTemp);
for (int i2 = 0; i2 < length2; i2++) {
dArr[i2] = this.mY[0][i2] + ((d - this.mT[0]) * this.mSlopeTemp[i2]);
}
return;
}
int i3 = length - 1;
double d3 = dArr2[i3];
if (d >= d3) {
getSlope(d3, this.mSlopeTemp);
while (i < length2) {
dArr[i] = this.mY[i3][i] + ((d - this.mT[i3]) * this.mSlopeTemp[i]);
i++;
}
return;
}
} else {
if (d <= dArr2[0]) {
for (int i4 = 0; i4 < length2; i4++) {
dArr[i4] = this.mY[0][i4];
}
return;
}
int i5 = length - 1;
if (d >= dArr2[i5]) {
while (i < length2) {
dArr[i] = this.mY[i5][i];
i++;
}
return;
}
}
int i6 = 0;
while (i6 < length - 1) {
if (d == this.mT[i6]) {
for (int i7 = 0; i7 < length2; i7++) {
dArr[i7] = this.mY[i6][i7];
}
}
double[] dArr3 = this.mT;
int i8 = i6 + 1;
double d4 = dArr3[i8];
if (d < d4) {
double d5 = dArr3[i6];
double d6 = d4 - d5;
double d7 = (d - d5) / d6;
while (i < length2) {
double[][] dArr4 = this.mY;
double d8 = dArr4[i6][i];
double d9 = dArr4[i8][i];
double[][] dArr5 = this.mTangent;
dArr[i] = interpolate(d6, d7, d8, d9, dArr5[i6][i], dArr5[i8][i]);
i++;
}
return;
}
i6 = i8;
}
}
@Override // androidx.constraintlayout.core.motion.utils.CurveFit
public void getPos(double d, float[] fArr) {
double[] dArr = this.mT;
int length = dArr.length;
int i = 0;
int length2 = this.mY[0].length;
if (this.mExtrapolate) {
double d2 = dArr[0];
if (d <= d2) {
getSlope(d2, this.mSlopeTemp);
for (int i2 = 0; i2 < length2; i2++) {
fArr[i2] = (float) (this.mY[0][i2] + ((d - this.mT[0]) * this.mSlopeTemp[i2]));
}
return;
}
int i3 = length - 1;
double d3 = dArr[i3];
if (d >= d3) {
getSlope(d3, this.mSlopeTemp);
while (i < length2) {
fArr[i] = (float) (this.mY[i3][i] + ((d - this.mT[i3]) * this.mSlopeTemp[i]));
i++;
}
return;
}
} else {
if (d <= dArr[0]) {
for (int i4 = 0; i4 < length2; i4++) {
fArr[i4] = (float) this.mY[0][i4];
}
return;
}
int i5 = length - 1;
if (d >= dArr[i5]) {
while (i < length2) {
fArr[i] = (float) this.mY[i5][i];
i++;
}
return;
}
}
int i6 = 0;
while (i6 < length - 1) {
if (d == this.mT[i6]) {
for (int i7 = 0; i7 < length2; i7++) {
fArr[i7] = (float) this.mY[i6][i7];
}
}
double[] dArr2 = this.mT;
int i8 = i6 + 1;
double d4 = dArr2[i8];
if (d < d4) {
double d5 = dArr2[i6];
double d6 = d4 - d5;
double d7 = (d - d5) / d6;
while (i < length2) {
double[][] dArr3 = this.mY;
double d8 = dArr3[i6][i];
double d9 = dArr3[i8][i];
double[][] dArr4 = this.mTangent;
fArr[i] = (float) interpolate(d6, d7, d8, d9, dArr4[i6][i], dArr4[i8][i]);
i++;
}
return;
}
i6 = i8;
}
}
@Override // androidx.constraintlayout.core.motion.utils.CurveFit
public double getPos(double d, int i) {
double d2;
double d3;
double slope;
double[] dArr = this.mT;
int length = dArr.length;
int i2 = 0;
if (this.mExtrapolate) {
double d4 = dArr[0];
if (d <= d4) {
d2 = this.mY[0][i];
d3 = d - d4;
slope = getSlope(d4, i);
} else {
int i3 = length - 1;
double d5 = dArr[i3];
if (d >= d5) {
d2 = this.mY[i3][i];
d3 = d - d5;
slope = getSlope(d5, i);
}
}
return d2 + (d3 * slope);
}
if (d <= dArr[0]) {
return this.mY[0][i];
}
int i4 = length - 1;
if (d >= dArr[i4]) {
return this.mY[i4][i];
}
while (i2 < length - 1) {
double[] dArr2 = this.mT;
double d6 = dArr2[i2];
if (d == d6) {
return this.mY[i2][i];
}
int i5 = i2 + 1;
double d7 = dArr2[i5];
if (d < d7) {
double d8 = d7 - d6;
double d9 = (d - d6) / d8;
double[][] dArr3 = this.mY;
double d10 = dArr3[i2][i];
double d11 = dArr3[i5][i];
double[][] dArr4 = this.mTangent;
return interpolate(d8, d9, d10, d11, dArr4[i2][i], dArr4[i5][i]);
}
i2 = i5;
}
return 0.0d;
}
@Override // androidx.constraintlayout.core.motion.utils.CurveFit
public void getSlope(double d, double[] dArr) {
double[] dArr2 = this.mT;
int length = dArr2.length;
int length2 = this.mY[0].length;
double d2 = dArr2[0];
if (d > d2) {
d2 = dArr2[length - 1];
if (d < d2) {
d2 = d;
}
}
int i = 0;
while (i < length - 1) {
double[] dArr3 = this.mT;
int i2 = i + 1;
double d3 = dArr3[i2];
if (d2 <= d3) {
double d4 = dArr3[i];
double d5 = d3 - d4;
double d6 = (d2 - d4) / d5;
for (int i3 = 0; i3 < length2; i3++) {
double[][] dArr4 = this.mY;
double d7 = dArr4[i][i3];
double d8 = dArr4[i2][i3];
double[][] dArr5 = this.mTangent;
dArr[i3] = diff(d5, d6, d7, d8, dArr5[i][i3], dArr5[i2][i3]) / d5;
}
return;
}
i = i2;
}
}
@Override // androidx.constraintlayout.core.motion.utils.CurveFit
public double getSlope(double d, int i) {
double[] dArr = this.mT;
int length = dArr.length;
int i2 = 0;
double d2 = dArr[0];
if (d >= d2) {
d2 = dArr[length - 1];
if (d < d2) {
d2 = d;
}
}
while (i2 < length - 1) {
double[] dArr2 = this.mT;
int i3 = i2 + 1;
double d3 = dArr2[i3];
if (d2 <= d3) {
double d4 = dArr2[i2];
double d5 = d3 - d4;
double[][] dArr3 = this.mY;
double d6 = dArr3[i2][i];
double d7 = dArr3[i3][i];
double[][] dArr4 = this.mTangent;
return diff(d5, (d2 - d4) / d5, d6, d7, dArr4[i2][i], dArr4[i3][i]) / d5;
}
i2 = i3;
}
return 0.0d;
}
public static MonotonicCurveFit buildWave(String str) {
double[] dArr = new double[str.length() / 2];
int indexOf = str.indexOf(40) + 1;
int indexOf2 = str.indexOf(44, indexOf);
int i = 0;
while (indexOf2 != -1) {
dArr[i] = Double.parseDouble(str.substring(indexOf, indexOf2).trim());
indexOf = indexOf2 + 1;
indexOf2 = str.indexOf(44, indexOf);
i++;
}
dArr[i] = Double.parseDouble(str.substring(indexOf, str.indexOf(41, indexOf)).trim());
return buildWave(Arrays.copyOf(dArr, i + 1));
}
private static MonotonicCurveFit buildWave(double[] dArr) {
int length = (dArr.length * 3) - 2;
int length2 = dArr.length - 1;
double d = 1.0d / length2;
double[][] dArr2 = (double[][]) Array.newInstance((Class<?>) Double.TYPE, length, 1);
double[] dArr3 = new double[length];
for (int i = 0; i < dArr.length; i++) {
double d2 = dArr[i];
int i2 = i + length2;
dArr2[i2][0] = d2;
double d3 = i * d;
dArr3[i2] = d3;
if (i > 0) {
int i3 = (length2 * 2) + i;
dArr2[i3][0] = d2 + 1.0d;
dArr3[i3] = d3 + 1.0d;
int i4 = i - 1;
dArr2[i4][0] = (d2 - 1.0d) - d;
dArr3[i4] = (d3 - 1.0d) - d;
}
}
return new MonotonicCurveFit(dArr3, dArr2);
}
}

View File

@ -0,0 +1,204 @@
package androidx.constraintlayout.core.motion.utils;
import java.util.Arrays;
/* loaded from: classes.dex */
public class Oscillator {
public static final int BOUNCE = 6;
public static final int COS_WAVE = 5;
public static final int CUSTOM = 7;
public static final int REVERSE_SAW_WAVE = 4;
public static final int SAW_WAVE = 3;
public static final int SIN_WAVE = 0;
public static final int SQUARE_WAVE = 1;
public static String TAG = "Oscillator";
public static final int TRIANGLE_WAVE = 2;
double[] mArea;
MonotonicCurveFit mCustomCurve;
String mCustomType;
int mType;
float[] mPeriod = new float[0];
double[] mPosition = new double[0];
double PI2 = 6.283185307179586d;
private boolean mNormalized = false;
public String toString() {
return "pos =" + Arrays.toString(this.mPosition) + " period=" + Arrays.toString(this.mPeriod);
}
public void setType(int i, String str) {
this.mType = i;
this.mCustomType = str;
if (str != null) {
this.mCustomCurve = MonotonicCurveFit.buildWave(str);
}
}
public void addPoint(double d, float f) {
int length = this.mPeriod.length + 1;
int binarySearch = Arrays.binarySearch(this.mPosition, d);
if (binarySearch < 0) {
binarySearch = (-binarySearch) - 1;
}
this.mPosition = Arrays.copyOf(this.mPosition, length);
this.mPeriod = Arrays.copyOf(this.mPeriod, length);
this.mArea = new double[length];
double[] dArr = this.mPosition;
System.arraycopy(dArr, binarySearch, dArr, binarySearch + 1, (length - binarySearch) - 1);
this.mPosition[binarySearch] = d;
this.mPeriod[binarySearch] = f;
this.mNormalized = false;
}
public void normalize() {
double d = 0.0d;
int i = 0;
while (true) {
if (i >= this.mPeriod.length) {
break;
}
d += r7[i];
i++;
}
double d2 = 0.0d;
int i2 = 1;
while (true) {
float[] fArr = this.mPeriod;
if (i2 >= fArr.length) {
break;
}
int i3 = i2 - 1;
float f = (fArr[i3] + fArr[i2]) / 2.0f;
double[] dArr = this.mPosition;
d2 += (dArr[i2] - dArr[i3]) * f;
i2++;
}
int i4 = 0;
while (true) {
float[] fArr2 = this.mPeriod;
if (i4 >= fArr2.length) {
break;
}
fArr2[i4] = (float) (fArr2[i4] * (d / d2));
i4++;
}
this.mArea[0] = 0.0d;
int i5 = 1;
while (true) {
float[] fArr3 = this.mPeriod;
if (i5 >= fArr3.length) {
this.mNormalized = true;
return;
}
int i6 = i5 - 1;
float f2 = (fArr3[i6] + fArr3[i5]) / 2.0f;
double[] dArr2 = this.mPosition;
double d3 = dArr2[i5] - dArr2[i6];
double[] dArr3 = this.mArea;
dArr3[i5] = dArr3[i6] + (d3 * f2);
i5++;
}
}
double getP(double d) {
if (d < 0.0d) {
d = 0.0d;
} else if (d > 1.0d) {
d = 1.0d;
}
int binarySearch = Arrays.binarySearch(this.mPosition, d);
if (binarySearch > 0) {
return 1.0d;
}
if (binarySearch == 0) {
return 0.0d;
}
int i = -binarySearch;
int i2 = i - 1;
float[] fArr = this.mPeriod;
float f = fArr[i2];
int i3 = i - 2;
float f2 = fArr[i3];
double[] dArr = this.mPosition;
double d2 = dArr[i2];
double d3 = dArr[i3];
double d4 = (f - f2) / (d2 - d3);
return this.mArea[i3] + ((f2 - (d4 * d3)) * (d - d3)) + ((d4 * ((d * d) - (d3 * d3))) / 2.0d);
}
public double getValue(double d, double d2) {
double abs;
double p = getP(d) + d2;
switch (this.mType) {
case 1:
return Math.signum(0.5d - (p % 1.0d));
case 2:
abs = Math.abs((((p * 4.0d) + 1.0d) % 4.0d) - 2.0d);
break;
case 3:
return (((p * 2.0d) + 1.0d) % 2.0d) - 1.0d;
case 4:
abs = ((p * 2.0d) + 1.0d) % 2.0d;
break;
case 5:
return Math.cos(this.PI2 * (d2 + p));
case 6:
double abs2 = 1.0d - Math.abs(((p * 4.0d) % 4.0d) - 2.0d);
abs = abs2 * abs2;
break;
case 7:
return this.mCustomCurve.getPos(p % 1.0d, 0);
default:
return Math.sin(this.PI2 * p);
}
return 1.0d - abs;
}
double getDP(double d) {
if (d <= 0.0d) {
d = 1.0E-5d;
} else if (d >= 1.0d) {
d = 0.999999d;
}
int binarySearch = Arrays.binarySearch(this.mPosition, d);
if (binarySearch > 0 || binarySearch == 0) {
return 0.0d;
}
int i = -binarySearch;
int i2 = i - 1;
float[] fArr = this.mPeriod;
float f = fArr[i2];
int i3 = i - 2;
float f2 = fArr[i3];
double[] dArr = this.mPosition;
double d2 = dArr[i2];
double d3 = dArr[i3];
double d4 = (f - f2) / (d2 - d3);
return (d * d4) + (f2 - (d4 * d3));
}
public double getSlope(double d, double d2, double d3) {
double p = d2 + getP(d);
double dp = getDP(d) + d3;
switch (this.mType) {
case 1:
return 0.0d;
case 2:
return dp * 4.0d * Math.signum((((p * 4.0d) + 3.0d) % 4.0d) - 2.0d);
case 3:
return dp * 2.0d;
case 4:
return (-dp) * 2.0d;
case 5:
double d4 = this.PI2;
return (-d4) * dp * Math.sin(d4 * p);
case 6:
return dp * 4.0d * ((((p * 4.0d) + 2.0d) % 4.0d) - 2.0d);
case 7:
return this.mCustomCurve.getSlope(p % 1.0d, 0);
default:
double d5 = this.PI2;
return dp * d5 * Math.cos(d5 * p);
}
}
}

View File

@ -0,0 +1,17 @@
package androidx.constraintlayout.core.motion.utils;
/* loaded from: classes.dex */
public class Rect {
public int bottom;
public int left;
public int right;
public int top;
public int height() {
return this.bottom - this.top;
}
public int width() {
return this.right - this.left;
}
}

View File

@ -0,0 +1,43 @@
package androidx.constraintlayout.core.motion.utils;
/* loaded from: classes.dex */
public class Schlick extends Easing {
private static final boolean DEBUG = false;
double eps;
double mS;
double mT;
private double dfunc(double d) {
double d2 = this.mT;
if (d < d2) {
double d3 = this.mS;
return ((d3 * d2) * d2) / ((((d2 - d) * d3) + d) * ((d3 * (d2 - d)) + d));
}
double d4 = this.mS;
return (((d2 - 1.0d) * d4) * (d2 - 1.0d)) / (((((-d4) * (d2 - d)) - d) + 1.0d) * ((((-d4) * (d2 - d)) - d) + 1.0d));
}
private double func(double d) {
double d2 = this.mT;
return d < d2 ? (d2 * d) / (d + (this.mS * (d2 - d))) : ((1.0d - d2) * (d - 1.0d)) / ((1.0d - d) - (this.mS * (d2 - d)));
}
Schlick(String str) {
this.str = str;
int indexOf = str.indexOf(40);
int indexOf2 = str.indexOf(44, indexOf);
this.mS = Double.parseDouble(str.substring(indexOf + 1, indexOf2).trim());
int i = indexOf2 + 1;
this.mT = Double.parseDouble(str.substring(i, str.indexOf(44, i)).trim());
}
@Override // androidx.constraintlayout.core.motion.utils.Easing
public double getDiff(double d) {
return dfunc(d);
}
@Override // androidx.constraintlayout.core.motion.utils.Easing
public double get(double d) {
return func(d);
}
}

View File

@ -0,0 +1,272 @@
package androidx.constraintlayout.core.motion.utils;
import androidx.constraintlayout.core.motion.CustomAttribute;
import androidx.constraintlayout.core.motion.CustomVariable;
import androidx.constraintlayout.core.motion.MotionWidget;
import androidx.constraintlayout.core.motion.utils.KeyFrameArray;
import androidx.constraintlayout.core.motion.utils.TypedValues;
import androidx.constraintlayout.core.state.WidgetFrame;
import java.lang.reflect.Array;
import java.text.DecimalFormat;
import java.util.Arrays;
/* loaded from: classes.dex */
public abstract class SplineSet {
private static final String TAG = "SplineSet";
private int count;
protected CurveFit mCurveFit;
private String mType;
protected int[] mTimePoints = new int[10];
protected float[] mValues = new float[10];
public CurveFit getCurveFit() {
return this.mCurveFit;
}
public void setType(String str) {
this.mType = str;
}
public void setProperty(TypedValues typedValues, float f) {
typedValues.setValue(TypedValues.AttributesType.CC.getId(this.mType), get(f));
}
public String toString() {
String str = this.mType;
DecimalFormat decimalFormat = new DecimalFormat("##.##");
for (int i = 0; i < this.count; i++) {
str = str + "[" + this.mTimePoints[i] + " , " + decimalFormat.format(this.mValues[i]) + "] ";
}
return str;
}
public float get(float f) {
return (float) this.mCurveFit.getPos(f, 0);
}
public float getSlope(float f) {
return (float) this.mCurveFit.getSlope(f, 0);
}
public void setPoint(int i, float f) {
int[] iArr = this.mTimePoints;
if (iArr.length < this.count + 1) {
this.mTimePoints = Arrays.copyOf(iArr, iArr.length * 2);
float[] fArr = this.mValues;
this.mValues = Arrays.copyOf(fArr, fArr.length * 2);
}
int[] iArr2 = this.mTimePoints;
int i2 = this.count;
iArr2[i2] = i;
this.mValues[i2] = f;
this.count = i2 + 1;
}
public void setup(int i) {
int i2;
int i3 = this.count;
if (i3 == 0) {
return;
}
Sort.doubleQuickSort(this.mTimePoints, this.mValues, 0, i3 - 1);
int i4 = 1;
for (int i5 = 1; i5 < this.count; i5++) {
int[] iArr = this.mTimePoints;
if (iArr[i5 - 1] != iArr[i5]) {
i4++;
}
}
double[] dArr = new double[i4];
double[][] dArr2 = (double[][]) Array.newInstance((Class<?>) Double.TYPE, i4, 1);
int i6 = 0;
while (i2 < this.count) {
if (i2 > 0) {
int[] iArr2 = this.mTimePoints;
i2 = iArr2[i2] == iArr2[i2 + (-1)] ? i2 + 1 : 0;
}
dArr[i6] = this.mTimePoints[i2] * 0.01d;
dArr2[i6][0] = this.mValues[i2];
i6++;
}
this.mCurveFit = CurveFit.get(i, dArr, dArr2);
}
public static SplineSet makeCustomSpline(String str, KeyFrameArray.CustomArray customArray) {
return new CustomSet(str, customArray);
}
public static SplineSet makeCustomSplineSet(String str, KeyFrameArray.CustomVar customVar) {
return new CustomSpline(str, customVar);
}
public static SplineSet makeSpline(String str, long j) {
return new CoreSpline(str, j);
}
private static class Sort {
private Sort() {
}
static void doubleQuickSort(int[] iArr, float[] fArr, int i, int i2) {
int[] iArr2 = new int[iArr.length + 10];
iArr2[0] = i2;
iArr2[1] = i;
int i3 = 2;
while (i3 > 0) {
int i4 = iArr2[i3 - 1];
int i5 = i3 - 2;
int i6 = iArr2[i5];
if (i4 < i6) {
int partition = partition(iArr, fArr, i4, i6);
iArr2[i5] = partition - 1;
iArr2[i3 - 1] = i4;
int i7 = i3 + 1;
iArr2[i3] = i6;
i3 += 2;
iArr2[i7] = partition + 1;
} else {
i3 = i5;
}
}
}
private static int partition(int[] iArr, float[] fArr, int i, int i2) {
int i3 = iArr[i2];
int i4 = i;
while (i < i2) {
if (iArr[i] <= i3) {
swap(iArr, fArr, i4, i);
i4++;
}
i++;
}
swap(iArr, fArr, i4, i2);
return i4;
}
private static void swap(int[] iArr, float[] fArr, int i, int i2) {
int i3 = iArr[i];
iArr[i] = iArr[i2];
iArr[i2] = i3;
float f = fArr[i];
fArr[i] = fArr[i2];
fArr[i2] = f;
}
}
public static class CustomSet extends SplineSet {
String mAttributeName;
KeyFrameArray.CustomArray mConstraintAttributeList;
float[] mTempValues;
public CustomSet(String str, KeyFrameArray.CustomArray customArray) {
this.mAttributeName = str.split(",")[1];
this.mConstraintAttributeList = customArray;
}
@Override // androidx.constraintlayout.core.motion.utils.SplineSet
public void setup(int i) {
int size = this.mConstraintAttributeList.size();
int numberOfInterpolatedValues = this.mConstraintAttributeList.valueAt(0).numberOfInterpolatedValues();
double[] dArr = new double[size];
this.mTempValues = new float[numberOfInterpolatedValues];
double[][] dArr2 = (double[][]) Array.newInstance((Class<?>) Double.TYPE, size, numberOfInterpolatedValues);
for (int i2 = 0; i2 < size; i2++) {
int keyAt = this.mConstraintAttributeList.keyAt(i2);
CustomAttribute valueAt = this.mConstraintAttributeList.valueAt(i2);
dArr[i2] = keyAt * 0.01d;
valueAt.getValuesToInterpolate(this.mTempValues);
int i3 = 0;
while (true) {
if (i3 < this.mTempValues.length) {
dArr2[i2][i3] = r6[i3];
i3++;
}
}
}
this.mCurveFit = CurveFit.get(i, dArr, dArr2);
}
@Override // androidx.constraintlayout.core.motion.utils.SplineSet
public void setPoint(int i, float f) {
throw new RuntimeException("don't call for custom attribute call setPoint(pos, ConstraintAttribute)");
}
public void setPoint(int i, CustomAttribute customAttribute) {
this.mConstraintAttributeList.append(i, customAttribute);
}
public void setProperty(WidgetFrame widgetFrame, float f) {
this.mCurveFit.getPos(f, this.mTempValues);
widgetFrame.setCustomValue(this.mConstraintAttributeList.valueAt(0), this.mTempValues);
}
}
private static class CoreSpline extends SplineSet {
long start;
String type;
public CoreSpline(String str, long j) {
this.type = str;
this.start = j;
}
@Override // androidx.constraintlayout.core.motion.utils.SplineSet
public void setProperty(TypedValues typedValues, float f) {
typedValues.setValue(typedValues.getId(this.type), get(f));
}
}
public static class CustomSpline extends SplineSet {
String mAttributeName;
KeyFrameArray.CustomVar mConstraintAttributeList;
float[] mTempValues;
public CustomSpline(String str, KeyFrameArray.CustomVar customVar) {
this.mAttributeName = str.split(",")[1];
this.mConstraintAttributeList = customVar;
}
@Override // androidx.constraintlayout.core.motion.utils.SplineSet
public void setup(int i) {
int size = this.mConstraintAttributeList.size();
int numberOfInterpolatedValues = this.mConstraintAttributeList.valueAt(0).numberOfInterpolatedValues();
double[] dArr = new double[size];
this.mTempValues = new float[numberOfInterpolatedValues];
double[][] dArr2 = (double[][]) Array.newInstance((Class<?>) Double.TYPE, size, numberOfInterpolatedValues);
for (int i2 = 0; i2 < size; i2++) {
int keyAt = this.mConstraintAttributeList.keyAt(i2);
CustomVariable valueAt = this.mConstraintAttributeList.valueAt(i2);
dArr[i2] = keyAt * 0.01d;
valueAt.getValuesToInterpolate(this.mTempValues);
int i3 = 0;
while (true) {
if (i3 < this.mTempValues.length) {
dArr2[i2][i3] = r6[i3];
i3++;
}
}
}
this.mCurveFit = CurveFit.get(i, dArr, dArr2);
}
@Override // androidx.constraintlayout.core.motion.utils.SplineSet
public void setPoint(int i, float f) {
throw new RuntimeException("don't call for custom attribute call setPoint(pos, ConstraintAttribute)");
}
@Override // androidx.constraintlayout.core.motion.utils.SplineSet
public void setProperty(TypedValues typedValues, float f) {
setProperty((MotionWidget) typedValues, f);
}
public void setPoint(int i, CustomVariable customVariable) {
this.mConstraintAttributeList.append(i, customVariable);
}
public void setProperty(MotionWidget motionWidget, float f) {
this.mCurveFit.getPos(f, this.mTempValues);
this.mConstraintAttributeList.valueAt(0).setInterpolatedValue(motionWidget, this.mTempValues);
}
}
}

View File

@ -0,0 +1,108 @@
package androidx.constraintlayout.core.motion.utils;
/* loaded from: classes.dex */
public class SpringStopEngine implements StopEngine {
private static final double UNSET = Double.MAX_VALUE;
private float mLastTime;
private double mLastVelocity;
private float mMass;
private float mPos;
private double mStiffness;
private float mStopThreshold;
private double mTargetPos;
private float mV;
double mDamping = 0.5d;
private boolean mInitialized = false;
private int mBoundaryMode = 0;
@Override // androidx.constraintlayout.core.motion.utils.StopEngine
public String debug(String str, float f) {
return null;
}
public float getAcceleration() {
return ((float) (((-this.mStiffness) * (this.mPos - this.mTargetPos)) - (this.mDamping * this.mV))) / this.mMass;
}
@Override // androidx.constraintlayout.core.motion.utils.StopEngine
public float getVelocity() {
return 0.0f;
}
@Override // androidx.constraintlayout.core.motion.utils.StopEngine
public float getVelocity(float f) {
return this.mV;
}
public void springConfig(float f, float f2, float f3, float f4, float f5, float f6, float f7, int i) {
this.mTargetPos = f2;
this.mDamping = f6;
this.mInitialized = false;
this.mPos = f;
this.mLastVelocity = f3;
this.mStiffness = f5;
this.mMass = f4;
this.mStopThreshold = f7;
this.mBoundaryMode = i;
this.mLastTime = 0.0f;
}
void log(String str) {
StackTraceElement stackTraceElement = new Throwable().getStackTrace()[1];
String str2 = ".(" + stackTraceElement.getFileName() + ":" + stackTraceElement.getLineNumber() + ") " + stackTraceElement.getMethodName() + "() ";
System.out.println(str2 + str);
}
@Override // androidx.constraintlayout.core.motion.utils.StopEngine
public float getInterpolation(float f) {
compute(f - this.mLastTime);
this.mLastTime = f;
return this.mPos;
}
@Override // androidx.constraintlayout.core.motion.utils.StopEngine
public boolean isStopped() {
double d = this.mPos - this.mTargetPos;
double d2 = this.mStiffness;
double d3 = this.mV;
return Math.sqrt((((d3 * d3) * ((double) this.mMass)) + ((d2 * d) * d)) / d2) <= ((double) this.mStopThreshold);
}
private void compute(double d) {
double d2 = this.mStiffness;
double d3 = this.mDamping;
int sqrt = (int) ((9.0d / ((Math.sqrt(d2 / this.mMass) * d) * 4.0d)) + 1.0d);
double d4 = d / sqrt;
int i = 0;
while (i < sqrt) {
float f = this.mPos;
double d5 = this.mTargetPos;
float f2 = this.mV;
double d6 = d2;
double d7 = ((-d2) * (f - d5)) - (f2 * d3);
float f3 = this.mMass;
double d8 = d3;
double d9 = f2 + (((d7 / f3) * d4) / 2.0d);
double d10 = ((((-((f + ((d4 * d9) / 2.0d)) - d5)) * d6) - (d9 * d8)) / f3) * d4;
float f4 = (float) (f2 + d10);
this.mV = f4;
float f5 = (float) (f + ((f2 + (d10 / 2.0d)) * d4));
this.mPos = f5;
int i2 = this.mBoundaryMode;
if (i2 > 0) {
if (f5 < 0.0f && (i2 & 1) == 1) {
this.mPos = -f5;
this.mV = -f4;
}
float f6 = this.mPos;
if (f6 > 1.0f && (i2 & 2) == 2) {
this.mPos = 2.0f - f6;
this.mV = -this.mV;
}
}
i++;
d2 = d6;
d3 = d8;
}
}
}

View File

@ -0,0 +1,73 @@
package androidx.constraintlayout.core.motion.utils;
import java.lang.reflect.Array;
import java.util.Arrays;
/* loaded from: classes.dex */
public class StepCurve extends Easing {
private static final boolean DEBUG = false;
MonotonicCurveFit mCurveFit;
StepCurve(String str) {
this.str = str;
double[] dArr = new double[this.str.length() / 2];
int indexOf = str.indexOf(40) + 1;
int indexOf2 = str.indexOf(44, indexOf);
int i = 0;
while (indexOf2 != -1) {
dArr[i] = Double.parseDouble(str.substring(indexOf, indexOf2).trim());
indexOf = indexOf2 + 1;
indexOf2 = str.indexOf(44, indexOf);
i++;
}
dArr[i] = Double.parseDouble(str.substring(indexOf, str.indexOf(41, indexOf)).trim());
this.mCurveFit = genSpline(Arrays.copyOf(dArr, i + 1));
}
private static MonotonicCurveFit genSpline(String str) {
String[] split = str.split("\\s+");
int length = split.length;
double[] dArr = new double[length];
for (int i = 0; i < length; i++) {
dArr[i] = Double.parseDouble(split[i]);
}
return genSpline(dArr);
}
private static MonotonicCurveFit genSpline(double[] dArr) {
int length = (dArr.length * 3) - 2;
int length2 = dArr.length - 1;
double d = 1.0d / length2;
double[][] dArr2 = (double[][]) Array.newInstance((Class<?>) Double.TYPE, length, 1);
double[] dArr3 = new double[length];
for (int i = 0; i < dArr.length; i++) {
double d2 = dArr[i];
int i2 = i + length2;
dArr2[i2][0] = d2;
double d3 = i * d;
dArr3[i2] = d3;
if (i > 0) {
int i3 = (length2 * 2) + i;
dArr2[i3][0] = d2 + 1.0d;
dArr3[i3] = d3 + 1.0d;
int i4 = i - 1;
dArr2[i4][0] = (d2 - 1.0d) - d;
dArr3[i4] = (d3 - 1.0d) - d;
}
}
MonotonicCurveFit monotonicCurveFit = new MonotonicCurveFit(dArr3, dArr2);
System.out.println(" 0 " + monotonicCurveFit.getPos(0.0d, 0));
System.out.println(" 1 " + monotonicCurveFit.getPos(1.0d, 0));
return monotonicCurveFit;
}
@Override // androidx.constraintlayout.core.motion.utils.Easing
public double getDiff(double d) {
return this.mCurveFit.getSlope(d, 0);
}
@Override // androidx.constraintlayout.core.motion.utils.Easing
public double get(double d) {
return this.mCurveFit.getPos(d, 0);
}
}

View File

@ -0,0 +1,14 @@
package androidx.constraintlayout.core.motion.utils;
/* loaded from: classes.dex */
public interface StopEngine {
String debug(String str, float f);
float getInterpolation(float f);
float getVelocity();
float getVelocity(float f);
boolean isStopped();
}

View File

@ -0,0 +1,250 @@
package androidx.constraintlayout.core.motion.utils;
/* loaded from: classes.dex */
public class StopLogicEngine implements StopEngine {
private static final float EPSILON = 1.0E-5f;
private boolean mBackwards = false;
private boolean mDone = false;
private float mLastPosition;
private int mNumberOfStages;
private float mStage1Duration;
private float mStage1EndPosition;
private float mStage1Velocity;
private float mStage2Duration;
private float mStage2EndPosition;
private float mStage2Velocity;
private float mStage3Duration;
private float mStage3EndPosition;
private float mStage3Velocity;
private float mStartPosition;
private String mType;
private float calcY(float f) {
this.mDone = false;
float f2 = this.mStage1Duration;
if (f <= f2) {
float f3 = this.mStage1Velocity;
return (f3 * f) + ((((this.mStage2Velocity - f3) * f) * f) / (f2 * 2.0f));
}
int i = this.mNumberOfStages;
if (i == 1) {
return this.mStage1EndPosition;
}
float f4 = f - f2;
float f5 = this.mStage2Duration;
if (f4 < f5) {
float f6 = this.mStage1EndPosition;
float f7 = this.mStage2Velocity;
return f6 + (f7 * f4) + ((((this.mStage3Velocity - f7) * f4) * f4) / (f5 * 2.0f));
}
if (i == 2) {
return this.mStage2EndPosition;
}
float f8 = f4 - f5;
float f9 = this.mStage3Duration;
if (f8 > f9) {
this.mDone = true;
return this.mStage3EndPosition;
}
float f10 = this.mStage2EndPosition;
float f11 = this.mStage3Velocity;
return (f10 + (f11 * f8)) - (((f11 * f8) * f8) / (f9 * 2.0f));
}
@Override // androidx.constraintlayout.core.motion.utils.StopEngine
public float getVelocity(float f) {
float f2 = this.mStage1Duration;
if (f <= f2) {
float f3 = this.mStage1Velocity;
return f3 + (((this.mStage2Velocity - f3) * f) / f2);
}
int i = this.mNumberOfStages;
if (i == 1) {
return 0.0f;
}
float f4 = f - f2;
float f5 = this.mStage2Duration;
if (f4 < f5) {
float f6 = this.mStage2Velocity;
return f6 + (((this.mStage3Velocity - f6) * f4) / f5);
}
if (i == 2) {
return this.mStage2EndPosition;
}
float f7 = f4 - f5;
float f8 = this.mStage3Duration;
if (f7 >= f8) {
return this.mStage3EndPosition;
}
float f9 = this.mStage3Velocity;
return f9 - ((f7 * f9) / f8);
}
@Override // androidx.constraintlayout.core.motion.utils.StopEngine
public String debug(String str, float f) {
String str2 = str + " ===== " + this.mType + "\n";
StringBuilder sb = new StringBuilder();
sb.append(str2);
sb.append(str);
sb.append(this.mBackwards ? "backwards" : "forward ");
sb.append(" time = ");
sb.append(f);
sb.append(" stages ");
sb.append(this.mNumberOfStages);
sb.append("\n");
String str3 = sb.toString() + str + " dur " + this.mStage1Duration + " vel " + this.mStage1Velocity + " pos " + this.mStage1EndPosition + "\n";
if (this.mNumberOfStages > 1) {
str3 = str3 + str + " dur " + this.mStage2Duration + " vel " + this.mStage2Velocity + " pos " + this.mStage2EndPosition + "\n";
}
if (this.mNumberOfStages > 2) {
str3 = str3 + str + " dur " + this.mStage3Duration + " vel " + this.mStage3Velocity + " pos " + this.mStage3EndPosition + "\n";
}
float f2 = this.mStage1Duration;
if (f <= f2) {
return str3 + str + "stage 0\n";
}
int i = this.mNumberOfStages;
if (i == 1) {
return str3 + str + "end stage 0\n";
}
float f3 = f - f2;
float f4 = this.mStage2Duration;
if (f3 < f4) {
return str3 + str + " stage 1\n";
}
if (i == 2) {
return str3 + str + "end stage 1\n";
}
if (f3 - f4 < this.mStage3Duration) {
return str3 + str + " stage 2\n";
}
return str3 + str + " end stage 2\n";
}
public void config(float f, float f2, float f3, float f4, float f5, float f6) {
this.mDone = false;
this.mStartPosition = f;
boolean z = f > f2;
this.mBackwards = z;
if (z) {
setup(-f3, f - f2, f5, f6, f4);
} else {
setup(f3, f2 - f, f5, f6, f4);
}
}
@Override // androidx.constraintlayout.core.motion.utils.StopEngine
public float getInterpolation(float f) {
float calcY = calcY(f);
this.mLastPosition = f;
return this.mBackwards ? this.mStartPosition - calcY : this.mStartPosition + calcY;
}
@Override // androidx.constraintlayout.core.motion.utils.StopEngine
public float getVelocity() {
return this.mBackwards ? -getVelocity(this.mLastPosition) : getVelocity(this.mLastPosition);
}
@Override // androidx.constraintlayout.core.motion.utils.StopEngine
public boolean isStopped() {
return getVelocity() < EPSILON && Math.abs(this.mStage3EndPosition - this.mLastPosition) < EPSILON;
}
private void setup(float f, float f2, float f3, float f4, float f5) {
this.mDone = false;
if (f == 0.0f) {
f = 1.0E-4f;
}
this.mStage1Velocity = f;
float f6 = f / f3;
float f7 = (f6 * f) / 2.0f;
if (f < 0.0f) {
float sqrt = (float) Math.sqrt((f2 - ((((-f) / f3) * f) / 2.0f)) * f3);
if (sqrt < f4) {
this.mType = "backward accelerate, decelerate";
this.mNumberOfStages = 2;
this.mStage1Velocity = f;
this.mStage2Velocity = sqrt;
this.mStage3Velocity = 0.0f;
float f8 = (sqrt - f) / f3;
this.mStage1Duration = f8;
this.mStage2Duration = sqrt / f3;
this.mStage1EndPosition = ((f + sqrt) * f8) / 2.0f;
this.mStage2EndPosition = f2;
this.mStage3EndPosition = f2;
return;
}
this.mType = "backward accelerate cruse decelerate";
this.mNumberOfStages = 3;
this.mStage1Velocity = f;
this.mStage2Velocity = f4;
this.mStage3Velocity = f4;
float f9 = (f4 - f) / f3;
this.mStage1Duration = f9;
float f10 = f4 / f3;
this.mStage3Duration = f10;
float f11 = ((f + f4) * f9) / 2.0f;
float f12 = (f10 * f4) / 2.0f;
this.mStage2Duration = ((f2 - f11) - f12) / f4;
this.mStage1EndPosition = f11;
this.mStage2EndPosition = f2 - f12;
this.mStage3EndPosition = f2;
return;
}
if (f7 >= f2) {
this.mType = "hard stop";
this.mNumberOfStages = 1;
this.mStage1Velocity = f;
this.mStage2Velocity = 0.0f;
this.mStage1EndPosition = f2;
this.mStage1Duration = (2.0f * f2) / f;
return;
}
float f13 = f2 - f7;
float f14 = f13 / f;
if (f14 + f6 < f5) {
this.mType = "cruse decelerate";
this.mNumberOfStages = 2;
this.mStage1Velocity = f;
this.mStage2Velocity = f;
this.mStage3Velocity = 0.0f;
this.mStage1EndPosition = f13;
this.mStage2EndPosition = f2;
this.mStage1Duration = f14;
this.mStage2Duration = f6;
return;
}
float sqrt2 = (float) Math.sqrt((f3 * f2) + ((f * f) / 2.0f));
float f15 = (sqrt2 - f) / f3;
this.mStage1Duration = f15;
float f16 = sqrt2 / f3;
this.mStage2Duration = f16;
if (sqrt2 < f4) {
this.mType = "accelerate decelerate";
this.mNumberOfStages = 2;
this.mStage1Velocity = f;
this.mStage2Velocity = sqrt2;
this.mStage3Velocity = 0.0f;
this.mStage1Duration = f15;
this.mStage2Duration = f16;
this.mStage1EndPosition = ((f + sqrt2) * f15) / 2.0f;
this.mStage2EndPosition = f2;
return;
}
this.mType = "accelerate cruse decelerate";
this.mNumberOfStages = 3;
this.mStage1Velocity = f;
this.mStage2Velocity = f4;
this.mStage3Velocity = f4;
float f17 = (f4 - f) / f3;
this.mStage1Duration = f17;
float f18 = f4 / f3;
this.mStage3Duration = f18;
float f19 = ((f + f4) * f17) / 2.0f;
float f20 = (f18 * f4) / 2.0f;
this.mStage2Duration = ((f2 - f19) - f20) / f4;
this.mStage1EndPosition = f19;
this.mStage2EndPosition = f2 - f20;
this.mStage3EndPosition = f2;
}
}

View File

@ -0,0 +1,338 @@
package androidx.constraintlayout.core.motion.utils;
import androidx.constraintlayout.core.motion.CustomAttribute;
import androidx.constraintlayout.core.motion.CustomVariable;
import androidx.constraintlayout.core.motion.MotionWidget;
import androidx.constraintlayout.core.motion.utils.KeyFrameArray;
import java.lang.reflect.Array;
import java.text.DecimalFormat;
/* loaded from: classes.dex */
public abstract class TimeCycleSplineSet {
protected static final int CURVE_OFFSET = 2;
protected static final int CURVE_PERIOD = 1;
protected static final int CURVE_VALUE = 0;
private static final String TAG = "SplineSet";
protected static float VAL_2PI = 6.2831855f;
protected int count;
protected long last_time;
protected CurveFit mCurveFit;
protected String mType;
protected int mWaveShape = 0;
protected int[] mTimePoints = new int[10];
protected float[][] mValues = (float[][]) Array.newInstance((Class<?>) Float.TYPE, 10, 3);
protected float[] mCache = new float[3];
protected boolean mContinue = false;
protected float last_cycle = Float.NaN;
public CurveFit getCurveFit() {
return this.mCurveFit;
}
protected void setStartTime(long j) {
this.last_time = j;
}
public void setType(String str) {
this.mType = str;
}
public String toString() {
String str = this.mType;
DecimalFormat decimalFormat = new DecimalFormat("##.##");
for (int i = 0; i < this.count; i++) {
str = str + "[" + this.mTimePoints[i] + " , " + decimalFormat.format(this.mValues[i]) + "] ";
}
return str;
}
protected float calcWave(float f) {
float abs;
switch (this.mWaveShape) {
case 1:
return Math.signum(f * VAL_2PI);
case 2:
abs = Math.abs(f);
break;
case 3:
return (((f * 2.0f) + 1.0f) % 2.0f) - 1.0f;
case 4:
abs = ((f * 2.0f) + 1.0f) % 2.0f;
break;
case 5:
return (float) Math.cos(f * VAL_2PI);
case 6:
float abs2 = 1.0f - Math.abs(((f * 4.0f) % 4.0f) - 2.0f);
abs = abs2 * abs2;
break;
default:
return (float) Math.sin(f * VAL_2PI);
}
return 1.0f - abs;
}
public void setPoint(int i, float f, float f2, int i2, float f3) {
int[] iArr = this.mTimePoints;
int i3 = this.count;
iArr[i3] = i;
float[] fArr = this.mValues[i3];
fArr[0] = f;
fArr[1] = f2;
fArr[2] = f3;
this.mWaveShape = Math.max(this.mWaveShape, i2);
this.count++;
}
public static class CustomSet extends TimeCycleSplineSet {
String mAttributeName;
float[] mCache;
KeyFrameArray.CustomArray mConstraintAttributeList;
float[] mTempValues;
KeyFrameArray.FloatArray mWaveProperties = new KeyFrameArray.FloatArray();
public CustomSet(String str, KeyFrameArray.CustomArray customArray) {
this.mAttributeName = str.split(",")[1];
this.mConstraintAttributeList = customArray;
}
@Override // androidx.constraintlayout.core.motion.utils.TimeCycleSplineSet
public void setup(int i) {
int size = this.mConstraintAttributeList.size();
int numberOfInterpolatedValues = this.mConstraintAttributeList.valueAt(0).numberOfInterpolatedValues();
double[] dArr = new double[size];
int i2 = numberOfInterpolatedValues + 2;
this.mTempValues = new float[i2];
this.mCache = new float[numberOfInterpolatedValues];
double[][] dArr2 = (double[][]) Array.newInstance((Class<?>) Double.TYPE, size, i2);
for (int i3 = 0; i3 < size; i3++) {
int keyAt = this.mConstraintAttributeList.keyAt(i3);
CustomAttribute valueAt = this.mConstraintAttributeList.valueAt(i3);
float[] valueAt2 = this.mWaveProperties.valueAt(i3);
dArr[i3] = keyAt * 0.01d;
valueAt.getValuesToInterpolate(this.mTempValues);
int i4 = 0;
while (true) {
if (i4 < this.mTempValues.length) {
dArr2[i3][i4] = r7[i4];
i4++;
}
}
double[] dArr3 = dArr2[i3];
dArr3[numberOfInterpolatedValues] = valueAt2[0];
dArr3[numberOfInterpolatedValues + 1] = valueAt2[1];
}
this.mCurveFit = CurveFit.get(i, dArr, dArr2);
}
@Override // androidx.constraintlayout.core.motion.utils.TimeCycleSplineSet
public void setPoint(int i, float f, float f2, int i2, float f3) {
throw new RuntimeException("don't call for custom attribute call setPoint(pos, ConstraintAttribute,...)");
}
public void setPoint(int i, CustomAttribute customAttribute, float f, int i2, float f2) {
this.mConstraintAttributeList.append(i, customAttribute);
this.mWaveProperties.append(i, new float[]{f, f2});
this.mWaveShape = Math.max(this.mWaveShape, i2);
}
public boolean setProperty(MotionWidget motionWidget, float f, long j, KeyCache keyCache) {
this.mCurveFit.getPos(f, this.mTempValues);
float[] fArr = this.mTempValues;
float f2 = fArr[fArr.length - 2];
float f3 = fArr[fArr.length - 1];
long j2 = j - this.last_time;
if (Float.isNaN(this.last_cycle)) {
this.last_cycle = keyCache.getFloatValue(motionWidget, this.mAttributeName, 0);
if (Float.isNaN(this.last_cycle)) {
this.last_cycle = 0.0f;
}
}
this.last_cycle = (float) ((this.last_cycle + ((j2 * 1.0E-9d) * f2)) % 1.0d);
this.last_time = j;
float calcWave = calcWave(this.last_cycle);
this.mContinue = false;
for (int i = 0; i < this.mCache.length; i++) {
this.mContinue |= ((double) this.mTempValues[i]) != 0.0d;
this.mCache[i] = (this.mTempValues[i] * calcWave) + f3;
}
motionWidget.setInterpolatedValue(this.mConstraintAttributeList.valueAt(0), this.mCache);
if (f2 != 0.0f) {
this.mContinue = true;
}
return this.mContinue;
}
}
public void setup(int i) {
int i2;
int i3 = this.count;
if (i3 == 0) {
System.err.println("Error no points added to " + this.mType);
return;
}
Sort.doubleQuickSort(this.mTimePoints, this.mValues, 0, i3 - 1);
int i4 = 1;
int i5 = 0;
while (true) {
int[] iArr = this.mTimePoints;
if (i4 >= iArr.length) {
break;
}
if (iArr[i4] != iArr[i4 - 1]) {
i5++;
}
i4++;
}
if (i5 == 0) {
i5 = 1;
}
double[] dArr = new double[i5];
double[][] dArr2 = (double[][]) Array.newInstance((Class<?>) Double.TYPE, i5, 3);
int i6 = 0;
while (i2 < this.count) {
if (i2 > 0) {
int[] iArr2 = this.mTimePoints;
i2 = iArr2[i2] == iArr2[i2 + (-1)] ? i2 + 1 : 0;
}
dArr[i6] = this.mTimePoints[i2] * 0.01d;
double[] dArr3 = dArr2[i6];
float[] fArr = this.mValues[i2];
dArr3[0] = fArr[0];
dArr3[1] = fArr[1];
dArr3[2] = fArr[2];
i6++;
}
this.mCurveFit = CurveFit.get(i, dArr, dArr2);
}
protected static class Sort {
protected Sort() {
}
static void doubleQuickSort(int[] iArr, float[][] fArr, int i, int i2) {
int[] iArr2 = new int[iArr.length + 10];
iArr2[0] = i2;
iArr2[1] = i;
int i3 = 2;
while (i3 > 0) {
int i4 = iArr2[i3 - 1];
int i5 = i3 - 2;
int i6 = iArr2[i5];
if (i4 < i6) {
int partition = partition(iArr, fArr, i4, i6);
iArr2[i5] = partition - 1;
iArr2[i3 - 1] = i4;
int i7 = i3 + 1;
iArr2[i3] = i6;
i3 += 2;
iArr2[i7] = partition + 1;
} else {
i3 = i5;
}
}
}
private static int partition(int[] iArr, float[][] fArr, int i, int i2) {
int i3 = iArr[i2];
int i4 = i;
while (i < i2) {
if (iArr[i] <= i3) {
swap(iArr, fArr, i4, i);
i4++;
}
i++;
}
swap(iArr, fArr, i4, i2);
return i4;
}
private static void swap(int[] iArr, float[][] fArr, int i, int i2) {
int i3 = iArr[i];
iArr[i] = iArr[i2];
iArr[i2] = i3;
float[] fArr2 = fArr[i];
fArr[i] = fArr[i2];
fArr[i2] = fArr2;
}
}
public static class CustomVarSet extends TimeCycleSplineSet {
String mAttributeName;
float[] mCache;
KeyFrameArray.CustomVar mConstraintAttributeList;
float[] mTempValues;
KeyFrameArray.FloatArray mWaveProperties = new KeyFrameArray.FloatArray();
public CustomVarSet(String str, KeyFrameArray.CustomVar customVar) {
this.mAttributeName = str.split(",")[1];
this.mConstraintAttributeList = customVar;
}
@Override // androidx.constraintlayout.core.motion.utils.TimeCycleSplineSet
public void setup(int i) {
int size = this.mConstraintAttributeList.size();
int numberOfInterpolatedValues = this.mConstraintAttributeList.valueAt(0).numberOfInterpolatedValues();
double[] dArr = new double[size];
int i2 = numberOfInterpolatedValues + 2;
this.mTempValues = new float[i2];
this.mCache = new float[numberOfInterpolatedValues];
double[][] dArr2 = (double[][]) Array.newInstance((Class<?>) Double.TYPE, size, i2);
for (int i3 = 0; i3 < size; i3++) {
int keyAt = this.mConstraintAttributeList.keyAt(i3);
CustomVariable valueAt = this.mConstraintAttributeList.valueAt(i3);
float[] valueAt2 = this.mWaveProperties.valueAt(i3);
dArr[i3] = keyAt * 0.01d;
valueAt.getValuesToInterpolate(this.mTempValues);
int i4 = 0;
while (true) {
if (i4 < this.mTempValues.length) {
dArr2[i3][i4] = r7[i4];
i4++;
}
}
double[] dArr3 = dArr2[i3];
dArr3[numberOfInterpolatedValues] = valueAt2[0];
dArr3[numberOfInterpolatedValues + 1] = valueAt2[1];
}
this.mCurveFit = CurveFit.get(i, dArr, dArr2);
}
@Override // androidx.constraintlayout.core.motion.utils.TimeCycleSplineSet
public void setPoint(int i, float f, float f2, int i2, float f3) {
throw new RuntimeException("don't call for custom attribute call setPoint(pos, ConstraintAttribute,...)");
}
public void setPoint(int i, CustomVariable customVariable, float f, int i2, float f2) {
this.mConstraintAttributeList.append(i, customVariable);
this.mWaveProperties.append(i, new float[]{f, f2});
this.mWaveShape = Math.max(this.mWaveShape, i2);
}
public boolean setProperty(MotionWidget motionWidget, float f, long j, KeyCache keyCache) {
this.mCurveFit.getPos(f, this.mTempValues);
float[] fArr = this.mTempValues;
float f2 = fArr[fArr.length - 2];
float f3 = fArr[fArr.length - 1];
long j2 = j - this.last_time;
if (Float.isNaN(this.last_cycle)) {
this.last_cycle = keyCache.getFloatValue(motionWidget, this.mAttributeName, 0);
if (Float.isNaN(this.last_cycle)) {
this.last_cycle = 0.0f;
}
}
this.last_cycle = (float) ((this.last_cycle + ((j2 * 1.0E-9d) * f2)) % 1.0d);
this.last_time = j;
float calcWave = calcWave(this.last_cycle);
this.mContinue = false;
for (int i = 0; i < this.mCache.length; i++) {
this.mContinue |= ((double) this.mTempValues[i]) != 0.0d;
this.mCache[i] = (this.mTempValues[i] * calcWave) + f3;
}
this.mConstraintAttributeList.valueAt(0).setInterpolatedValue(motionWidget, this.mCache);
if (f2 != 0.0f) {
this.mContinue = true;
}
return this.mContinue;
}
}
}

View File

@ -0,0 +1,139 @@
package androidx.constraintlayout.core.motion.utils;
import java.util.Arrays;
/* loaded from: classes.dex */
public class TypedBundle {
private static final int INITIAL_BOOLEAN = 4;
private static final int INITIAL_FLOAT = 10;
private static final int INITIAL_INT = 10;
private static final int INITIAL_STRING = 5;
int[] mTypeInt = new int[10];
int[] mValueInt = new int[10];
int mCountInt = 0;
int[] mTypeFloat = new int[10];
float[] mValueFloat = new float[10];
int mCountFloat = 0;
int[] mTypeString = new int[5];
String[] mValueString = new String[5];
int mCountString = 0;
int[] mTypeBoolean = new int[4];
boolean[] mValueBoolean = new boolean[4];
int mCountBoolean = 0;
public void clear() {
this.mCountBoolean = 0;
this.mCountString = 0;
this.mCountFloat = 0;
this.mCountInt = 0;
}
public int getInteger(int i) {
for (int i2 = 0; i2 < this.mCountInt; i2++) {
if (this.mTypeInt[i2] == i) {
return this.mValueInt[i2];
}
}
return -1;
}
public void add(int i, int i2) {
int i3 = this.mCountInt;
int[] iArr = this.mTypeInt;
if (i3 >= iArr.length) {
this.mTypeInt = Arrays.copyOf(iArr, iArr.length * 2);
int[] iArr2 = this.mValueInt;
this.mValueInt = Arrays.copyOf(iArr2, iArr2.length * 2);
}
int[] iArr3 = this.mTypeInt;
int i4 = this.mCountInt;
iArr3[i4] = i;
int[] iArr4 = this.mValueInt;
this.mCountInt = i4 + 1;
iArr4[i4] = i2;
}
public void add(int i, float f) {
int i2 = this.mCountFloat;
int[] iArr = this.mTypeFloat;
if (i2 >= iArr.length) {
this.mTypeFloat = Arrays.copyOf(iArr, iArr.length * 2);
float[] fArr = this.mValueFloat;
this.mValueFloat = Arrays.copyOf(fArr, fArr.length * 2);
}
int[] iArr2 = this.mTypeFloat;
int i3 = this.mCountFloat;
iArr2[i3] = i;
float[] fArr2 = this.mValueFloat;
this.mCountFloat = i3 + 1;
fArr2[i3] = f;
}
public void addIfNotNull(int i, String str) {
if (str != null) {
add(i, str);
}
}
public void add(int i, String str) {
int i2 = this.mCountString;
int[] iArr = this.mTypeString;
if (i2 >= iArr.length) {
this.mTypeString = Arrays.copyOf(iArr, iArr.length * 2);
String[] strArr = this.mValueString;
this.mValueString = (String[]) Arrays.copyOf(strArr, strArr.length * 2);
}
int[] iArr2 = this.mTypeString;
int i3 = this.mCountString;
iArr2[i3] = i;
String[] strArr2 = this.mValueString;
this.mCountString = i3 + 1;
strArr2[i3] = str;
}
public void add(int i, boolean z) {
int i2 = this.mCountBoolean;
int[] iArr = this.mTypeBoolean;
if (i2 >= iArr.length) {
this.mTypeBoolean = Arrays.copyOf(iArr, iArr.length * 2);
boolean[] zArr = this.mValueBoolean;
this.mValueBoolean = Arrays.copyOf(zArr, zArr.length * 2);
}
int[] iArr2 = this.mTypeBoolean;
int i3 = this.mCountBoolean;
iArr2[i3] = i;
boolean[] zArr2 = this.mValueBoolean;
this.mCountBoolean = i3 + 1;
zArr2[i3] = z;
}
public void applyDelta(TypedValues typedValues) {
for (int i = 0; i < this.mCountInt; i++) {
typedValues.setValue(this.mTypeInt[i], this.mValueInt[i]);
}
for (int i2 = 0; i2 < this.mCountFloat; i2++) {
typedValues.setValue(this.mTypeFloat[i2], this.mValueFloat[i2]);
}
for (int i3 = 0; i3 < this.mCountString; i3++) {
typedValues.setValue(this.mTypeString[i3], this.mValueString[i3]);
}
for (int i4 = 0; i4 < this.mCountBoolean; i4++) {
typedValues.setValue(this.mTypeBoolean[i4], this.mValueBoolean[i4]);
}
}
public void applyDelta(TypedBundle typedBundle) {
for (int i = 0; i < this.mCountInt; i++) {
typedBundle.add(this.mTypeInt[i], this.mValueInt[i]);
}
for (int i2 = 0; i2 < this.mCountFloat; i2++) {
typedBundle.add(this.mTypeFloat[i2], this.mValueFloat[i2]);
}
for (int i3 = 0; i3 < this.mCountString; i3++) {
typedBundle.add(this.mTypeString[i3], this.mValueString[i3]);
}
for (int i4 = 0; i4 < this.mCountBoolean; i4++) {
typedBundle.add(this.mTypeBoolean[i4], this.mValueBoolean[i4]);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,74 @@
package androidx.constraintlayout.core.motion.utils;
import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;
/* loaded from: classes.dex */
public class Utils {
static DebugHandle ourHandle;
public interface DebugHandle {
void message(String str);
}
private static int clamp(int i) {
int i2 = (i & (~(i >> 31))) - 255;
return (i2 & (i2 >> 31)) + 255;
}
public static void setDebugHandle(DebugHandle debugHandle) {
ourHandle = debugHandle;
}
public static void log(String str, String str2) {
System.out.println(str + " : " + str2);
}
public static void loge(String str, String str2) {
System.err.println(str + " : " + str2);
}
public static void socketSend(String str) {
try {
OutputStream outputStream = new Socket("127.0.0.1", 5327).getOutputStream();
outputStream.write(str.getBytes());
outputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
public int getInterpolatedColor(float[] fArr) {
return (clamp((int) (fArr[3] * 255.0f)) << 24) | (clamp((int) (((float) Math.pow(fArr[0], 0.45454545454545453d)) * 255.0f)) << 16) | (clamp((int) (((float) Math.pow(fArr[1], 0.45454545454545453d)) * 255.0f)) << 8) | clamp((int) (((float) Math.pow(fArr[2], 0.45454545454545453d)) * 255.0f));
}
public static int rgbaTocColor(float f, float f2, float f3, float f4) {
int clamp = clamp((int) (f * 255.0f));
int clamp2 = clamp((int) (f2 * 255.0f));
return (clamp << 16) | (clamp((int) (f4 * 255.0f)) << 24) | (clamp2 << 8) | clamp((int) (f3 * 255.0f));
}
public static void logStack(String str, int i) {
StackTraceElement[] stackTrace = new Throwable().getStackTrace();
int min = Math.min(i, stackTrace.length - 1);
String str2 = " ";
for (int i2 = 1; i2 <= min; i2++) {
StackTraceElement stackTraceElement = stackTrace[i2];
String str3 = ".(" + stackTrace[i2].getFileName() + ":" + stackTrace[i2].getLineNumber() + ") " + stackTrace[i2].getMethodName();
str2 = str2 + " ";
System.out.println(str + str2 + str3 + str2);
}
}
public static void log(String str) {
StackTraceElement stackTraceElement = new Throwable().getStackTrace()[1];
String substring = (stackTraceElement.getMethodName() + " ").substring(0, 17);
String str2 = ".(" + stackTraceElement.getFileName() + ":" + stackTraceElement.getLineNumber() + ")" + " ".substring(Integer.toString(stackTraceElement.getLineNumber()).length()) + substring;
System.out.println(str2 + " " + str);
DebugHandle debugHandle = ourHandle;
if (debugHandle != null) {
debugHandle.message(str2 + " " + str);
}
}
}

View File

@ -0,0 +1,87 @@
package androidx.constraintlayout.core.motion.utils;
/* loaded from: classes.dex */
public class VelocityMatrix {
private static String TAG = "VelocityMatrix";
float mDRotate;
float mDScaleX;
float mDScaleY;
float mDTranslateX;
float mDTranslateY;
float mRotate;
public void clear() {
this.mDRotate = 0.0f;
this.mDTranslateY = 0.0f;
this.mDTranslateX = 0.0f;
this.mDScaleY = 0.0f;
this.mDScaleX = 0.0f;
}
public void setRotationVelocity(SplineSet splineSet, float f) {
if (splineSet != null) {
this.mDRotate = splineSet.getSlope(f);
this.mRotate = splineSet.get(f);
}
}
public void setTranslationVelocity(SplineSet splineSet, SplineSet splineSet2, float f) {
if (splineSet != null) {
this.mDTranslateX = splineSet.getSlope(f);
}
if (splineSet2 != null) {
this.mDTranslateY = splineSet2.getSlope(f);
}
}
public void setScaleVelocity(SplineSet splineSet, SplineSet splineSet2, float f) {
if (splineSet != null) {
this.mDScaleX = splineSet.getSlope(f);
}
if (splineSet2 != null) {
this.mDScaleY = splineSet2.getSlope(f);
}
}
public void setRotationVelocity(KeyCycleOscillator keyCycleOscillator, float f) {
if (keyCycleOscillator != null) {
this.mDRotate = keyCycleOscillator.getSlope(f);
}
}
public void setTranslationVelocity(KeyCycleOscillator keyCycleOscillator, KeyCycleOscillator keyCycleOscillator2, float f) {
if (keyCycleOscillator != null) {
this.mDTranslateX = keyCycleOscillator.getSlope(f);
}
if (keyCycleOscillator2 != null) {
this.mDTranslateY = keyCycleOscillator2.getSlope(f);
}
}
public void setScaleVelocity(KeyCycleOscillator keyCycleOscillator, KeyCycleOscillator keyCycleOscillator2, float f) {
if (keyCycleOscillator != null) {
this.mDScaleX = keyCycleOscillator.getSlope(f);
}
if (keyCycleOscillator2 != null) {
this.mDScaleY = keyCycleOscillator2.getSlope(f);
}
}
public void applyTransform(float f, float f2, int i, int i2, float[] fArr) {
float f3 = fArr[0];
float f4 = fArr[1];
float f5 = (f2 - 0.5f) * 2.0f;
float f6 = f3 + this.mDTranslateX;
float f7 = f4 + this.mDTranslateY;
float f8 = f6 + (this.mDScaleX * (f - 0.5f) * 2.0f);
float f9 = f7 + (this.mDScaleY * f5);
float radians = (float) Math.toRadians(this.mRotate);
float radians2 = (float) Math.toRadians(this.mDRotate);
double d = radians;
double d2 = i2 * f5;
float sin = f8 + (((float) ((((-i) * r7) * Math.sin(d)) - (Math.cos(d) * d2))) * radians2);
float cos = f9 + (radians2 * ((float) (((i * r7) * Math.cos(d)) - (d2 * Math.sin(d)))));
fArr[0] = sin;
fArr[1] = cos;
}
}

View File

@ -0,0 +1,28 @@
package androidx.constraintlayout.core.motion.utils;
import androidx.constraintlayout.core.motion.MotionWidget;
/* loaded from: classes.dex */
public class ViewState {
public int bottom;
public int left;
public int right;
public float rotation;
public int top;
public int height() {
return this.bottom - this.top;
}
public int width() {
return this.right - this.left;
}
public void getState(MotionWidget motionWidget) {
this.left = motionWidget.getLeft();
this.top = motionWidget.getTop();
this.right = motionWidget.getRight();
this.bottom = motionWidget.getBottom();
this.rotation = (int) motionWidget.getRotationZ();
}
}

View File

@ -0,0 +1,56 @@
package androidx.constraintlayout.core.parser;
import java.util.Iterator;
/* loaded from: classes.dex */
public class CLArray extends CLContainer {
public CLArray(char[] cArr) {
super(cArr);
}
public static CLElement allocate(char[] cArr) {
return new CLArray(cArr);
}
@Override // androidx.constraintlayout.core.parser.CLElement
protected String toJSON() {
StringBuilder sb = new StringBuilder(getDebugName() + "[");
boolean z = true;
for (int i = 0; i < this.mElements.size(); i++) {
if (z) {
z = false;
} else {
sb.append(", ");
}
sb.append(this.mElements.get(i).toJSON());
}
return ((Object) sb) + "]";
}
@Override // androidx.constraintlayout.core.parser.CLElement
protected String toFormattedJSON(int i, int i2) {
StringBuilder sb = new StringBuilder();
String json = toJSON();
if (i2 <= 0 && json.length() + i < MAX_LINE) {
sb.append(json);
} else {
sb.append("[\n");
Iterator<CLElement> it = this.mElements.iterator();
boolean z = true;
while (it.hasNext()) {
CLElement next = it.next();
if (z) {
z = false;
} else {
sb.append(",\n");
}
addIndent(sb, BASE_INDENT + i);
sb.append(next.toFormattedJSON(BASE_INDENT + i, i2 - 1));
}
sb.append("\n");
addIndent(sb, i);
sb.append("]");
}
return sb.toString();
}
}

View File

@ -0,0 +1,269 @@
package androidx.constraintlayout.core.parser;
import java.util.ArrayList;
import java.util.Iterator;
/* loaded from: classes.dex */
public class CLContainer extends CLElement {
ArrayList<CLElement> mElements;
public CLContainer(char[] cArr) {
super(cArr);
this.mElements = new ArrayList<>();
}
public static CLElement allocate(char[] cArr) {
return new CLContainer(cArr);
}
public void add(CLElement cLElement) {
this.mElements.add(cLElement);
if (CLParser.DEBUG) {
System.out.println("added element " + cLElement + " to " + this);
}
}
@Override // androidx.constraintlayout.core.parser.CLElement
public String toString() {
StringBuilder sb = new StringBuilder();
Iterator<CLElement> it = this.mElements.iterator();
while (it.hasNext()) {
CLElement next = it.next();
if (sb.length() > 0) {
sb.append("; ");
}
sb.append(next);
}
return super.toString() + " = <" + ((Object) sb) + " >";
}
public int size() {
return this.mElements.size();
}
public ArrayList<String> names() {
ArrayList<String> arrayList = new ArrayList<>();
Iterator<CLElement> it = this.mElements.iterator();
while (it.hasNext()) {
CLElement next = it.next();
if (next instanceof CLKey) {
arrayList.add(((CLKey) next).content());
}
}
return arrayList;
}
public boolean has(String str) {
Iterator<CLElement> it = this.mElements.iterator();
while (it.hasNext()) {
CLElement next = it.next();
if ((next instanceof CLKey) && ((CLKey) next).content().equals(str)) {
return true;
}
}
return false;
}
public void put(String str, CLElement cLElement) {
Iterator<CLElement> it = this.mElements.iterator();
while (it.hasNext()) {
CLKey cLKey = (CLKey) it.next();
if (cLKey.content().equals(str)) {
cLKey.set(cLElement);
return;
}
}
this.mElements.add((CLKey) CLKey.allocate(str, cLElement));
}
public void putNumber(String str, float f) {
put(str, new CLNumber(f));
}
public void remove(String str) {
ArrayList arrayList = new ArrayList();
Iterator<CLElement> it = this.mElements.iterator();
while (it.hasNext()) {
CLElement next = it.next();
if (((CLKey) next).content().equals(str)) {
arrayList.add(next);
}
}
Iterator it2 = arrayList.iterator();
while (it2.hasNext()) {
this.mElements.remove((CLElement) it2.next());
}
}
public CLElement get(String str) throws CLParsingException {
Iterator<CLElement> it = this.mElements.iterator();
while (it.hasNext()) {
CLKey cLKey = (CLKey) it.next();
if (cLKey.content().equals(str)) {
return cLKey.getValue();
}
}
throw new CLParsingException("no element for key <" + str + ">", this);
}
public int getInt(String str) throws CLParsingException {
CLElement cLElement = get(str);
if (cLElement != null) {
return cLElement.getInt();
}
throw new CLParsingException("no int found for key <" + str + ">, found [" + cLElement.getStrClass() + "] : " + cLElement, this);
}
public float getFloat(String str) throws CLParsingException {
CLElement cLElement = get(str);
if (cLElement != null) {
return cLElement.getFloat();
}
throw new CLParsingException("no float found for key <" + str + ">, found [" + cLElement.getStrClass() + "] : " + cLElement, this);
}
public CLArray getArray(String str) throws CLParsingException {
CLElement cLElement = get(str);
if (cLElement instanceof CLArray) {
return (CLArray) cLElement;
}
throw new CLParsingException("no array found for key <" + str + ">, found [" + cLElement.getStrClass() + "] : " + cLElement, this);
}
public CLObject getObject(String str) throws CLParsingException {
CLElement cLElement = get(str);
if (cLElement instanceof CLObject) {
return (CLObject) cLElement;
}
throw new CLParsingException("no object found for key <" + str + ">, found [" + cLElement.getStrClass() + "] : " + cLElement, this);
}
public String getString(String str) throws CLParsingException {
CLElement cLElement = get(str);
if (cLElement instanceof CLString) {
return cLElement.content();
}
throw new CLParsingException("no string found for key <" + str + ">, found [" + (cLElement != null ? cLElement.getStrClass() : null) + "] : " + cLElement, this);
}
public boolean getBoolean(String str) throws CLParsingException {
CLElement cLElement = get(str);
if (cLElement instanceof CLToken) {
return ((CLToken) cLElement).getBoolean();
}
throw new CLParsingException("no boolean found for key <" + str + ">, found [" + cLElement.getStrClass() + "] : " + cLElement, this);
}
public CLElement getOrNull(String str) {
Iterator<CLElement> it = this.mElements.iterator();
while (it.hasNext()) {
CLKey cLKey = (CLKey) it.next();
if (cLKey.content().equals(str)) {
return cLKey.getValue();
}
}
return null;
}
public CLObject getObjectOrNull(String str) {
CLElement orNull = getOrNull(str);
if (orNull instanceof CLObject) {
return (CLObject) orNull;
}
return null;
}
public CLArray getArrayOrNull(String str) {
CLElement orNull = getOrNull(str);
if (orNull instanceof CLArray) {
return (CLArray) orNull;
}
return null;
}
public String getStringOrNull(String str) {
CLElement orNull = getOrNull(str);
if (orNull instanceof CLString) {
return orNull.content();
}
return null;
}
public float getFloatOrNaN(String str) {
CLElement orNull = getOrNull(str);
if (orNull instanceof CLNumber) {
return orNull.getFloat();
}
return Float.NaN;
}
public CLElement get(int i) throws CLParsingException {
if (i >= 0 && i < this.mElements.size()) {
return this.mElements.get(i);
}
throw new CLParsingException("no element at index " + i, this);
}
public int getInt(int i) throws CLParsingException {
CLElement cLElement = get(i);
if (cLElement != null) {
return cLElement.getInt();
}
throw new CLParsingException("no int at index " + i, this);
}
public float getFloat(int i) throws CLParsingException {
CLElement cLElement = get(i);
if (cLElement != null) {
return cLElement.getFloat();
}
throw new CLParsingException("no float at index " + i, this);
}
public CLArray getArray(int i) throws CLParsingException {
CLElement cLElement = get(i);
if (cLElement instanceof CLArray) {
return (CLArray) cLElement;
}
throw new CLParsingException("no array at index " + i, this);
}
public CLObject getObject(int i) throws CLParsingException {
CLElement cLElement = get(i);
if (cLElement instanceof CLObject) {
return (CLObject) cLElement;
}
throw new CLParsingException("no object at index " + i, this);
}
public String getString(int i) throws CLParsingException {
CLElement cLElement = get(i);
if (cLElement instanceof CLString) {
return cLElement.content();
}
throw new CLParsingException("no string at index " + i, this);
}
public boolean getBoolean(int i) throws CLParsingException {
CLElement cLElement = get(i);
if (cLElement instanceof CLToken) {
return ((CLToken) cLElement).getBoolean();
}
throw new CLParsingException("no boolean at index " + i, this);
}
public CLElement getOrNull(int i) {
if (i < 0 || i >= this.mElements.size()) {
return null;
}
return this.mElements.get(i);
}
public String getStringOrNull(int i) {
CLElement orNull = getOrNull(i);
if (orNull instanceof CLString) {
return orNull.content();
}
return null;
}
}

View File

@ -0,0 +1,132 @@
package androidx.constraintlayout.core.parser;
/* loaded from: classes.dex */
public class CLElement {
protected static int BASE_INDENT = 2;
protected static int MAX_LINE = 80;
private int line;
protected CLContainer mContainer;
private final char[] mContent;
protected long start = -1;
protected long end = Long.MAX_VALUE;
public CLElement getContainer() {
return this.mContainer;
}
public long getEnd() {
return this.end;
}
public int getLine() {
return this.line;
}
public long getStart() {
return this.start;
}
public boolean isDone() {
return this.end != Long.MAX_VALUE;
}
public boolean isStarted() {
return this.start > -1;
}
public boolean notStarted() {
return this.start == -1;
}
public void setContainer(CLContainer cLContainer) {
this.mContainer = cLContainer;
}
public void setLine(int i) {
this.line = i;
}
public void setStart(long j) {
this.start = j;
}
protected String toFormattedJSON(int i, int i2) {
return "";
}
protected String toJSON() {
return "";
}
public CLElement(char[] cArr) {
this.mContent = cArr;
}
public void setEnd(long j) {
if (this.end != Long.MAX_VALUE) {
return;
}
this.end = j;
if (CLParser.DEBUG) {
System.out.println("closing " + hashCode() + " -> " + this);
}
CLContainer cLContainer = this.mContainer;
if (cLContainer != null) {
cLContainer.add(this);
}
}
protected void addIndent(StringBuilder sb, int i) {
for (int i2 = 0; i2 < i; i2++) {
sb.append(' ');
}
}
public String toString() {
long j = this.start;
long j2 = this.end;
if (j > j2 || j2 == Long.MAX_VALUE) {
return getClass() + " (INVALID, " + this.start + "-" + this.end + ")";
}
return getStrClass() + " (" + this.start + " : " + this.end + ") <<" + new String(this.mContent).substring((int) this.start, ((int) this.end) + 1) + ">>";
}
protected String getStrClass() {
String cls = getClass().toString();
return cls.substring(cls.lastIndexOf(46) + 1);
}
protected String getDebugName() {
if (!CLParser.DEBUG) {
return "";
}
return getStrClass() + " -> ";
}
public String content() {
String str = new String(this.mContent);
long j = this.end;
if (j != Long.MAX_VALUE) {
long j2 = this.start;
if (j >= j2) {
return str.substring((int) j2, ((int) j) + 1);
}
}
long j3 = this.start;
return str.substring((int) j3, ((int) j3) + 1);
}
public int getInt() {
if (this instanceof CLNumber) {
return ((CLNumber) this).getInt();
}
return 0;
}
public float getFloat() {
if (this instanceof CLNumber) {
return ((CLNumber) this).getFloat();
}
return Float.NaN;
}
}

View File

@ -0,0 +1,91 @@
package androidx.constraintlayout.core.parser;
import androidx.constraintlayout.core.motion.utils.TypedValues;
import java.util.ArrayList;
/* loaded from: classes.dex */
public class CLKey extends CLContainer {
private static ArrayList<String> sections;
static {
ArrayList<String> arrayList = new ArrayList<>();
sections = arrayList;
arrayList.add("ConstraintSets");
sections.add("Variables");
sections.add("Generate");
sections.add(TypedValues.TransitionType.NAME);
sections.add("KeyFrames");
sections.add(TypedValues.AttributesType.NAME);
sections.add("KeyPositions");
sections.add("KeyCycles");
}
public CLKey(char[] cArr) {
super(cArr);
}
public static CLElement allocate(char[] cArr) {
return new CLKey(cArr);
}
public static CLElement allocate(String str, CLElement cLElement) {
CLKey cLKey = new CLKey(str.toCharArray());
cLKey.setStart(0L);
cLKey.setEnd(str.length() - 1);
cLKey.set(cLElement);
return cLKey;
}
public String getName() {
return content();
}
@Override // androidx.constraintlayout.core.parser.CLElement
protected String toJSON() {
if (this.mElements.size() > 0) {
return getDebugName() + content() + ": " + this.mElements.get(0).toJSON();
}
return getDebugName() + content() + ": <> ";
}
@Override // androidx.constraintlayout.core.parser.CLElement
protected String toFormattedJSON(int i, int i2) {
StringBuilder sb = new StringBuilder(getDebugName());
addIndent(sb, i);
String content = content();
if (this.mElements.size() > 0) {
sb.append(content);
sb.append(": ");
if (sections.contains(content)) {
i2 = 3;
}
if (i2 > 0) {
sb.append(this.mElements.get(0).toFormattedJSON(i, i2 - 1));
} else {
String json = this.mElements.get(0).toJSON();
if (json.length() + i < MAX_LINE) {
sb.append(json);
} else {
sb.append(this.mElements.get(0).toFormattedJSON(i, i2 - 1));
}
}
return sb.toString();
}
return content + ": <> ";
}
public void set(CLElement cLElement) {
if (this.mElements.size() > 0) {
this.mElements.set(0, cLElement);
} else {
this.mElements.add(cLElement);
}
}
public CLElement getValue() {
if (this.mElements.size() > 0) {
return this.mElements.get(0);
}
return null;
}
}

View File

@ -0,0 +1,69 @@
package androidx.constraintlayout.core.parser;
/* loaded from: classes.dex */
public class CLNumber extends CLElement {
float value;
public void putValue(float f) {
this.value = f;
}
public CLNumber(char[] cArr) {
super(cArr);
this.value = Float.NaN;
}
public CLNumber(float f) {
super(null);
this.value = f;
}
public static CLElement allocate(char[] cArr) {
return new CLNumber(cArr);
}
@Override // androidx.constraintlayout.core.parser.CLElement
protected String toJSON() {
float f = getFloat();
int i = (int) f;
if (i == f) {
return "" + i;
}
return "" + f;
}
@Override // androidx.constraintlayout.core.parser.CLElement
protected String toFormattedJSON(int i, int i2) {
StringBuilder sb = new StringBuilder();
addIndent(sb, i);
float f = getFloat();
int i3 = (int) f;
if (i3 == f) {
sb.append(i3);
} else {
sb.append(f);
}
return sb.toString();
}
public boolean isInt() {
float f = getFloat();
return ((float) ((int) f)) == f;
}
@Override // androidx.constraintlayout.core.parser.CLElement
public int getInt() {
if (Float.isNaN(this.value)) {
this.value = Integer.parseInt(content());
}
return (int) this.value;
}
@Override // androidx.constraintlayout.core.parser.CLElement
public float getFloat() {
if (Float.isNaN(this.value)) {
this.value = Float.parseFloat(content());
}
return this.value;
}
}

View File

@ -0,0 +1,83 @@
package androidx.constraintlayout.core.parser;
import java.util.Iterator;
/* loaded from: classes.dex */
public class CLObject extends CLContainer implements Iterable<CLKey> {
public CLObject(char[] cArr) {
super(cArr);
}
public static CLObject allocate(char[] cArr) {
return new CLObject(cArr);
}
@Override // androidx.constraintlayout.core.parser.CLElement
public String toJSON() {
StringBuilder sb = new StringBuilder(getDebugName() + "{ ");
Iterator<CLElement> it = this.mElements.iterator();
boolean z = true;
while (it.hasNext()) {
CLElement next = it.next();
if (z) {
z = false;
} else {
sb.append(", ");
}
sb.append(next.toJSON());
}
sb.append(" }");
return sb.toString();
}
public String toFormattedJSON() {
return toFormattedJSON(0, 0);
}
@Override // androidx.constraintlayout.core.parser.CLElement
public String toFormattedJSON(int i, int i2) {
StringBuilder sb = new StringBuilder(getDebugName());
sb.append("{\n");
Iterator<CLElement> it = this.mElements.iterator();
boolean z = true;
while (it.hasNext()) {
CLElement next = it.next();
if (z) {
z = false;
} else {
sb.append(",\n");
}
sb.append(next.toFormattedJSON(BASE_INDENT + i, i2 - 1));
}
sb.append("\n");
addIndent(sb, i);
sb.append("}");
return sb.toString();
}
@Override // java.lang.Iterable
public Iterator<CLKey> iterator() {
return new CLObjectIterator(this);
}
private class CLObjectIterator implements Iterator {
int index = 0;
CLObject myObject;
public CLObjectIterator(CLObject cLObject) {
this.myObject = cLObject;
}
@Override // java.util.Iterator
public boolean hasNext() {
return this.index < this.myObject.size();
}
@Override // java.util.Iterator
public Object next() {
CLKey cLKey = (CLKey) this.myObject.mElements.get(this.index);
this.index++;
return cLKey;
}
}
}

View File

@ -0,0 +1,278 @@
package androidx.constraintlayout.core.parser;
/* loaded from: classes.dex */
public class CLParser {
static boolean DEBUG = false;
private boolean hasComment = false;
private int lineNumber;
private String mContent;
enum TYPE {
UNKNOWN,
OBJECT,
ARRAY,
NUMBER,
STRING,
KEY,
TOKEN
}
public static CLObject parse(String str) throws CLParsingException {
return new CLParser(str).parse();
}
public CLParser(String str) {
this.mContent = str;
}
public CLObject parse() throws CLParsingException {
char c;
char[] charArray = this.mContent.toCharArray();
int length = charArray.length;
int i = 1;
this.lineNumber = 1;
boolean z = false;
int i2 = 0;
while (true) {
if (i2 >= length) {
i2 = -1;
break;
}
char c2 = charArray[i2];
if (c2 == '{') {
break;
}
if (c2 == '\n') {
this.lineNumber++;
}
i2++;
}
if (i2 == -1) {
throw new CLParsingException("invalid json content", null);
}
CLObject allocate = CLObject.allocate(charArray);
allocate.setLine(this.lineNumber);
allocate.setStart(i2);
int i3 = i2 + 1;
CLElement cLElement = allocate;
while (i3 < length) {
char c3 = charArray[i3];
if (c3 == '\n') {
this.lineNumber += i;
}
if (this.hasComment) {
if (c3 == '\n') {
this.hasComment = z;
} else {
continue;
i3++;
i = 1;
z = false;
}
}
if (cLElement == null) {
break;
}
if (cLElement.isDone()) {
cLElement = getNextJsonElement(i3, c3, cLElement, charArray);
} else if (cLElement instanceof CLObject) {
if (c3 == '}') {
cLElement.setEnd(i3 - 1);
} else {
cLElement = getNextJsonElement(i3, c3, cLElement, charArray);
}
} else if (!(cLElement instanceof CLArray)) {
boolean z2 = cLElement instanceof CLString;
if (z2) {
if (charArray[(int) cLElement.start] == c3) {
cLElement.setStart(cLElement.start + 1);
cLElement.setEnd(i3 - 1);
}
} else {
if (cLElement instanceof CLToken) {
CLToken cLToken = (CLToken) cLElement;
if (!cLToken.validate(c3, i3)) {
throw new CLParsingException("parsing incorrect token " + cLToken.content() + " at line " + this.lineNumber, cLToken);
}
}
if (((cLElement instanceof CLKey) || z2) && (((c = charArray[(int) cLElement.start]) == '\'' || c == '\"') && c == c3)) {
cLElement.setStart(cLElement.start + 1);
cLElement.setEnd(i3 - 1);
}
if (!cLElement.isDone() && (c3 == '}' || c3 == ']' || c3 == ',' || c3 == ' ' || c3 == '\t' || c3 == '\r' || c3 == '\n' || c3 == ':')) {
long j = i3 - 1;
cLElement.setEnd(j);
if (c3 == '}' || c3 == ']') {
cLElement = cLElement.getContainer();
cLElement.setEnd(j);
if (cLElement instanceof CLKey) {
cLElement = cLElement.getContainer();
cLElement.setEnd(j);
}
}
}
}
} else if (c3 == ']') {
cLElement.setEnd(i3 - 1);
} else {
cLElement = getNextJsonElement(i3, c3, cLElement, charArray);
}
if (cLElement.isDone() && (!(cLElement instanceof CLKey) || ((CLKey) cLElement).mElements.size() > 0)) {
cLElement = cLElement.getContainer();
}
i3++;
i = 1;
z = false;
}
while (cLElement != null && !cLElement.isDone()) {
if (cLElement instanceof CLString) {
cLElement.setStart(((int) cLElement.start) + 1);
}
cLElement.setEnd(length - 1);
cLElement = cLElement.getContainer();
}
if (DEBUG) {
System.out.println("Root: " + allocate.toJSON());
}
return allocate;
}
private CLElement getNextJsonElement(int i, char c, CLElement cLElement, char[] cArr) throws CLParsingException {
if (c == '\t' || c == '\n' || c == '\r' || c == ' ') {
return cLElement;
}
if (c == '\"' || c == '\'') {
if (cLElement instanceof CLObject) {
return createElement(cLElement, i, TYPE.KEY, true, cArr);
}
return createElement(cLElement, i, TYPE.STRING, true, cArr);
}
if (c == '[') {
return createElement(cLElement, i, TYPE.ARRAY, true, cArr);
}
if (c != ']') {
if (c == '{') {
return createElement(cLElement, i, TYPE.OBJECT, true, cArr);
}
if (c != '}') {
switch (c) {
case '+':
case '-':
case '.':
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
return createElement(cLElement, i, TYPE.NUMBER, true, cArr);
case ',':
case ':':
return cLElement;
case '/':
int i2 = i + 1;
if (i2 >= cArr.length || cArr[i2] != '/') {
return cLElement;
}
this.hasComment = true;
return cLElement;
default:
if ((cLElement instanceof CLContainer) && !(cLElement instanceof CLObject)) {
CLElement createElement = createElement(cLElement, i, TYPE.TOKEN, true, cArr);
CLToken cLToken = (CLToken) createElement;
if (cLToken.validate(c, i)) {
return createElement;
}
throw new CLParsingException("incorrect token <" + c + "> at line " + this.lineNumber, cLToken);
}
return createElement(cLElement, i, TYPE.KEY, true, cArr);
}
}
}
cLElement.setEnd(i - 1);
CLElement container = cLElement.getContainer();
container.setEnd(i);
return container;
}
private CLElement createElement(CLElement cLElement, int i, TYPE type, boolean z, char[] cArr) {
CLElement allocate;
if (DEBUG) {
System.out.println("CREATE " + type + " at " + cArr[i]);
}
switch (AnonymousClass1.$SwitchMap$androidx$constraintlayout$core$parser$CLParser$TYPE[type.ordinal()]) {
case 1:
allocate = CLObject.allocate(cArr);
i++;
break;
case 2:
allocate = CLArray.allocate(cArr);
i++;
break;
case 3:
allocate = CLString.allocate(cArr);
break;
case 4:
allocate = CLNumber.allocate(cArr);
break;
case 5:
allocate = CLKey.allocate(cArr);
break;
case 6:
allocate = CLToken.allocate(cArr);
break;
default:
allocate = null;
break;
}
if (allocate == null) {
return null;
}
allocate.setLine(this.lineNumber);
if (z) {
allocate.setStart(i);
}
if (cLElement instanceof CLContainer) {
allocate.setContainer((CLContainer) cLElement);
}
return allocate;
}
/* renamed from: androidx.constraintlayout.core.parser.CLParser$1, reason: invalid class name */
static /* synthetic */ class AnonymousClass1 {
static final /* synthetic */ int[] $SwitchMap$androidx$constraintlayout$core$parser$CLParser$TYPE;
static {
int[] iArr = new int[TYPE.values().length];
$SwitchMap$androidx$constraintlayout$core$parser$CLParser$TYPE = iArr;
try {
iArr[TYPE.OBJECT.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
$SwitchMap$androidx$constraintlayout$core$parser$CLParser$TYPE[TYPE.ARRAY.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
$SwitchMap$androidx$constraintlayout$core$parser$CLParser$TYPE[TYPE.STRING.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
$SwitchMap$androidx$constraintlayout$core$parser$CLParser$TYPE[TYPE.NUMBER.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
try {
$SwitchMap$androidx$constraintlayout$core$parser$CLParser$TYPE[TYPE.KEY.ordinal()] = 5;
} catch (NoSuchFieldError unused5) {
}
try {
$SwitchMap$androidx$constraintlayout$core$parser$CLParser$TYPE[TYPE.TOKEN.ordinal()] = 6;
} catch (NoSuchFieldError unused6) {
}
}
}
}

View File

@ -0,0 +1,30 @@
package androidx.constraintlayout.core.parser;
import androidx.core.os.EnvironmentCompat;
/* loaded from: classes.dex */
public class CLParsingException extends Exception {
private final String mElementClass;
private final int mLineNumber;
private final String mReason;
public CLParsingException(String str, CLElement cLElement) {
this.mReason = str;
if (cLElement != null) {
this.mElementClass = cLElement.getStrClass();
this.mLineNumber = cLElement.getLine();
} else {
this.mElementClass = EnvironmentCompat.MEDIA_UNKNOWN;
this.mLineNumber = 0;
}
}
public String reason() {
return this.mReason + " (" + this.mElementClass + " at line " + this.mLineNumber + ")";
}
@Override // java.lang.Throwable
public String toString() {
return "CLParsingException (" + hashCode() + ") : " + reason();
}
}

View File

@ -0,0 +1,27 @@
package androidx.constraintlayout.core.parser;
/* loaded from: classes.dex */
public class CLString extends CLElement {
public CLString(char[] cArr) {
super(cArr);
}
public static CLElement allocate(char[] cArr) {
return new CLString(cArr);
}
@Override // androidx.constraintlayout.core.parser.CLElement
protected String toJSON() {
return "'" + content() + "'";
}
@Override // androidx.constraintlayout.core.parser.CLElement
protected String toFormattedJSON(int i, int i2) {
StringBuilder sb = new StringBuilder();
addIndent(sb, i);
sb.append("'");
sb.append(content());
sb.append("'");
return sb.toString();
}
}

View File

@ -0,0 +1,132 @@
package androidx.constraintlayout.core.parser;
/* loaded from: classes.dex */
public class CLToken extends CLElement {
int index;
char[] tokenFalse;
char[] tokenNull;
char[] tokenTrue;
Type type;
enum Type {
UNKNOWN,
TRUE,
FALSE,
NULL
}
public Type getType() {
return this.type;
}
public boolean getBoolean() throws CLParsingException {
if (this.type == Type.TRUE) {
return true;
}
if (this.type == Type.FALSE) {
return false;
}
throw new CLParsingException("this token is not a boolean: <" + content() + ">", this);
}
public boolean isNull() throws CLParsingException {
if (this.type == Type.NULL) {
return true;
}
throw new CLParsingException("this token is not a null: <" + content() + ">", this);
}
public CLToken(char[] cArr) {
super(cArr);
this.index = 0;
this.type = Type.UNKNOWN;
this.tokenTrue = "true".toCharArray();
this.tokenFalse = "false".toCharArray();
this.tokenNull = "null".toCharArray();
}
public static CLElement allocate(char[] cArr) {
return new CLToken(cArr);
}
@Override // androidx.constraintlayout.core.parser.CLElement
protected String toJSON() {
if (CLParser.DEBUG) {
return "<" + content() + ">";
}
return content();
}
@Override // androidx.constraintlayout.core.parser.CLElement
protected String toFormattedJSON(int i, int i2) {
StringBuilder sb = new StringBuilder();
addIndent(sb, i);
sb.append(content());
return sb.toString();
}
/* renamed from: androidx.constraintlayout.core.parser.CLToken$1, reason: invalid class name */
static /* synthetic */ class AnonymousClass1 {
static final /* synthetic */ int[] $SwitchMap$androidx$constraintlayout$core$parser$CLToken$Type;
static {
int[] iArr = new int[Type.values().length];
$SwitchMap$androidx$constraintlayout$core$parser$CLToken$Type = iArr;
try {
iArr[Type.TRUE.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
$SwitchMap$androidx$constraintlayout$core$parser$CLToken$Type[Type.FALSE.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
$SwitchMap$androidx$constraintlayout$core$parser$CLToken$Type[Type.NULL.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
$SwitchMap$androidx$constraintlayout$core$parser$CLToken$Type[Type.UNKNOWN.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
}
}
public boolean validate(char c, long j) {
int i = AnonymousClass1.$SwitchMap$androidx$constraintlayout$core$parser$CLToken$Type[this.type.ordinal()];
if (i == 1) {
char[] cArr = this.tokenTrue;
int i2 = this.index;
r2 = cArr[i2] == c;
if (r2 && i2 + 1 == cArr.length) {
setEnd(j);
}
} else if (i == 2) {
char[] cArr2 = this.tokenFalse;
int i3 = this.index;
r2 = cArr2[i3] == c;
if (r2 && i3 + 1 == cArr2.length) {
setEnd(j);
}
} else if (i == 3) {
char[] cArr3 = this.tokenNull;
int i4 = this.index;
r2 = cArr3[i4] == c;
if (r2 && i4 + 1 == cArr3.length) {
setEnd(j);
}
} else if (i == 4) {
char[] cArr4 = this.tokenTrue;
int i5 = this.index;
if (cArr4[i5] == c) {
this.type = Type.TRUE;
} else if (this.tokenFalse[i5] == c) {
this.type = Type.FALSE;
} else if (this.tokenNull[i5] == c) {
this.type = Type.NULL;
}
r2 = true;
}
this.index++;
return r2;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,256 @@
package androidx.constraintlayout.core.state;
import androidx.constraintlayout.core.widgets.ConstraintWidget;
/* loaded from: classes.dex */
public class Dimension {
private final int WRAP_CONTENT;
Object mInitialValue;
boolean mIsSuggested;
int mMax;
int mMin;
float mPercent;
String mRatioString;
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();
public static final Object RATIO_DIMENSION = new Object();
public enum Type {
FIXED,
WRAP,
MATCH_PARENT,
MATCH_CONSTRAINT
}
public boolean equalsFixedValue(int i) {
return this.mInitialValue == null && this.mValue == i;
}
public Dimension fixed(int i) {
this.mInitialValue = null;
this.mValue = i;
return this;
}
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(String str) {
this.mRatioString = str;
return this;
}
void setValue(int i) {
this.mIsSuggested = false;
this.mInitialValue = null;
this.mValue = i;
}
public Dimension suggested(int i) {
this.mIsSuggested = true;
if (i >= 0) {
this.mMax = i;
}
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.mRatioString = null;
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.mRatioString = null;
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 static Dimension Ratio(String str) {
Dimension dimension = new Dimension(RATIO_DIMENSION);
dimension.ratio(str);
return 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) {
String str = this.mRatioString;
if (str != null) {
constraintWidget.setDimensionRatio(str);
}
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);
}
}
}

View File

@ -0,0 +1,49 @@
package androidx.constraintlayout.core.state;
import androidx.constraintlayout.core.state.State;
import androidx.constraintlayout.core.state.helpers.Facade;
import androidx.constraintlayout.core.widgets.ConstraintWidget;
import androidx.constraintlayout.core.widgets.HelperWidget;
import java.util.ArrayList;
import java.util.Collections;
/* loaded from: classes.dex */
public class HelperReference extends ConstraintReference implements Facade {
private HelperWidget mHelperWidget;
protected ArrayList<Object> mReferences;
protected final State mState;
final State.Helper mType;
@Override // androidx.constraintlayout.core.state.ConstraintReference, androidx.constraintlayout.core.state.Reference
public void apply() {
}
public HelperWidget getHelperWidget() {
return this.mHelperWidget;
}
public State.Helper getType() {
return this.mType;
}
public void setHelperWidget(HelperWidget helperWidget) {
this.mHelperWidget = helperWidget;
}
public HelperReference(State state, State.Helper helper) {
super(state);
this.mReferences = new ArrayList<>();
this.mState = state;
this.mType = helper;
}
public HelperReference add(Object... objArr) {
Collections.addAll(this.mReferences, objArr);
return this;
}
@Override // androidx.constraintlayout.core.state.ConstraintReference, androidx.constraintlayout.core.state.Reference
public ConstraintWidget getConstraintWidget() {
return getHelperWidget();
}
}

View File

@ -0,0 +1,6 @@
package androidx.constraintlayout.core.state;
/* loaded from: classes.dex */
public interface Interpolator {
float getInterpolation(float f);
}

View File

@ -0,0 +1,19 @@
package androidx.constraintlayout.core.state;
import androidx.constraintlayout.core.state.helpers.Facade;
import androidx.constraintlayout.core.widgets.ConstraintWidget;
/* loaded from: classes.dex */
public interface Reference {
void apply();
ConstraintWidget getConstraintWidget();
Facade getFacade();
Object getKey();
void setConstraintWidget(ConstraintWidget constraintWidget);
void setKey(Object obj);
}

View File

@ -0,0 +1,85 @@
package androidx.constraintlayout.core.state;
import java.util.HashMap;
import java.util.Set;
/* loaded from: classes.dex */
public class Registry {
private static final Registry sRegistry = new Registry();
private HashMap<String, RegistryCallback> mCallbacks = new HashMap<>();
public static Registry getInstance() {
return sRegistry;
}
public void register(String str, RegistryCallback registryCallback) {
this.mCallbacks.put(str, registryCallback);
}
public void unregister(String str, RegistryCallback registryCallback) {
this.mCallbacks.remove(str);
}
public void updateContent(String str, String str2) {
RegistryCallback registryCallback = this.mCallbacks.get(str);
if (registryCallback != null) {
registryCallback.onNewMotionScene(str2);
}
}
public void updateProgress(String str, float f) {
RegistryCallback registryCallback = this.mCallbacks.get(str);
if (registryCallback != null) {
registryCallback.onProgress(f);
}
}
public String currentContent(String str) {
RegistryCallback registryCallback = this.mCallbacks.get(str);
if (registryCallback != null) {
return registryCallback.currentMotionScene();
}
return null;
}
public String currentLayoutInformation(String str) {
RegistryCallback registryCallback = this.mCallbacks.get(str);
if (registryCallback != null) {
return registryCallback.currentLayoutInformation();
}
return null;
}
public void setDrawDebug(String str, int i) {
RegistryCallback registryCallback = this.mCallbacks.get(str);
if (registryCallback != null) {
registryCallback.setDrawDebug(i);
}
}
public void setLayoutInformationMode(String str, int i) {
RegistryCallback registryCallback = this.mCallbacks.get(str);
if (registryCallback != null) {
registryCallback.setLayoutInformationMode(i);
}
}
public Set<String> getLayoutList() {
return this.mCallbacks.keySet();
}
public long getLastModified(String str) {
RegistryCallback registryCallback = this.mCallbacks.get(str);
if (registryCallback != null) {
return registryCallback.getLastModified();
}
return Long.MAX_VALUE;
}
public void updateDimensions(String str, int i, int i2) {
RegistryCallback registryCallback = this.mCallbacks.get(str);
if (registryCallback != null) {
registryCallback.onDimensions(i, i2);
}
}
}

View File

@ -0,0 +1,20 @@
package androidx.constraintlayout.core.state;
/* loaded from: classes.dex */
public interface RegistryCallback {
String currentLayoutInformation();
String currentMotionScene();
long getLastModified();
void onDimensions(int i, int i2);
void onNewMotionScene(String str);
void onProgress(float f);
void setDrawDebug(int i);
void setLayoutInformationMode(int i);
}

View File

@ -0,0 +1,395 @@
package androidx.constraintlayout.core.state;
import androidx.constraintlayout.core.state.helpers.AlignHorizontallyReference;
import androidx.constraintlayout.core.state.helpers.AlignVerticallyReference;
import androidx.constraintlayout.core.state.helpers.BarrierReference;
import androidx.constraintlayout.core.state.helpers.GuidelineReference;
import androidx.constraintlayout.core.state.helpers.HorizontalChainReference;
import androidx.constraintlayout.core.state.helpers.VerticalChainReference;
import androidx.constraintlayout.core.widgets.ConstraintWidget;
import androidx.constraintlayout.core.widgets.ConstraintWidgetContainer;
import androidx.constraintlayout.core.widgets.HelperWidget;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
/* loaded from: classes.dex */
public class State {
static final int CONSTRAINT_RATIO = 2;
static final int CONSTRAINT_SPREAD = 0;
static final int CONSTRAINT_WRAP = 1;
public static final Integer PARENT = 0;
static final int UNKNOWN = -1;
public final ConstraintReference mParent;
private int numHelpers;
protected HashMap<Object, Reference> mReferences = new HashMap<>();
protected HashMap<Object, HelperReference> mHelperReferences = new HashMap<>();
HashMap<String, ArrayList<String>> mTags = new HashMap<>();
public enum Chain {
SPREAD,
SPREAD_INSIDE,
PACKED
}
public enum Constraint {
LEFT_TO_LEFT,
LEFT_TO_RIGHT,
RIGHT_TO_LEFT,
RIGHT_TO_RIGHT,
START_TO_START,
START_TO_END,
END_TO_START,
END_TO_END,
TOP_TO_TOP,
TOP_TO_BOTTOM,
BOTTOM_TO_TOP,
BOTTOM_TO_BOTTOM,
BASELINE_TO_BASELINE,
BASELINE_TO_TOP,
BASELINE_TO_BOTTOM,
CENTER_HORIZONTALLY,
CENTER_VERTICALLY,
CIRCULAR_CONSTRAINT
}
public enum Direction {
LEFT,
RIGHT,
START,
END,
TOP,
BOTTOM
}
public enum Helper {
HORIZONTAL_CHAIN,
VERTICAL_CHAIN,
ALIGN_HORIZONTALLY,
ALIGN_VERTICALLY,
BARRIER,
LAYER,
FLOW
}
public State() {
ConstraintReference constraintReference = new ConstraintReference(this);
this.mParent = constraintReference;
this.numHelpers = 0;
this.mReferences.put(PARENT, constraintReference);
}
public void reset() {
this.mHelperReferences.clear();
this.mTags.clear();
}
public int convertDimension(Object obj) {
if (obj instanceof Float) {
return ((Float) obj).intValue();
}
if (obj instanceof Integer) {
return ((Integer) obj).intValue();
}
return 0;
}
public ConstraintReference createConstraintReference(Object obj) {
return new ConstraintReference(this);
}
public boolean sameFixedWidth(int i) {
return this.mParent.getWidth().equalsFixedValue(i);
}
public boolean sameFixedHeight(int i) {
return this.mParent.getHeight().equalsFixedValue(i);
}
public State width(Dimension dimension) {
return setWidth(dimension);
}
public State height(Dimension dimension) {
return setHeight(dimension);
}
public State setWidth(Dimension dimension) {
this.mParent.setWidth(dimension);
return this;
}
public State setHeight(Dimension dimension) {
this.mParent.setHeight(dimension);
return this;
}
Reference reference(Object obj) {
return this.mReferences.get(obj);
}
public ConstraintReference constraints(Object obj) {
Reference reference = this.mReferences.get(obj);
if (reference == null) {
reference = createConstraintReference(obj);
this.mReferences.put(obj, reference);
reference.setKey(obj);
}
if (reference instanceof ConstraintReference) {
return (ConstraintReference) reference;
}
return null;
}
private String createHelperKey() {
StringBuilder sb = new StringBuilder("__HELPER_KEY_");
int i = this.numHelpers;
this.numHelpers = i + 1;
sb.append(i);
sb.append("__");
return sb.toString();
}
public HelperReference helper(Object obj, Helper helper) {
HelperReference horizontalChainReference;
if (obj == null) {
obj = createHelperKey();
}
HelperReference helperReference = this.mHelperReferences.get(obj);
if (helperReference == null) {
int i = AnonymousClass1.$SwitchMap$androidx$constraintlayout$core$state$State$Helper[helper.ordinal()];
if (i == 1) {
horizontalChainReference = new HorizontalChainReference(this);
} else if (i == 2) {
horizontalChainReference = new VerticalChainReference(this);
} else if (i == 3) {
horizontalChainReference = new AlignHorizontallyReference(this);
} else if (i == 4) {
horizontalChainReference = new AlignVerticallyReference(this);
} else if (i == 5) {
horizontalChainReference = new BarrierReference(this);
} else {
helperReference = new HelperReference(this, helper);
helperReference.setKey(obj);
this.mHelperReferences.put(obj, helperReference);
}
helperReference = horizontalChainReference;
helperReference.setKey(obj);
this.mHelperReferences.put(obj, helperReference);
}
return helperReference;
}
/* renamed from: androidx.constraintlayout.core.state.State$1, reason: invalid class name */
static /* synthetic */ class AnonymousClass1 {
static final /* synthetic */ int[] $SwitchMap$androidx$constraintlayout$core$state$State$Helper;
static {
int[] iArr = new int[Helper.values().length];
$SwitchMap$androidx$constraintlayout$core$state$State$Helper = iArr;
try {
iArr[Helper.HORIZONTAL_CHAIN.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
$SwitchMap$androidx$constraintlayout$core$state$State$Helper[Helper.VERTICAL_CHAIN.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
$SwitchMap$androidx$constraintlayout$core$state$State$Helper[Helper.ALIGN_HORIZONTALLY.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
$SwitchMap$androidx$constraintlayout$core$state$State$Helper[Helper.ALIGN_VERTICALLY.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
try {
$SwitchMap$androidx$constraintlayout$core$state$State$Helper[Helper.BARRIER.ordinal()] = 5;
} catch (NoSuchFieldError unused5) {
}
}
}
public GuidelineReference horizontalGuideline(Object obj) {
return guideline(obj, 0);
}
public GuidelineReference verticalGuideline(Object obj) {
return guideline(obj, 1);
}
public GuidelineReference guideline(Object obj, int i) {
ConstraintReference constraints = constraints(obj);
if (constraints.getFacade() == null || !(constraints.getFacade() instanceof GuidelineReference)) {
GuidelineReference guidelineReference = new GuidelineReference(this);
guidelineReference.setOrientation(i);
guidelineReference.setKey(obj);
constraints.setFacade(guidelineReference);
}
return (GuidelineReference) constraints.getFacade();
}
public BarrierReference barrier(Object obj, Direction direction) {
ConstraintReference constraints = constraints(obj);
if (constraints.getFacade() == null || !(constraints.getFacade() instanceof BarrierReference)) {
BarrierReference barrierReference = new BarrierReference(this);
barrierReference.setBarrierDirection(direction);
constraints.setFacade(barrierReference);
}
return (BarrierReference) constraints.getFacade();
}
public VerticalChainReference verticalChain() {
return (VerticalChainReference) helper(null, Helper.VERTICAL_CHAIN);
}
public VerticalChainReference verticalChain(Object... objArr) {
VerticalChainReference verticalChainReference = (VerticalChainReference) helper(null, Helper.VERTICAL_CHAIN);
verticalChainReference.add(objArr);
return verticalChainReference;
}
public HorizontalChainReference horizontalChain() {
return (HorizontalChainReference) helper(null, Helper.HORIZONTAL_CHAIN);
}
public HorizontalChainReference horizontalChain(Object... objArr) {
HorizontalChainReference horizontalChainReference = (HorizontalChainReference) helper(null, Helper.HORIZONTAL_CHAIN);
horizontalChainReference.add(objArr);
return horizontalChainReference;
}
public AlignHorizontallyReference centerHorizontally(Object... objArr) {
AlignHorizontallyReference alignHorizontallyReference = (AlignHorizontallyReference) helper(null, Helper.ALIGN_HORIZONTALLY);
alignHorizontallyReference.add(objArr);
return alignHorizontallyReference;
}
public AlignVerticallyReference centerVertically(Object... objArr) {
AlignVerticallyReference alignVerticallyReference = (AlignVerticallyReference) helper(null, Helper.ALIGN_VERTICALLY);
alignVerticallyReference.add(objArr);
return alignVerticallyReference;
}
public void directMapping() {
for (Object obj : this.mReferences.keySet()) {
ConstraintReference constraints = constraints(obj);
if (constraints instanceof ConstraintReference) {
constraints.setView(obj);
}
}
}
public void map(Object obj, Object obj2) {
ConstraintReference constraints = constraints(obj);
if (constraints instanceof ConstraintReference) {
constraints.setView(obj2);
}
}
public void setTag(String str, String str2) {
ArrayList<String> arrayList;
ConstraintReference constraints = constraints(str);
if (constraints instanceof ConstraintReference) {
constraints.setTag(str2);
if (!this.mTags.containsKey(str2)) {
arrayList = new ArrayList<>();
this.mTags.put(str2, arrayList);
} else {
arrayList = this.mTags.get(str2);
}
arrayList.add(str);
}
}
public ArrayList<String> getIdsForTag(String str) {
if (this.mTags.containsKey(str)) {
return this.mTags.get(str);
}
return null;
}
public void apply(ConstraintWidgetContainer constraintWidgetContainer) {
HelperReference helperReference;
HelperWidget helperWidget;
HelperWidget helperWidget2;
constraintWidgetContainer.removeAllChildren();
this.mParent.getWidth().apply(this, constraintWidgetContainer, 0);
this.mParent.getHeight().apply(this, constraintWidgetContainer, 1);
for (Object obj : this.mHelperReferences.keySet()) {
HelperWidget helperWidget3 = this.mHelperReferences.get(obj).getHelperWidget();
if (helperWidget3 != null) {
Reference reference = this.mReferences.get(obj);
if (reference == null) {
reference = constraints(obj);
}
reference.setConstraintWidget(helperWidget3);
}
}
for (Object obj2 : this.mReferences.keySet()) {
Reference reference2 = this.mReferences.get(obj2);
if (reference2 != this.mParent && (reference2.getFacade() instanceof HelperReference) && (helperWidget2 = ((HelperReference) reference2.getFacade()).getHelperWidget()) != null) {
Reference reference3 = this.mReferences.get(obj2);
if (reference3 == null) {
reference3 = constraints(obj2);
}
reference3.setConstraintWidget(helperWidget2);
}
}
Iterator<Object> it = this.mReferences.keySet().iterator();
while (it.hasNext()) {
Reference reference4 = this.mReferences.get(it.next());
if (reference4 != this.mParent) {
ConstraintWidget constraintWidget = reference4.getConstraintWidget();
constraintWidget.setDebugName(reference4.getKey().toString());
constraintWidget.setParent(null);
if (reference4.getFacade() instanceof GuidelineReference) {
reference4.apply();
}
constraintWidgetContainer.add(constraintWidget);
} else {
reference4.setConstraintWidget(constraintWidgetContainer);
}
}
Iterator<Object> it2 = this.mHelperReferences.keySet().iterator();
while (it2.hasNext()) {
HelperReference helperReference2 = this.mHelperReferences.get(it2.next());
if (helperReference2.getHelperWidget() != null) {
Iterator<Object> it3 = helperReference2.mReferences.iterator();
while (it3.hasNext()) {
helperReference2.getHelperWidget().add(this.mReferences.get(it3.next()).getConstraintWidget());
}
helperReference2.apply();
} else {
helperReference2.apply();
}
}
Iterator<Object> it4 = this.mReferences.keySet().iterator();
while (it4.hasNext()) {
Reference reference5 = this.mReferences.get(it4.next());
if (reference5 != this.mParent && (reference5.getFacade() instanceof HelperReference) && (helperWidget = (helperReference = (HelperReference) reference5.getFacade()).getHelperWidget()) != null) {
Iterator<Object> it5 = helperReference.mReferences.iterator();
while (it5.hasNext()) {
Object next = it5.next();
Reference reference6 = this.mReferences.get(next);
if (reference6 != null) {
helperWidget.add(reference6.getConstraintWidget());
} else if (next instanceof Reference) {
helperWidget.add(((Reference) next).getConstraintWidget());
} else {
System.out.println("couldn't find reference for " + next);
}
}
reference5.apply();
}
}
for (Object obj3 : this.mReferences.keySet()) {
Reference reference7 = this.mReferences.get(obj3);
reference7.apply();
ConstraintWidget constraintWidget2 = reference7.getConstraintWidget();
if (constraintWidget2 != null && obj3 != null) {
constraintWidget2.stringId = obj3.toString();
}
}
}
}

View File

@ -0,0 +1,449 @@
package androidx.constraintlayout.core.state;
import androidx.constraintlayout.core.motion.Motion;
import androidx.constraintlayout.core.motion.MotionWidget;
import androidx.constraintlayout.core.motion.key.MotionKeyAttributes;
import androidx.constraintlayout.core.motion.key.MotionKeyCycle;
import androidx.constraintlayout.core.motion.key.MotionKeyPosition;
import androidx.constraintlayout.core.motion.utils.Easing;
import androidx.constraintlayout.core.motion.utils.KeyCache;
import androidx.constraintlayout.core.motion.utils.TypedBundle;
import androidx.constraintlayout.core.motion.utils.TypedValues;
import androidx.constraintlayout.core.widgets.ConstraintWidget;
import androidx.constraintlayout.core.widgets.ConstraintWidgetContainer;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
/* loaded from: classes.dex */
public class Transition implements TypedValues {
static final int ANTICIPATE = 6;
static final int BOUNCE = 4;
static final int EASE_IN = 1;
static final int EASE_IN_OUT = 0;
static final int EASE_OUT = 2;
public static final int END = 1;
public static final int INTERPOLATED = 2;
private static final int INTERPOLATOR_REFERENCE_ID = -2;
static final int LINEAR = 3;
static final int OVERSHOOT = 5;
private static final int SPLINE_STRING = -1;
public static final int START = 0;
HashMap<Integer, HashMap<String, KeyPosition>> keyPositions = new HashMap<>();
private HashMap<String, WidgetState> state = new HashMap<>();
TypedBundle mBundle = new TypedBundle();
private int mDefaultInterpolator = 0;
private String mDefaultInterpolatorString = null;
private Easing mEasing = null;
private int mAutoTransition = 0;
private int mDuration = 400;
private float mStagger = 0.0f;
public int getAutoTransition() {
return this.mAutoTransition;
}
@Override // androidx.constraintlayout.core.motion.utils.TypedValues
public int getId(String str) {
return 0;
}
@Override // androidx.constraintlayout.core.motion.utils.TypedValues
public boolean setValue(int i, float f) {
if (i != 706) {
return false;
}
this.mStagger = f;
return false;
}
@Override // androidx.constraintlayout.core.motion.utils.TypedValues
public boolean setValue(int i, int i2) {
return false;
}
@Override // androidx.constraintlayout.core.motion.utils.TypedValues
public boolean setValue(int i, boolean z) {
return false;
}
static /* synthetic */ float lambda$getInterpolator$0(String str, float f) {
return (float) Easing.getInterpolator(str).get(f);
}
static /* synthetic */ float lambda$getInterpolator$1(float f) {
return (float) Easing.getInterpolator("standard").get(f);
}
static /* synthetic */ float lambda$getInterpolator$2(float f) {
return (float) Easing.getInterpolator("accelerate").get(f);
}
static /* synthetic */ float lambda$getInterpolator$3(float f) {
return (float) Easing.getInterpolator("decelerate").get(f);
}
static /* synthetic */ float lambda$getInterpolator$4(float f) {
return (float) Easing.getInterpolator("linear").get(f);
}
public static Interpolator getInterpolator(int i, final String str) {
switch (i) {
case -1:
return new Interpolator() { // from class: androidx.constraintlayout.core.state.Transition$$ExternalSyntheticLambda0
@Override // androidx.constraintlayout.core.state.Interpolator
public final float getInterpolation(float f) {
return Transition.lambda$getInterpolator$0(str, f);
}
};
case 0:
return new Interpolator() { // from class: androidx.constraintlayout.core.state.Transition$$ExternalSyntheticLambda1
@Override // androidx.constraintlayout.core.state.Interpolator
public final float getInterpolation(float f) {
return Transition.lambda$getInterpolator$1(f);
}
};
case 1:
return new Interpolator() { // from class: androidx.constraintlayout.core.state.Transition$$ExternalSyntheticLambda2
@Override // androidx.constraintlayout.core.state.Interpolator
public final float getInterpolation(float f) {
return Transition.lambda$getInterpolator$2(f);
}
};
case 2:
return new Interpolator() { // from class: androidx.constraintlayout.core.state.Transition$$ExternalSyntheticLambda3
@Override // androidx.constraintlayout.core.state.Interpolator
public final float getInterpolation(float f) {
return Transition.lambda$getInterpolator$3(f);
}
};
case 3:
return new Interpolator() { // from class: androidx.constraintlayout.core.state.Transition$$ExternalSyntheticLambda4
@Override // androidx.constraintlayout.core.state.Interpolator
public final float getInterpolation(float f) {
return Transition.lambda$getInterpolator$4(f);
}
};
case 4:
return new Interpolator() { // from class: androidx.constraintlayout.core.state.Transition$$ExternalSyntheticLambda7
@Override // androidx.constraintlayout.core.state.Interpolator
public final float getInterpolation(float f) {
return Transition.lambda$getInterpolator$7(f);
}
};
case 5:
return new Interpolator() { // from class: androidx.constraintlayout.core.state.Transition$$ExternalSyntheticLambda6
@Override // androidx.constraintlayout.core.state.Interpolator
public final float getInterpolation(float f) {
return Transition.lambda$getInterpolator$6(f);
}
};
case 6:
return new Interpolator() { // from class: androidx.constraintlayout.core.state.Transition$$ExternalSyntheticLambda5
@Override // androidx.constraintlayout.core.state.Interpolator
public final float getInterpolation(float f) {
return Transition.lambda$getInterpolator$5(f);
}
};
default:
return null;
}
}
static /* synthetic */ float lambda$getInterpolator$5(float f) {
return (float) Easing.getInterpolator("anticipate").get(f);
}
static /* synthetic */ float lambda$getInterpolator$6(float f) {
return (float) Easing.getInterpolator("overshoot").get(f);
}
static /* synthetic */ float lambda$getInterpolator$7(float f) {
return (float) Easing.getInterpolator("spline(0.0, 0.2, 0.4, 0.6, 0.8 ,1.0, 0.8, 1.0, 0.9, 1.0)").get(f);
}
public KeyPosition findPreviousPosition(String str, int i) {
KeyPosition keyPosition;
while (i >= 0) {
HashMap<String, KeyPosition> hashMap = this.keyPositions.get(Integer.valueOf(i));
if (hashMap != null && (keyPosition = hashMap.get(str)) != null) {
return keyPosition;
}
i--;
}
return null;
}
public KeyPosition findNextPosition(String str, int i) {
KeyPosition keyPosition;
while (i <= 100) {
HashMap<String, KeyPosition> hashMap = this.keyPositions.get(Integer.valueOf(i));
if (hashMap != null && (keyPosition = hashMap.get(str)) != null) {
return keyPosition;
}
i++;
}
return null;
}
public int getNumberKeyPositions(WidgetFrame widgetFrame) {
int i = 0;
for (int i2 = 0; i2 <= 100; i2++) {
HashMap<String, KeyPosition> hashMap = this.keyPositions.get(Integer.valueOf(i2));
if (hashMap != null && hashMap.get(widgetFrame.widget.stringId) != null) {
i++;
}
}
return i;
}
public Motion getMotion(String str) {
return getWidgetState(str, null, 0).motionControl;
}
public void fillKeyPositions(WidgetFrame widgetFrame, float[] fArr, float[] fArr2, float[] fArr3) {
KeyPosition keyPosition;
int i = 0;
for (int i2 = 0; i2 <= 100; i2++) {
HashMap<String, KeyPosition> hashMap = this.keyPositions.get(Integer.valueOf(i2));
if (hashMap != null && (keyPosition = hashMap.get(widgetFrame.widget.stringId)) != null) {
fArr[i] = keyPosition.x;
fArr2[i] = keyPosition.y;
fArr3[i] = keyPosition.frame;
i++;
}
}
}
public boolean hasPositionKeyframes() {
return this.keyPositions.size() > 0;
}
public void setTransitionProperties(TypedBundle typedBundle) {
typedBundle.applyDelta(this.mBundle);
typedBundle.applyDelta(this);
}
@Override // androidx.constraintlayout.core.motion.utils.TypedValues
public boolean setValue(int i, String str) {
if (i != 705) {
return false;
}
this.mDefaultInterpolatorString = str;
this.mEasing = Easing.getInterpolator(str);
return false;
}
public boolean isEmpty() {
return this.state.isEmpty();
}
public void clear() {
this.state.clear();
}
public boolean contains(String str) {
return this.state.containsKey(str);
}
public void addKeyPosition(String str, TypedBundle typedBundle) {
getWidgetState(str, null, 0).setKeyPosition(typedBundle);
}
public void addKeyAttribute(String str, TypedBundle typedBundle) {
getWidgetState(str, null, 0).setKeyAttribute(typedBundle);
}
public void addKeyCycle(String str, TypedBundle typedBundle) {
getWidgetState(str, null, 0).setKeyCycle(typedBundle);
}
public void addKeyPosition(String str, int i, int i2, float f, float f2) {
TypedBundle typedBundle = new TypedBundle();
typedBundle.add(TypedValues.PositionType.TYPE_POSITION_TYPE, 2);
typedBundle.add(100, i);
typedBundle.add(TypedValues.PositionType.TYPE_PERCENT_X, f);
typedBundle.add(TypedValues.PositionType.TYPE_PERCENT_Y, f2);
getWidgetState(str, null, 0).setKeyPosition(typedBundle);
KeyPosition keyPosition = new KeyPosition(str, i, i2, f, f2);
HashMap<String, KeyPosition> hashMap = this.keyPositions.get(Integer.valueOf(i));
if (hashMap == null) {
hashMap = new HashMap<>();
this.keyPositions.put(Integer.valueOf(i), hashMap);
}
hashMap.put(str, keyPosition);
}
public void addCustomFloat(int i, String str, String str2, float f) {
getWidgetState(str, null, i).getFrame(i).addCustomFloat(str2, f);
}
public void addCustomColor(int i, String str, String str2, int i2) {
getWidgetState(str, null, i).getFrame(i).addCustomColor(str2, i2);
}
public void updateFrom(ConstraintWidgetContainer constraintWidgetContainer, int i) {
ArrayList<ConstraintWidget> children = constraintWidgetContainer.getChildren();
int size = children.size();
for (int i2 = 0; i2 < size; i2++) {
ConstraintWidget constraintWidget = children.get(i2);
getWidgetState(constraintWidget.stringId, null, i).update(constraintWidget, i);
}
}
public void interpolate(int i, int i2, float f) {
Easing easing = this.mEasing;
if (easing != null) {
f = (float) easing.get(f);
}
Iterator<String> it = this.state.keySet().iterator();
while (it.hasNext()) {
this.state.get(it.next()).interpolate(i, i2, f, this);
}
}
public WidgetFrame getStart(String str) {
WidgetState widgetState = this.state.get(str);
if (widgetState == null) {
return null;
}
return widgetState.start;
}
public WidgetFrame getEnd(String str) {
WidgetState widgetState = this.state.get(str);
if (widgetState == null) {
return null;
}
return widgetState.end;
}
public WidgetFrame getInterpolated(String str) {
WidgetState widgetState = this.state.get(str);
if (widgetState == null) {
return null;
}
return widgetState.interpolated;
}
public float[] getPath(String str) {
float[] fArr = new float[124];
this.state.get(str).motionControl.buildPath(fArr, 62);
return fArr;
}
public int getKeyFrames(String str, float[] fArr, int[] iArr, int[] iArr2) {
return this.state.get(str).motionControl.buildKeyFrames(fArr, iArr, iArr2);
}
private WidgetState getWidgetState(String str) {
return this.state.get(str);
}
private WidgetState getWidgetState(String str, ConstraintWidget constraintWidget, int i) {
WidgetState widgetState = this.state.get(str);
if (widgetState == null) {
widgetState = new WidgetState();
this.mBundle.applyDelta(widgetState.motionControl);
this.state.put(str, widgetState);
if (constraintWidget != null) {
widgetState.update(constraintWidget, i);
}
}
return widgetState;
}
public WidgetFrame getStart(ConstraintWidget constraintWidget) {
return getWidgetState(constraintWidget.stringId, null, 0).start;
}
public WidgetFrame getEnd(ConstraintWidget constraintWidget) {
return getWidgetState(constraintWidget.stringId, null, 1).end;
}
public WidgetFrame getInterpolated(ConstraintWidget constraintWidget) {
return getWidgetState(constraintWidget.stringId, null, 2).interpolated;
}
public Interpolator getInterpolator() {
return getInterpolator(this.mDefaultInterpolator, this.mDefaultInterpolatorString);
}
static class WidgetState {
Motion motionControl;
KeyCache myKeyCache = new KeyCache();
int myParentHeight = -1;
int myParentWidth = -1;
WidgetFrame start = new WidgetFrame();
WidgetFrame end = new WidgetFrame();
WidgetFrame interpolated = new WidgetFrame();
MotionWidget motionWidgetStart = new MotionWidget(this.start);
MotionWidget motionWidgetEnd = new MotionWidget(this.end);
MotionWidget motionWidgetInterpolated = new MotionWidget(this.interpolated);
public WidgetFrame getFrame(int i) {
return i == 0 ? this.start : i == 1 ? this.end : this.interpolated;
}
public WidgetState() {
Motion motion = new Motion(this.motionWidgetStart);
this.motionControl = motion;
motion.setStart(this.motionWidgetStart);
this.motionControl.setEnd(this.motionWidgetEnd);
}
public void setKeyPosition(TypedBundle typedBundle) {
MotionKeyPosition motionKeyPosition = new MotionKeyPosition();
typedBundle.applyDelta(motionKeyPosition);
this.motionControl.addKey(motionKeyPosition);
}
public void setKeyAttribute(TypedBundle typedBundle) {
MotionKeyAttributes motionKeyAttributes = new MotionKeyAttributes();
typedBundle.applyDelta(motionKeyAttributes);
this.motionControl.addKey(motionKeyAttributes);
}
public void setKeyCycle(TypedBundle typedBundle) {
MotionKeyCycle motionKeyCycle = new MotionKeyCycle();
typedBundle.applyDelta(motionKeyCycle);
this.motionControl.addKey(motionKeyCycle);
}
public void update(ConstraintWidget constraintWidget, int i) {
if (i == 0) {
this.start.update(constraintWidget);
this.motionControl.setStart(this.motionWidgetStart);
} else if (i == 1) {
this.end.update(constraintWidget);
this.motionControl.setEnd(this.motionWidgetEnd);
}
this.myParentWidth = -1;
}
public void interpolate(int i, int i2, float f, Transition transition) {
this.myParentHeight = i2;
this.myParentWidth = i;
this.motionControl.setup(i, i2, 1.0f, System.nanoTime());
WidgetFrame.interpolate(i, i2, this.interpolated, this.start, this.end, transition, f);
this.interpolated.interpolatedPos = f;
this.motionControl.interpolate(this.motionWidgetInterpolated, f, System.nanoTime(), this.myKeyCache);
}
}
static class KeyPosition {
int frame;
String target;
int type;
float x;
float y;
public KeyPosition(String str, int i, int i2, float f, float f2) {
this.target = str;
this.frame = i;
this.type = i2;
this.x = f;
this.y = f2;
}
}
}

View File

@ -0,0 +1,631 @@
package androidx.constraintlayout.core.state;
import androidx.constraintlayout.core.motion.CustomAttribute;
import androidx.constraintlayout.core.motion.CustomVariable;
import androidx.constraintlayout.core.motion.utils.TypedValues;
import androidx.constraintlayout.core.parser.CLElement;
import androidx.constraintlayout.core.parser.CLKey;
import androidx.constraintlayout.core.parser.CLNumber;
import androidx.constraintlayout.core.parser.CLObject;
import androidx.constraintlayout.core.parser.CLParsingException;
import androidx.constraintlayout.core.state.Transition;
import androidx.constraintlayout.core.widgets.ConstraintAnchor;
import androidx.constraintlayout.core.widgets.ConstraintWidget;
import androidx.core.os.EnvironmentCompat;
import java.util.HashMap;
import java.util.Set;
/* loaded from: classes.dex */
public class WidgetFrame {
private static final boolean OLD_SYSTEM = true;
public static float phone_orientation = Float.NaN;
public float alpha;
public int bottom;
public float interpolatedPos;
public int left;
public final HashMap<String, CustomVariable> mCustom;
public String name;
public float pivotX;
public float pivotY;
public int right;
public float rotationX;
public float rotationY;
public float rotationZ;
public float scaleX;
public float scaleY;
public int top;
public float translationX;
public float translationY;
public float translationZ;
public int visibility;
public ConstraintWidget widget;
public float centerX() {
return this.left + ((this.right - r0) / 2.0f);
}
public float centerY() {
return this.top + ((this.bottom - r0) / 2.0f);
}
public void setCustomValue(CustomAttribute customAttribute, float[] fArr) {
}
public int width() {
return Math.max(0, this.right - this.left);
}
public int height() {
return Math.max(0, this.bottom - this.top);
}
public WidgetFrame() {
this.widget = null;
this.left = 0;
this.top = 0;
this.right = 0;
this.bottom = 0;
this.pivotX = Float.NaN;
this.pivotY = Float.NaN;
this.rotationX = Float.NaN;
this.rotationY = Float.NaN;
this.rotationZ = Float.NaN;
this.translationX = Float.NaN;
this.translationY = Float.NaN;
this.translationZ = Float.NaN;
this.scaleX = Float.NaN;
this.scaleY = Float.NaN;
this.alpha = Float.NaN;
this.interpolatedPos = Float.NaN;
this.visibility = 0;
this.mCustom = new HashMap<>();
this.name = null;
}
public WidgetFrame(ConstraintWidget constraintWidget) {
this.widget = null;
this.left = 0;
this.top = 0;
this.right = 0;
this.bottom = 0;
this.pivotX = Float.NaN;
this.pivotY = Float.NaN;
this.rotationX = Float.NaN;
this.rotationY = Float.NaN;
this.rotationZ = Float.NaN;
this.translationX = Float.NaN;
this.translationY = Float.NaN;
this.translationZ = Float.NaN;
this.scaleX = Float.NaN;
this.scaleY = Float.NaN;
this.alpha = Float.NaN;
this.interpolatedPos = Float.NaN;
this.visibility = 0;
this.mCustom = new HashMap<>();
this.name = null;
this.widget = constraintWidget;
}
public WidgetFrame(WidgetFrame widgetFrame) {
this.widget = null;
this.left = 0;
this.top = 0;
this.right = 0;
this.bottom = 0;
this.pivotX = Float.NaN;
this.pivotY = Float.NaN;
this.rotationX = Float.NaN;
this.rotationY = Float.NaN;
this.rotationZ = Float.NaN;
this.translationX = Float.NaN;
this.translationY = Float.NaN;
this.translationZ = Float.NaN;
this.scaleX = Float.NaN;
this.scaleY = Float.NaN;
this.alpha = Float.NaN;
this.interpolatedPos = Float.NaN;
this.visibility = 0;
this.mCustom = new HashMap<>();
this.name = null;
this.widget = widgetFrame.widget;
this.left = widgetFrame.left;
this.top = widgetFrame.top;
this.right = widgetFrame.right;
this.bottom = widgetFrame.bottom;
updateAttributes(widgetFrame);
}
public void updateAttributes(WidgetFrame widgetFrame) {
this.pivotX = widgetFrame.pivotX;
this.pivotY = widgetFrame.pivotY;
this.rotationX = widgetFrame.rotationX;
this.rotationY = widgetFrame.rotationY;
this.rotationZ = widgetFrame.rotationZ;
this.translationX = widgetFrame.translationX;
this.translationY = widgetFrame.translationY;
this.translationZ = widgetFrame.translationZ;
this.scaleX = widgetFrame.scaleX;
this.scaleY = widgetFrame.scaleY;
this.alpha = widgetFrame.alpha;
this.visibility = widgetFrame.visibility;
this.mCustom.clear();
if (widgetFrame != null) {
for (CustomVariable customVariable : widgetFrame.mCustom.values()) {
this.mCustom.put(customVariable.getName(), customVariable.copy());
}
}
}
public boolean isDefaultTransform() {
if (Float.isNaN(this.rotationX) && Float.isNaN(this.rotationY) && Float.isNaN(this.rotationZ) && Float.isNaN(this.translationX) && Float.isNaN(this.translationY) && Float.isNaN(this.translationZ) && Float.isNaN(this.scaleX) && Float.isNaN(this.scaleY) && Float.isNaN(this.alpha)) {
return OLD_SYSTEM;
}
return false;
}
public static void interpolate(int i, int i2, WidgetFrame widgetFrame, WidgetFrame widgetFrame2, WidgetFrame widgetFrame3, Transition transition, float f) {
int i3;
float f2;
int i4;
int i5;
float f3;
float f4;
int i6;
float f5;
int i7;
int i8;
int i9;
int i10;
int i11;
int i12;
float f6 = 100.0f * f;
int i13 = (int) f6;
int i14 = widgetFrame2.left;
int i15 = widgetFrame2.top;
int i16 = widgetFrame3.left;
int i17 = widgetFrame3.top;
int i18 = widgetFrame2.right - i14;
int i19 = widgetFrame2.bottom - i15;
int i20 = widgetFrame3.right - i16;
int i21 = widgetFrame3.bottom - i17;
float f7 = widgetFrame2.alpha;
float f8 = widgetFrame3.alpha;
if (widgetFrame2.visibility == 8) {
i15 = (int) (i15 - (i21 / 2.0f));
i5 = (int) (i14 - (i20 / 2.0f));
if (Float.isNaN(f7)) {
i4 = i21;
i3 = i20;
f2 = 0.0f;
} else {
f2 = f7;
i3 = i20;
i4 = i21;
}
} else {
i3 = i18;
f2 = f7;
i4 = i19;
i5 = i14;
}
if (widgetFrame3.visibility == 8) {
i16 = (int) (i16 - (i3 / 2.0f));
i17 = (int) (i17 - (i4 / 2.0f));
i20 = i3;
i21 = i4;
if (Float.isNaN(f8)) {
f8 = 0.0f;
}
}
if (Float.isNaN(f2) && !Float.isNaN(f8)) {
f2 = 1.0f;
}
if (!Float.isNaN(f2) && Float.isNaN(f8)) {
f8 = 1.0f;
}
if (widgetFrame2.visibility == 4) {
f4 = f8;
f3 = 0.0f;
} else {
f3 = f2;
f4 = f8;
}
float f9 = widgetFrame3.visibility == 4 ? 0.0f : f4;
if (widgetFrame.widget == null || !transition.hasPositionKeyframes()) {
i6 = i15;
f5 = f;
i7 = i5;
i8 = i16;
} else {
Transition.KeyPosition findPreviousPosition = transition.findPreviousPosition(widgetFrame.widget.stringId, i13);
i6 = i15;
Transition.KeyPosition findNextPosition = transition.findNextPosition(widgetFrame.widget.stringId, i13);
if (findPreviousPosition == findNextPosition) {
findNextPosition = null;
}
if (findPreviousPosition != null) {
int i22 = (int) (findPreviousPosition.x * i);
i10 = i16;
i9 = i2;
i6 = (int) (findPreviousPosition.y * i9);
i11 = findPreviousPosition.frame;
i7 = i22;
} else {
i9 = i2;
i10 = i16;
i7 = i5;
i11 = 0;
}
if (findNextPosition != null) {
int i23 = (int) (findNextPosition.x * i);
int i24 = (int) (findNextPosition.y * i9);
i12 = findNextPosition.frame;
i8 = i23;
i17 = i24;
} else {
i12 = 100;
i8 = i10;
}
f5 = (f6 - i11) / (i12 - i11);
}
widgetFrame.widget = widgetFrame2.widget;
int i25 = (int) (i7 + ((i8 - i7) * f5));
widgetFrame.left = i25;
int i26 = (int) (i6 + (f5 * (i17 - r10)));
widgetFrame.top = i26;
float f10 = 1.0f - f;
widgetFrame.right = i25 + ((int) ((i3 * f10) + (i20 * f)));
widgetFrame.bottom = i26 + ((int) ((f10 * i4) + (i21 * f)));
widgetFrame.pivotX = interpolate(widgetFrame2.pivotX, widgetFrame3.pivotX, 0.5f, f);
widgetFrame.pivotY = interpolate(widgetFrame2.pivotY, widgetFrame3.pivotY, 0.5f, f);
widgetFrame.rotationX = interpolate(widgetFrame2.rotationX, widgetFrame3.rotationX, 0.0f, f);
widgetFrame.rotationY = interpolate(widgetFrame2.rotationY, widgetFrame3.rotationY, 0.0f, f);
widgetFrame.rotationZ = interpolate(widgetFrame2.rotationZ, widgetFrame3.rotationZ, 0.0f, f);
widgetFrame.scaleX = interpolate(widgetFrame2.scaleX, widgetFrame3.scaleX, 1.0f, f);
widgetFrame.scaleY = interpolate(widgetFrame2.scaleY, widgetFrame3.scaleY, 1.0f, f);
widgetFrame.translationX = interpolate(widgetFrame2.translationX, widgetFrame3.translationX, 0.0f, f);
widgetFrame.translationY = interpolate(widgetFrame2.translationY, widgetFrame3.translationY, 0.0f, f);
widgetFrame.translationZ = interpolate(widgetFrame2.translationZ, widgetFrame3.translationZ, 0.0f, f);
widgetFrame.alpha = interpolate(f3, f9, 1.0f, f);
Set<String> keySet = widgetFrame3.mCustom.keySet();
widgetFrame.mCustom.clear();
for (String str : keySet) {
if (widgetFrame2.mCustom.containsKey(str)) {
CustomVariable customVariable = widgetFrame2.mCustom.get(str);
CustomVariable customVariable2 = widgetFrame3.mCustom.get(str);
CustomVariable customVariable3 = new CustomVariable(customVariable);
widgetFrame.mCustom.put(str, customVariable3);
if (customVariable.numberOfInterpolatedValues() == 1) {
customVariable3.setValue(Float.valueOf(interpolate(customVariable.getValueToInterpolate(), customVariable2.getValueToInterpolate(), 0.0f, f)));
} else {
int numberOfInterpolatedValues = customVariable.numberOfInterpolatedValues();
float[] fArr = new float[numberOfInterpolatedValues];
float[] fArr2 = new float[numberOfInterpolatedValues];
customVariable.getValuesToInterpolate(fArr);
customVariable2.getValuesToInterpolate(fArr2);
for (int i27 = 0; i27 < numberOfInterpolatedValues; i27++) {
fArr[i27] = interpolate(fArr[i27], fArr2[i27], 0.0f, f);
customVariable3.setValue(fArr);
}
}
}
}
}
private static float interpolate(float f, float f2, float f3, float f4) {
boolean isNaN = Float.isNaN(f);
boolean isNaN2 = Float.isNaN(f2);
if (isNaN && isNaN2) {
return Float.NaN;
}
if (isNaN) {
f = f3;
}
if (isNaN2) {
f2 = f3;
}
return f + (f4 * (f2 - f));
}
public WidgetFrame update() {
ConstraintWidget constraintWidget = this.widget;
if (constraintWidget != null) {
this.left = constraintWidget.getLeft();
this.top = this.widget.getTop();
this.right = this.widget.getRight();
this.bottom = this.widget.getBottom();
updateAttributes(this.widget.frame);
}
return this;
}
public WidgetFrame update(ConstraintWidget constraintWidget) {
if (constraintWidget == null) {
return this;
}
this.widget = constraintWidget;
update();
return this;
}
public void addCustomColor(String str, int i) {
setCustomAttribute(str, TypedValues.Custom.TYPE_COLOR, i);
}
public int getCustomColor(String str) {
if (this.mCustom.containsKey(str)) {
return this.mCustom.get(str).getColorValue();
}
return -21880;
}
public void addCustomFloat(String str, float f) {
setCustomAttribute(str, TypedValues.Custom.TYPE_FLOAT, f);
}
public float getCustomFloat(String str) {
if (this.mCustom.containsKey(str)) {
return this.mCustom.get(str).getFloatValue();
}
return Float.NaN;
}
public void setCustomAttribute(String str, int i, float f) {
if (this.mCustom.containsKey(str)) {
this.mCustom.get(str).setFloatValue(f);
} else {
this.mCustom.put(str, new CustomVariable(str, i, f));
}
}
public void setCustomAttribute(String str, int i, int i2) {
if (this.mCustom.containsKey(str)) {
this.mCustom.get(str).setIntValue(i2);
} else {
this.mCustom.put(str, new CustomVariable(str, i, i2));
}
}
public void setCustomAttribute(String str, int i, boolean z) {
if (this.mCustom.containsKey(str)) {
this.mCustom.get(str).setBooleanValue(z);
} else {
this.mCustom.put(str, new CustomVariable(str, i, z));
}
}
public void setCustomAttribute(String str, int i, String str2) {
if (this.mCustom.containsKey(str)) {
this.mCustom.get(str).setStringValue(str2);
} else {
this.mCustom.put(str, new CustomVariable(str, i, str2));
}
}
public CustomVariable getCustomAttribute(String str) {
return this.mCustom.get(str);
}
public Set<String> getCustomAttributeNames() {
return this.mCustom.keySet();
}
public boolean setValue(String str, CLElement cLElement) throws CLParsingException {
str.hashCode();
switch (str) {
case "phone_orientation":
phone_orientation = cLElement.getFloat();
return OLD_SYSTEM;
case "bottom":
this.bottom = cLElement.getInt();
return OLD_SYSTEM;
case "custom":
parseCustom(cLElement);
return OLD_SYSTEM;
case "rotationX":
this.rotationX = cLElement.getFloat();
return OLD_SYSTEM;
case "rotationY":
this.rotationY = cLElement.getFloat();
return OLD_SYSTEM;
case "rotationZ":
this.rotationZ = cLElement.getFloat();
return OLD_SYSTEM;
case "translationX":
this.translationX = cLElement.getFloat();
return OLD_SYSTEM;
case "translationY":
this.translationY = cLElement.getFloat();
return OLD_SYSTEM;
case "translationZ":
this.translationZ = cLElement.getFloat();
return OLD_SYSTEM;
case "pivotX":
this.pivotX = cLElement.getFloat();
return OLD_SYSTEM;
case "pivotY":
this.pivotY = cLElement.getFloat();
return OLD_SYSTEM;
case "scaleX":
this.scaleX = cLElement.getFloat();
return OLD_SYSTEM;
case "scaleY":
this.scaleY = cLElement.getFloat();
return OLD_SYSTEM;
case "top":
this.top = cLElement.getInt();
return OLD_SYSTEM;
case "left":
this.left = cLElement.getInt();
return OLD_SYSTEM;
case "alpha":
this.alpha = cLElement.getFloat();
return OLD_SYSTEM;
case "right":
this.right = cLElement.getInt();
return OLD_SYSTEM;
case "interpolatedPos":
this.interpolatedPos = cLElement.getFloat();
return OLD_SYSTEM;
default:
return false;
}
}
public String getId() {
ConstraintWidget constraintWidget = this.widget;
return constraintWidget == null ? EnvironmentCompat.MEDIA_UNKNOWN : constraintWidget.stringId;
}
void parseCustom(CLElement cLElement) throws CLParsingException {
CLObject cLObject = (CLObject) cLElement;
int size = cLObject.size();
for (int i = 0; i < size; i++) {
CLKey cLKey = (CLKey) cLObject.get(i);
cLKey.content();
CLElement value = cLKey.getValue();
String content = value.content();
if (content.matches("#[0-9a-fA-F]+")) {
setCustomAttribute(cLKey.content(), TypedValues.Custom.TYPE_COLOR, Integer.parseInt(content.substring(1), 16));
} else if (value instanceof CLNumber) {
setCustomAttribute(cLKey.content(), TypedValues.Custom.TYPE_FLOAT, value.getFloat());
} else {
setCustomAttribute(cLKey.content(), TypedValues.Custom.TYPE_STRING, content);
}
}
}
public StringBuilder serialize(StringBuilder sb) {
return serialize(sb, false);
}
public StringBuilder serialize(StringBuilder sb, boolean z) {
sb.append("{\n");
add(sb, "left", this.left);
add(sb, "top", this.top);
add(sb, "right", this.right);
add(sb, "bottom", this.bottom);
add(sb, "pivotX", this.pivotX);
add(sb, "pivotY", this.pivotY);
add(sb, "rotationX", this.rotationX);
add(sb, "rotationY", this.rotationY);
add(sb, "rotationZ", this.rotationZ);
add(sb, "translationX", this.translationX);
add(sb, "translationY", this.translationY);
add(sb, "translationZ", this.translationZ);
add(sb, "scaleX", this.scaleX);
add(sb, "scaleY", this.scaleY);
add(sb, "alpha", this.alpha);
add(sb, "visibility", this.visibility);
add(sb, "interpolatedPos", this.interpolatedPos);
if (this.widget != null) {
for (ConstraintAnchor.Type type : ConstraintAnchor.Type.values()) {
serializeAnchor(sb, type);
}
}
if (z) {
add(sb, "phone_orientation", phone_orientation);
}
if (z) {
add(sb, "phone_orientation", phone_orientation);
}
if (this.mCustom.size() != 0) {
sb.append("custom : {\n");
for (String str : this.mCustom.keySet()) {
CustomVariable customVariable = this.mCustom.get(str);
sb.append(str);
sb.append(": ");
switch (customVariable.getType()) {
case TypedValues.Custom.TYPE_INT /* 900 */:
sb.append(customVariable.getIntegerValue());
sb.append(",\n");
break;
case TypedValues.Custom.TYPE_FLOAT /* 901 */:
case TypedValues.Custom.TYPE_DIMENSION /* 905 */:
sb.append(customVariable.getFloatValue());
sb.append(",\n");
break;
case TypedValues.Custom.TYPE_COLOR /* 902 */:
sb.append("'");
sb.append(CustomVariable.colorString(customVariable.getIntegerValue()));
sb.append("',\n");
break;
case TypedValues.Custom.TYPE_STRING /* 903 */:
sb.append("'");
sb.append(customVariable.getStringValue());
sb.append("',\n");
break;
case TypedValues.Custom.TYPE_BOOLEAN /* 904 */:
sb.append("'");
sb.append(customVariable.getBooleanValue());
sb.append("',\n");
break;
}
}
sb.append("}\n");
}
sb.append("}\n");
return sb;
}
private void serializeAnchor(StringBuilder sb, ConstraintAnchor.Type type) {
ConstraintAnchor anchor = this.widget.getAnchor(type);
if (anchor == null || anchor.mTarget == null) {
return;
}
sb.append("Anchor");
sb.append(type.name());
sb.append(": ['");
String str = anchor.mTarget.getOwner().stringId;
if (str == null) {
str = "#PARENT";
}
sb.append(str);
sb.append("', '");
sb.append(anchor.mTarget.getType().name());
sb.append("', '");
sb.append(anchor.mMargin);
sb.append("'],\n");
}
private static void add(StringBuilder sb, String str, int i) {
sb.append(str);
sb.append(": ");
sb.append(i);
sb.append(",\n");
}
private static void add(StringBuilder sb, String str, float f) {
if (Float.isNaN(f)) {
return;
}
sb.append(str);
sb.append(": ");
sb.append(f);
sb.append(",\n");
}
void printCustomAttributes() {
StackTraceElement stackTraceElement = new Throwable().getStackTrace()[1];
String str = (".(" + stackTraceElement.getFileName() + ":" + stackTraceElement.getLineNumber() + ") " + stackTraceElement.getMethodName()) + " " + (hashCode() % 1000);
String str2 = this.widget != null ? str + "/" + (this.widget.hashCode() % 1000) + " " : str + "/NULL ";
HashMap<String, CustomVariable> hashMap = this.mCustom;
if (hashMap != null) {
for (String str3 : hashMap.keySet()) {
System.out.println(str2 + this.mCustom.get(str3).toString());
}
}
}
void logv(String str) {
String str2;
StackTraceElement stackTraceElement = new Throwable().getStackTrace()[1];
String str3 = (".(" + stackTraceElement.getFileName() + ":" + stackTraceElement.getLineNumber() + ") " + stackTraceElement.getMethodName()) + " " + (hashCode() % 1000);
if (this.widget != null) {
str2 = str3 + "/" + (this.widget.hashCode() % 1000);
} else {
str2 = str3 + "/NULL";
}
System.out.println(str2 + " " + str);
}
}

View File

@ -0,0 +1,43 @@
package androidx.constraintlayout.core.state.helpers;
import androidx.constraintlayout.core.state.ConstraintReference;
import androidx.constraintlayout.core.state.HelperReference;
import androidx.constraintlayout.core.state.State;
import java.util.Iterator;
/* loaded from: classes.dex */
public class AlignHorizontallyReference extends HelperReference {
private float mBias;
public AlignHorizontallyReference(State state) {
super(state, State.Helper.ALIGN_VERTICALLY);
this.mBias = 0.5f;
}
@Override // androidx.constraintlayout.core.state.HelperReference, androidx.constraintlayout.core.state.ConstraintReference, androidx.constraintlayout.core.state.Reference
public void apply() {
Iterator<Object> it = this.mReferences.iterator();
while (it.hasNext()) {
ConstraintReference constraints = this.mState.constraints(it.next());
constraints.clearHorizontal();
if (this.mStartToStart != null) {
constraints.startToStart(this.mStartToStart);
} else if (this.mStartToEnd != null) {
constraints.startToEnd(this.mStartToEnd);
} else {
constraints.startToStart(State.PARENT);
}
if (this.mEndToStart != null) {
constraints.endToStart(this.mEndToStart);
} else if (this.mEndToEnd != null) {
constraints.endToEnd(this.mEndToEnd);
} else {
constraints.endToEnd(State.PARENT);
}
float f = this.mBias;
if (f != 0.5f) {
constraints.horizontalBias(f);
}
}
}
}

View File

@ -0,0 +1,43 @@
package androidx.constraintlayout.core.state.helpers;
import androidx.constraintlayout.core.state.ConstraintReference;
import androidx.constraintlayout.core.state.HelperReference;
import androidx.constraintlayout.core.state.State;
import java.util.Iterator;
/* loaded from: classes.dex */
public class AlignVerticallyReference extends HelperReference {
private float mBias;
public AlignVerticallyReference(State state) {
super(state, State.Helper.ALIGN_VERTICALLY);
this.mBias = 0.5f;
}
@Override // androidx.constraintlayout.core.state.HelperReference, androidx.constraintlayout.core.state.ConstraintReference, androidx.constraintlayout.core.state.Reference
public void apply() {
Iterator<Object> it = this.mReferences.iterator();
while (it.hasNext()) {
ConstraintReference constraints = this.mState.constraints(it.next());
constraints.clearVertical();
if (this.mTopToTop != null) {
constraints.topToTop(this.mTopToTop);
} else if (this.mTopToBottom != null) {
constraints.topToBottom(this.mTopToBottom);
} else {
constraints.topToTop(State.PARENT);
}
if (this.mBottomToTop != null) {
constraints.bottomToTop(this.mBottomToTop);
} else if (this.mBottomToBottom != null) {
constraints.bottomToBottom(this.mBottomToBottom);
} else {
constraints.bottomToBottom(State.PARENT);
}
float f = this.mBias;
if (f != 0.5f) {
constraints.verticalBias(f);
}
}
}
}

View File

@ -0,0 +1,92 @@
package androidx.constraintlayout.core.state.helpers;
import androidx.constraintlayout.core.state.ConstraintReference;
import androidx.constraintlayout.core.state.HelperReference;
import androidx.constraintlayout.core.state.State;
import androidx.constraintlayout.core.widgets.Barrier;
import androidx.constraintlayout.core.widgets.HelperWidget;
/* loaded from: classes.dex */
public class BarrierReference extends HelperReference {
private Barrier mBarrierWidget;
private State.Direction mDirection;
private int mMargin;
@Override // androidx.constraintlayout.core.state.ConstraintReference
public ConstraintReference margin(int i) {
this.mMargin = i;
return this;
}
public void setBarrierDirection(State.Direction direction) {
this.mDirection = direction;
}
public BarrierReference(State state) {
super(state, State.Helper.BARRIER);
}
@Override // androidx.constraintlayout.core.state.ConstraintReference
public ConstraintReference margin(Object obj) {
margin(this.mState.convertDimension(obj));
return this;
}
@Override // androidx.constraintlayout.core.state.HelperReference
public HelperWidget getHelperWidget() {
if (this.mBarrierWidget == null) {
this.mBarrierWidget = new Barrier();
}
return this.mBarrierWidget;
}
@Override // androidx.constraintlayout.core.state.HelperReference, androidx.constraintlayout.core.state.ConstraintReference, androidx.constraintlayout.core.state.Reference
public void apply() {
getHelperWidget();
int i = AnonymousClass1.$SwitchMap$androidx$constraintlayout$core$state$State$Direction[this.mDirection.ordinal()];
int i2 = 3;
if (i == 3 || i == 4) {
i2 = 1;
} else if (i == 5) {
i2 = 2;
} else if (i != 6) {
i2 = 0;
}
this.mBarrierWidget.setBarrierType(i2);
this.mBarrierWidget.setMargin(this.mMargin);
}
/* renamed from: androidx.constraintlayout.core.state.helpers.BarrierReference$1, reason: invalid class name */
static /* synthetic */ class AnonymousClass1 {
static final /* synthetic */ int[] $SwitchMap$androidx$constraintlayout$core$state$State$Direction;
static {
int[] iArr = new int[State.Direction.values().length];
$SwitchMap$androidx$constraintlayout$core$state$State$Direction = iArr;
try {
iArr[State.Direction.LEFT.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
$SwitchMap$androidx$constraintlayout$core$state$State$Direction[State.Direction.START.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
$SwitchMap$androidx$constraintlayout$core$state$State$Direction[State.Direction.RIGHT.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
$SwitchMap$androidx$constraintlayout$core$state$State$Direction[State.Direction.END.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
try {
$SwitchMap$androidx$constraintlayout$core$state$State$Direction[State.Direction.TOP.ordinal()] = 5;
} catch (NoSuchFieldError unused5) {
}
try {
$SwitchMap$androidx$constraintlayout$core$state$State$Direction[State.Direction.BOTTOM.ordinal()] = 6;
} catch (NoSuchFieldError unused6) {
}
}
}
}

View File

@ -0,0 +1,35 @@
package androidx.constraintlayout.core.state.helpers;
import androidx.constraintlayout.core.state.HelperReference;
import androidx.constraintlayout.core.state.State;
/* loaded from: classes.dex */
public class ChainReference extends HelperReference {
protected float mBias;
protected State.Chain mStyle;
@Override // androidx.constraintlayout.core.state.ConstraintReference
public ChainReference bias(float f) {
this.mBias = f;
return this;
}
public float getBias() {
return this.mBias;
}
public ChainReference style(State.Chain chain) {
this.mStyle = chain;
return this;
}
public ChainReference(State state, State.Helper helper) {
super(state, helper);
this.mBias = 0.5f;
this.mStyle = State.Chain.SPREAD;
}
public State.Chain getStyle() {
return State.Chain.SPREAD;
}
}

View File

@ -0,0 +1,10 @@
package androidx.constraintlayout.core.state.helpers;
import androidx.constraintlayout.core.widgets.ConstraintWidget;
/* loaded from: classes.dex */
public interface Facade {
void apply();
ConstraintWidget getConstraintWidget();
}

View File

@ -0,0 +1,98 @@
package androidx.constraintlayout.core.state.helpers;
import androidx.constraintlayout.core.state.Reference;
import androidx.constraintlayout.core.state.State;
import androidx.constraintlayout.core.widgets.ConstraintWidget;
import androidx.constraintlayout.core.widgets.Guideline;
/* loaded from: classes.dex */
public class GuidelineReference implements Facade, Reference {
private Object key;
private Guideline mGuidelineWidget;
private int mOrientation;
final State mState;
private int mStart = -1;
private int mEnd = -1;
private float mPercent = 0.0f;
@Override // androidx.constraintlayout.core.state.Reference
public Facade getFacade() {
return null;
}
@Override // androidx.constraintlayout.core.state.Reference
public Object getKey() {
return this.key;
}
public int getOrientation() {
return this.mOrientation;
}
public GuidelineReference percent(float f) {
this.mStart = -1;
this.mEnd = -1;
this.mPercent = f;
return this;
}
@Override // androidx.constraintlayout.core.state.Reference
public void setKey(Object obj) {
this.key = obj;
}
public void setOrientation(int i) {
this.mOrientation = i;
}
public GuidelineReference(State state) {
this.mState = state;
}
public GuidelineReference start(Object obj) {
this.mStart = this.mState.convertDimension(obj);
this.mEnd = -1;
this.mPercent = 0.0f;
return this;
}
public GuidelineReference end(Object obj) {
this.mStart = -1;
this.mEnd = this.mState.convertDimension(obj);
this.mPercent = 0.0f;
return this;
}
@Override // androidx.constraintlayout.core.state.helpers.Facade, androidx.constraintlayout.core.state.Reference
public void apply() {
this.mGuidelineWidget.setOrientation(this.mOrientation);
int i = this.mStart;
if (i != -1) {
this.mGuidelineWidget.setGuideBegin(i);
return;
}
int i2 = this.mEnd;
if (i2 != -1) {
this.mGuidelineWidget.setGuideEnd(i2);
} else {
this.mGuidelineWidget.setGuidePercent(this.mPercent);
}
}
@Override // androidx.constraintlayout.core.state.helpers.Facade, androidx.constraintlayout.core.state.Reference
public ConstraintWidget getConstraintWidget() {
if (this.mGuidelineWidget == null) {
this.mGuidelineWidget = new Guideline();
}
return this.mGuidelineWidget;
}
@Override // androidx.constraintlayout.core.state.Reference
public void setConstraintWidget(ConstraintWidget constraintWidget) {
if (constraintWidget instanceof Guideline) {
this.mGuidelineWidget = (Guideline) constraintWidget;
} else {
this.mGuidelineWidget = null;
}
}
}

View File

@ -0,0 +1,97 @@
package androidx.constraintlayout.core.state.helpers;
import androidx.constraintlayout.core.state.ConstraintReference;
import androidx.constraintlayout.core.state.State;
import java.util.Iterator;
/* loaded from: classes.dex */
public class HorizontalChainReference extends ChainReference {
public HorizontalChainReference(State state) {
super(state, State.Helper.HORIZONTAL_CHAIN);
}
@Override // androidx.constraintlayout.core.state.HelperReference, androidx.constraintlayout.core.state.ConstraintReference, androidx.constraintlayout.core.state.Reference
public void apply() {
Iterator<Object> it = this.mReferences.iterator();
while (it.hasNext()) {
this.mState.constraints(it.next()).clearHorizontal();
}
Iterator<Object> it2 = this.mReferences.iterator();
ConstraintReference constraintReference = null;
ConstraintReference constraintReference2 = null;
while (it2.hasNext()) {
ConstraintReference constraints = this.mState.constraints(it2.next());
if (constraintReference2 == null) {
if (this.mStartToStart != null) {
constraints.startToStart(this.mStartToStart).margin(this.mMarginStart).marginGone(this.mMarginStartGone);
} else if (this.mStartToEnd != null) {
constraints.startToEnd(this.mStartToEnd).margin(this.mMarginStart).marginGone(this.mMarginStartGone);
} else if (this.mLeftToLeft != null) {
constraints.startToStart(this.mLeftToLeft).margin(this.mMarginLeft).marginGone(this.mMarginLeftGone);
} else if (this.mLeftToRight != null) {
constraints.startToEnd(this.mLeftToRight).margin(this.mMarginLeft).marginGone(this.mMarginLeftGone);
} else {
constraints.startToStart(State.PARENT);
}
constraintReference2 = constraints;
}
if (constraintReference != null) {
constraintReference.endToStart(constraints.getKey());
constraints.startToEnd(constraintReference.getKey());
}
constraintReference = constraints;
}
if (constraintReference != null) {
if (this.mEndToStart != null) {
constraintReference.endToStart(this.mEndToStart).margin(this.mMarginEnd).marginGone(this.mMarginEndGone);
} else if (this.mEndToEnd != null) {
constraintReference.endToEnd(this.mEndToEnd).margin(this.mMarginEnd).marginGone(this.mMarginEndGone);
} else if (this.mRightToLeft != null) {
constraintReference.endToStart(this.mRightToLeft).margin(this.mMarginRight).marginGone(this.mMarginRightGone);
} else if (this.mRightToRight != null) {
constraintReference.endToEnd(this.mRightToRight).margin(this.mMarginRight).marginGone(this.mMarginRightGone);
} else {
constraintReference.endToEnd(State.PARENT);
}
}
if (constraintReference2 == null) {
return;
}
if (this.mBias != 0.5f) {
constraintReference2.horizontalBias(this.mBias);
}
int i = AnonymousClass1.$SwitchMap$androidx$constraintlayout$core$state$State$Chain[this.mStyle.ordinal()];
if (i == 1) {
constraintReference2.setHorizontalChainStyle(0);
} else if (i == 2) {
constraintReference2.setHorizontalChainStyle(1);
} else {
if (i != 3) {
return;
}
constraintReference2.setHorizontalChainStyle(2);
}
}
/* renamed from: androidx.constraintlayout.core.state.helpers.HorizontalChainReference$1, reason: invalid class name */
static /* synthetic */ class AnonymousClass1 {
static final /* synthetic */ int[] $SwitchMap$androidx$constraintlayout$core$state$State$Chain;
static {
int[] iArr = new int[State.Chain.values().length];
$SwitchMap$androidx$constraintlayout$core$state$State$Chain = iArr;
try {
iArr[State.Chain.SPREAD.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
$SwitchMap$androidx$constraintlayout$core$state$State$Chain[State.Chain.SPREAD_INSIDE.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
$SwitchMap$androidx$constraintlayout$core$state$State$Chain[State.Chain.PACKED.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
}
}
}

View File

@ -0,0 +1,89 @@
package androidx.constraintlayout.core.state.helpers;
import androidx.constraintlayout.core.state.ConstraintReference;
import androidx.constraintlayout.core.state.State;
import java.util.Iterator;
/* loaded from: classes.dex */
public class VerticalChainReference extends ChainReference {
public VerticalChainReference(State state) {
super(state, State.Helper.VERTICAL_CHAIN);
}
@Override // androidx.constraintlayout.core.state.HelperReference, androidx.constraintlayout.core.state.ConstraintReference, androidx.constraintlayout.core.state.Reference
public void apply() {
Iterator<Object> it = this.mReferences.iterator();
while (it.hasNext()) {
this.mState.constraints(it.next()).clearVertical();
}
Iterator<Object> it2 = this.mReferences.iterator();
ConstraintReference constraintReference = null;
ConstraintReference constraintReference2 = null;
while (it2.hasNext()) {
ConstraintReference constraints = this.mState.constraints(it2.next());
if (constraintReference2 == null) {
if (this.mTopToTop != null) {
constraints.topToTop(this.mTopToTop).margin(this.mMarginTop).marginGone(this.mMarginTopGone);
} else if (this.mTopToBottom != null) {
constraints.topToBottom(this.mTopToBottom).margin(this.mMarginTop).marginGone(this.mMarginTopGone);
} else {
constraints.topToTop(State.PARENT);
}
constraintReference2 = constraints;
}
if (constraintReference != null) {
constraintReference.bottomToTop(constraints.getKey());
constraints.topToBottom(constraintReference.getKey());
}
constraintReference = constraints;
}
if (constraintReference != null) {
if (this.mBottomToTop != null) {
constraintReference.bottomToTop(this.mBottomToTop).margin(this.mMarginBottom).marginGone(this.mMarginBottomGone);
} else if (this.mBottomToBottom != null) {
constraintReference.bottomToBottom(this.mBottomToBottom).margin(this.mMarginBottom).marginGone(this.mMarginBottomGone);
} else {
constraintReference.bottomToBottom(State.PARENT);
}
}
if (constraintReference2 == null) {
return;
}
if (this.mBias != 0.5f) {
constraintReference2.verticalBias(this.mBias);
}
int i = AnonymousClass1.$SwitchMap$androidx$constraintlayout$core$state$State$Chain[this.mStyle.ordinal()];
if (i == 1) {
constraintReference2.setVerticalChainStyle(0);
} else if (i == 2) {
constraintReference2.setVerticalChainStyle(1);
} else {
if (i != 3) {
return;
}
constraintReference2.setVerticalChainStyle(2);
}
}
/* renamed from: androidx.constraintlayout.core.state.helpers.VerticalChainReference$1, reason: invalid class name */
static /* synthetic */ class AnonymousClass1 {
static final /* synthetic */ int[] $SwitchMap$androidx$constraintlayout$core$state$State$Chain;
static {
int[] iArr = new int[State.Chain.values().length];
$SwitchMap$androidx$constraintlayout$core$state$State$Chain = iArr;
try {
iArr[State.Chain.SPREAD.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
$SwitchMap$androidx$constraintlayout$core$state$State$Chain[State.Chain.SPREAD_INSIDE.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
$SwitchMap$androidx$constraintlayout$core$state$State$Chain[State.Chain.PACKED.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
}
}
}

View File

@ -0,0 +1,255 @@
package androidx.constraintlayout.core.widgets;
import androidx.constraintlayout.core.LinearSystem;
import androidx.constraintlayout.core.SolverVariable;
import androidx.constraintlayout.core.widgets.ConstraintAnchor;
import androidx.constraintlayout.core.widgets.ConstraintWidget;
import java.util.HashMap;
/* loaded from: classes.dex */
public class Barrier extends HelperWidget {
public static final int BOTTOM = 3;
public static final int LEFT = 0;
public static final int RIGHT = 1;
public static final int TOP = 2;
private static final boolean USE_RELAX_GONE = false;
private static final boolean USE_RESOLUTION = true;
private int mBarrierType = 0;
private boolean mAllowsGoneWidget = USE_RESOLUTION;
private int mMargin = 0;
boolean resolved = false;
@Override // androidx.constraintlayout.core.widgets.ConstraintWidget
public boolean allowedInBarrier() {
return USE_RESOLUTION;
}
@Deprecated
public boolean allowsGoneWidget() {
return this.mAllowsGoneWidget;
}
public boolean getAllowsGoneWidget() {
return this.mAllowsGoneWidget;
}
public int getBarrierType() {
return this.mBarrierType;
}
public int getMargin() {
return this.mMargin;
}
public int getOrientation() {
int i = this.mBarrierType;
if (i == 0 || i == 1) {
return 0;
}
return (i == 2 || i == 3) ? 1 : -1;
}
@Override // androidx.constraintlayout.core.widgets.ConstraintWidget
public boolean isResolvedHorizontally() {
return this.resolved;
}
@Override // androidx.constraintlayout.core.widgets.ConstraintWidget
public boolean isResolvedVertically() {
return this.resolved;
}
public void setAllowsGoneWidget(boolean z) {
this.mAllowsGoneWidget = z;
}
public void setBarrierType(int i) {
this.mBarrierType = i;
}
public void setMargin(int i) {
this.mMargin = i;
}
public Barrier() {
}
public Barrier(String str) {
setDebugName(str);
}
@Override // androidx.constraintlayout.core.widgets.HelperWidget, androidx.constraintlayout.core.widgets.ConstraintWidget
public void copy(ConstraintWidget constraintWidget, HashMap<ConstraintWidget, ConstraintWidget> hashMap) {
super.copy(constraintWidget, hashMap);
Barrier barrier = (Barrier) constraintWidget;
this.mBarrierType = barrier.mBarrierType;
this.mAllowsGoneWidget = barrier.mAllowsGoneWidget;
this.mMargin = barrier.mMargin;
}
@Override // androidx.constraintlayout.core.widgets.ConstraintWidget
public String toString() {
String str = "[Barrier] " + getDebugName() + " {";
for (int i = 0; i < this.mWidgetsCount; i++) {
ConstraintWidget constraintWidget = this.mWidgets[i];
if (i > 0) {
str = str + ", ";
}
str = str + constraintWidget.getDebugName();
}
return str + "}";
}
protected void markWidgets() {
for (int i = 0; i < this.mWidgetsCount; i++) {
ConstraintWidget constraintWidget = this.mWidgets[i];
if (this.mAllowsGoneWidget || constraintWidget.allowedInBarrier()) {
int i2 = this.mBarrierType;
if (i2 == 0 || i2 == 1) {
constraintWidget.setInBarrier(0, USE_RESOLUTION);
} else if (i2 == 2 || i2 == 3) {
constraintWidget.setInBarrier(1, USE_RESOLUTION);
}
}
}
}
@Override // androidx.constraintlayout.core.widgets.ConstraintWidget
public void addToSolver(LinearSystem linearSystem, boolean z) {
boolean z2;
int i;
int i2;
int i3;
this.mListAnchors[0] = this.mLeft;
this.mListAnchors[2] = this.mTop;
this.mListAnchors[1] = this.mRight;
this.mListAnchors[3] = this.mBottom;
for (int i4 = 0; i4 < this.mListAnchors.length; i4++) {
this.mListAnchors[i4].mSolverVariable = linearSystem.createObjectVariable(this.mListAnchors[i4]);
}
int i5 = this.mBarrierType;
if (i5 < 0 || i5 >= 4) {
return;
}
ConstraintAnchor constraintAnchor = this.mListAnchors[this.mBarrierType];
if (!this.resolved) {
allSolved();
}
if (this.resolved) {
this.resolved = false;
int i6 = this.mBarrierType;
if (i6 == 0 || i6 == 1) {
linearSystem.addEquality(this.mLeft.mSolverVariable, this.mX);
linearSystem.addEquality(this.mRight.mSolverVariable, this.mX);
return;
} else {
if (i6 == 2 || i6 == 3) {
linearSystem.addEquality(this.mTop.mSolverVariable, this.mY);
linearSystem.addEquality(this.mBottom.mSolverVariable, this.mY);
return;
}
return;
}
}
for (int i7 = 0; i7 < this.mWidgetsCount; i7++) {
ConstraintWidget constraintWidget = this.mWidgets[i7];
if ((this.mAllowsGoneWidget || constraintWidget.allowedInBarrier()) && ((((i2 = this.mBarrierType) == 0 || i2 == 1) && constraintWidget.getHorizontalDimensionBehaviour() == ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT && constraintWidget.mLeft.mTarget != null && constraintWidget.mRight.mTarget != null) || (((i3 = this.mBarrierType) == 2 || i3 == 3) && constraintWidget.getVerticalDimensionBehaviour() == ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT && constraintWidget.mTop.mTarget != null && constraintWidget.mBottom.mTarget != null))) {
z2 = USE_RESOLUTION;
break;
}
}
z2 = false;
boolean z3 = (this.mLeft.hasCenteredDependents() || this.mRight.hasCenteredDependents()) ? USE_RESOLUTION : false;
boolean z4 = (this.mTop.hasCenteredDependents() || this.mBottom.hasCenteredDependents()) ? USE_RESOLUTION : false;
int i8 = !((z2 || (((i = this.mBarrierType) != 0 || !z3) && ((i != 2 || !z4) && ((i != 1 || !z3) && (i != 3 || !z4))))) ? false : USE_RESOLUTION) ? 4 : 5;
for (int i9 = 0; i9 < this.mWidgetsCount; i9++) {
ConstraintWidget constraintWidget2 = this.mWidgets[i9];
if (this.mAllowsGoneWidget || constraintWidget2.allowedInBarrier()) {
SolverVariable createObjectVariable = linearSystem.createObjectVariable(constraintWidget2.mListAnchors[this.mBarrierType]);
constraintWidget2.mListAnchors[this.mBarrierType].mSolverVariable = createObjectVariable;
int i10 = (constraintWidget2.mListAnchors[this.mBarrierType].mTarget == null || constraintWidget2.mListAnchors[this.mBarrierType].mTarget.mOwner != this) ? 0 : constraintWidget2.mListAnchors[this.mBarrierType].mMargin;
int i11 = this.mBarrierType;
if (i11 == 0 || i11 == 2) {
linearSystem.addLowerBarrier(constraintAnchor.mSolverVariable, createObjectVariable, this.mMargin - i10, z2);
} else {
linearSystem.addGreaterBarrier(constraintAnchor.mSolverVariable, createObjectVariable, this.mMargin + i10, z2);
}
linearSystem.addEquality(constraintAnchor.mSolverVariable, createObjectVariable, this.mMargin + i10, i8);
}
}
int i12 = this.mBarrierType;
if (i12 == 0) {
linearSystem.addEquality(this.mRight.mSolverVariable, this.mLeft.mSolverVariable, 0, 8);
linearSystem.addEquality(this.mLeft.mSolverVariable, this.mParent.mRight.mSolverVariable, 0, 4);
linearSystem.addEquality(this.mLeft.mSolverVariable, this.mParent.mLeft.mSolverVariable, 0, 0);
return;
}
if (i12 == 1) {
linearSystem.addEquality(this.mLeft.mSolverVariable, this.mRight.mSolverVariable, 0, 8);
linearSystem.addEquality(this.mLeft.mSolverVariable, this.mParent.mLeft.mSolverVariable, 0, 4);
linearSystem.addEquality(this.mLeft.mSolverVariable, this.mParent.mRight.mSolverVariable, 0, 0);
} else if (i12 == 2) {
linearSystem.addEquality(this.mBottom.mSolverVariable, this.mTop.mSolverVariable, 0, 8);
linearSystem.addEquality(this.mTop.mSolverVariable, this.mParent.mBottom.mSolverVariable, 0, 4);
linearSystem.addEquality(this.mTop.mSolverVariable, this.mParent.mTop.mSolverVariable, 0, 0);
} else if (i12 == 3) {
linearSystem.addEquality(this.mTop.mSolverVariable, this.mBottom.mSolverVariable, 0, 8);
linearSystem.addEquality(this.mTop.mSolverVariable, this.mParent.mTop.mSolverVariable, 0, 4);
linearSystem.addEquality(this.mTop.mSolverVariable, this.mParent.mBottom.mSolverVariable, 0, 0);
}
}
public boolean allSolved() {
int i;
int i2;
boolean z = USE_RESOLUTION;
for (int i3 = 0; i3 < this.mWidgetsCount; i3++) {
ConstraintWidget constraintWidget = this.mWidgets[i3];
if ((this.mAllowsGoneWidget || constraintWidget.allowedInBarrier()) && ((((i = this.mBarrierType) == 0 || i == 1) && !constraintWidget.isResolvedHorizontally()) || (((i2 = this.mBarrierType) == 2 || i2 == 3) && !constraintWidget.isResolvedVertically()))) {
z = false;
}
}
if (!z || this.mWidgetsCount <= 0) {
return false;
}
int i4 = 0;
boolean z2 = false;
for (int i5 = 0; i5 < this.mWidgetsCount; i5++) {
ConstraintWidget constraintWidget2 = this.mWidgets[i5];
if (this.mAllowsGoneWidget || constraintWidget2.allowedInBarrier()) {
if (!z2) {
int i6 = this.mBarrierType;
if (i6 == 0) {
i4 = constraintWidget2.getAnchor(ConstraintAnchor.Type.LEFT).getFinalValue();
} else if (i6 == 1) {
i4 = constraintWidget2.getAnchor(ConstraintAnchor.Type.RIGHT).getFinalValue();
} else if (i6 == 2) {
i4 = constraintWidget2.getAnchor(ConstraintAnchor.Type.TOP).getFinalValue();
} else if (i6 == 3) {
i4 = constraintWidget2.getAnchor(ConstraintAnchor.Type.BOTTOM).getFinalValue();
}
z2 = USE_RESOLUTION;
}
int i7 = this.mBarrierType;
if (i7 == 0) {
i4 = Math.min(i4, constraintWidget2.getAnchor(ConstraintAnchor.Type.LEFT).getFinalValue());
} else if (i7 == 1) {
i4 = Math.max(i4, constraintWidget2.getAnchor(ConstraintAnchor.Type.RIGHT).getFinalValue());
} else if (i7 == 2) {
i4 = Math.min(i4, constraintWidget2.getAnchor(ConstraintAnchor.Type.TOP).getFinalValue());
} else if (i7 == 3) {
i4 = Math.max(i4, constraintWidget2.getAnchor(ConstraintAnchor.Type.BOTTOM).getFinalValue());
}
}
}
int i8 = i4 + this.mMargin;
int i9 = this.mBarrierType;
if (i9 == 0 || i9 == 1) {
setFinalHorizontal(i8, i8);
} else {
setFinalVertical(i8, i8);
}
this.resolved = USE_RESOLUTION;
return USE_RESOLUTION;
}
}

View File

@ -0,0 +1,82 @@
package androidx.constraintlayout.core.widgets;
import androidx.constraintlayout.core.LinearSystem;
import java.util.ArrayList;
/* loaded from: classes.dex */
public class Chain {
private static final boolean DEBUG = false;
public static final boolean USE_CHAIN_OPTIMIZATION = false;
public static void applyChainConstraints(ConstraintWidgetContainer constraintWidgetContainer, LinearSystem linearSystem, ArrayList<ConstraintWidget> arrayList, int i) {
int i2;
ChainHead[] chainHeadArr;
int i3;
if (i == 0) {
i2 = constraintWidgetContainer.mHorizontalChainsSize;
chainHeadArr = constraintWidgetContainer.mHorizontalChainsArray;
i3 = 0;
} else {
i2 = constraintWidgetContainer.mVerticalChainsSize;
chainHeadArr = constraintWidgetContainer.mVerticalChainsArray;
i3 = 2;
}
for (int i4 = 0; i4 < i2; i4++) {
ChainHead chainHead = chainHeadArr[i4];
chainHead.define();
if (arrayList == null || (arrayList != null && arrayList.contains(chainHead.mFirst))) {
applyChainConstraints(constraintWidgetContainer, linearSystem, i, i3, chainHead);
}
}
}
/* JADX WARN: Code restructure failed: missing block: B:13:0x0037, code lost:
if (r2.mHorizontalChainStyle == 2) goto L29;
*/
/* JADX WARN: Code restructure failed: missing block: B:14:0x004e, code lost:
r5 = false;
*/
/* JADX WARN: Code restructure failed: missing block: B:320:0x004c, code lost:
r5 = true;
*/
/* JADX WARN: Code restructure failed: missing block: B:330:0x004a, code lost:
if (r2.mVerticalChainStyle == 2) goto L29;
*/
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Removed duplicated region for block: B:102:0x01f3 */
/* JADX WARN: Removed duplicated region for block: B:149:0x0528 */
/* JADX WARN: Removed duplicated region for block: B:152:0x0533 */
/* JADX WARN: Removed duplicated region for block: B:155:0x053e */
/* JADX WARN: Removed duplicated region for block: B:157:0x0547 */
/* JADX WARN: Removed duplicated region for block: B:162:0x055b */
/* JADX WARN: Removed duplicated region for block: B:169:0x0558 */
/* JADX WARN: Removed duplicated region for block: B:170:0x0543 */
/* JADX WARN: Removed duplicated region for block: B:171:0x0538 */
/* JADX WARN: Removed duplicated region for block: B:198:0x03dc */
/* JADX WARN: Removed duplicated region for block: B:201:0x03de A[SYNTHETIC] */
/* JADX WARN: Removed duplicated region for block: B:213:0x0383 */
/* JADX WARN: Removed duplicated region for block: B:254:0x03fc */
/* JADX WARN: Removed duplicated region for block: B:306:0x04db */
/* JADX WARN: Removed duplicated region for block: B:90:0x01b7 */
/* JADX WARN: Type inference failed for: r2v63, types: [androidx.constraintlayout.core.widgets.ConstraintWidget] */
/* JADX WARN: Type inference failed for: r8v39 */
/* JADX WARN: Type inference failed for: r8v40 */
/* JADX WARN: Type inference failed for: r8v46 */
/* JADX WARN: Type inference failed for: r8v5 */
/* JADX WARN: Type inference failed for: r8v6, types: [androidx.constraintlayout.core.widgets.ConstraintWidget] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
static void applyChainConstraints(androidx.constraintlayout.core.widgets.ConstraintWidgetContainer r38, androidx.constraintlayout.core.LinearSystem r39, int r40, int r41, androidx.constraintlayout.core.widgets.ChainHead r42) {
/*
Method dump skipped, instructions count: 1413
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.constraintlayout.core.widgets.Chain.applyChainConstraints(androidx.constraintlayout.core.widgets.ConstraintWidgetContainer, androidx.constraintlayout.core.LinearSystem, int, int, androidx.constraintlayout.core.widgets.ChainHead):void");
}
}

View File

@ -0,0 +1,184 @@
package androidx.constraintlayout.core.widgets;
import androidx.constraintlayout.core.widgets.ConstraintWidget;
import java.util.ArrayList;
/* loaded from: classes.dex */
public class ChainHead {
private boolean mDefined;
protected ConstraintWidget mFirst;
protected ConstraintWidget mFirstMatchConstraintWidget;
protected ConstraintWidget mFirstVisibleWidget;
protected boolean mHasComplexMatchWeights;
protected boolean mHasDefinedWeights;
protected boolean mHasRatio;
protected boolean mHasUndefinedWeights;
protected ConstraintWidget mHead;
private boolean mIsRtl;
protected ConstraintWidget mLast;
protected ConstraintWidget mLastMatchConstraintWidget;
protected ConstraintWidget mLastVisibleWidget;
boolean mOptimizable;
private int mOrientation;
int mTotalMargins;
int mTotalSize;
protected float mTotalWeight = 0.0f;
int mVisibleWidgets;
protected ArrayList<ConstraintWidget> mWeightedMatchConstraintsWidgets;
protected int mWidgetsCount;
protected int mWidgetsMatchCount;
public ConstraintWidget getFirst() {
return this.mFirst;
}
public ConstraintWidget getFirstMatchConstraintWidget() {
return this.mFirstMatchConstraintWidget;
}
public ConstraintWidget getFirstVisibleWidget() {
return this.mFirstVisibleWidget;
}
public ConstraintWidget getHead() {
return this.mHead;
}
public ConstraintWidget getLast() {
return this.mLast;
}
public ConstraintWidget getLastMatchConstraintWidget() {
return this.mLastMatchConstraintWidget;
}
public ConstraintWidget getLastVisibleWidget() {
return this.mLastVisibleWidget;
}
public float getTotalWeight() {
return this.mTotalWeight;
}
public ChainHead(ConstraintWidget constraintWidget, int i, boolean z) {
this.mFirst = constraintWidget;
this.mOrientation = i;
this.mIsRtl = z;
}
private static boolean isMatchConstraintEqualityCandidate(ConstraintWidget constraintWidget, int i) {
return constraintWidget.getVisibility() != 8 && constraintWidget.mListDimensionBehaviors[i] == ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT && (constraintWidget.mResolvedMatchConstraintDefault[i] == 0 || constraintWidget.mResolvedMatchConstraintDefault[i] == 3);
}
private void defineChainProperties() {
int i = this.mOrientation * 2;
ConstraintWidget constraintWidget = this.mFirst;
this.mOptimizable = true;
ConstraintWidget constraintWidget2 = constraintWidget;
boolean z = false;
while (!z) {
this.mWidgetsCount++;
ConstraintWidget constraintWidget3 = null;
constraintWidget.mNextChainWidget[this.mOrientation] = null;
constraintWidget.mListNextMatchConstraintsWidget[this.mOrientation] = null;
if (constraintWidget.getVisibility() != 8) {
this.mVisibleWidgets++;
if (constraintWidget.getDimensionBehaviour(this.mOrientation) != ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT) {
this.mTotalSize += constraintWidget.getLength(this.mOrientation);
}
int margin = this.mTotalSize + constraintWidget.mListAnchors[i].getMargin();
this.mTotalSize = margin;
int i2 = i + 1;
this.mTotalSize = margin + constraintWidget.mListAnchors[i2].getMargin();
int margin2 = this.mTotalMargins + constraintWidget.mListAnchors[i].getMargin();
this.mTotalMargins = margin2;
this.mTotalMargins = margin2 + constraintWidget.mListAnchors[i2].getMargin();
if (this.mFirstVisibleWidget == null) {
this.mFirstVisibleWidget = constraintWidget;
}
this.mLastVisibleWidget = constraintWidget;
if (constraintWidget.mListDimensionBehaviors[this.mOrientation] == ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT) {
if (constraintWidget.mResolvedMatchConstraintDefault[this.mOrientation] == 0 || constraintWidget.mResolvedMatchConstraintDefault[this.mOrientation] == 3 || constraintWidget.mResolvedMatchConstraintDefault[this.mOrientation] == 2) {
this.mWidgetsMatchCount++;
float f = constraintWidget.mWeight[this.mOrientation];
if (f > 0.0f) {
this.mTotalWeight += constraintWidget.mWeight[this.mOrientation];
}
if (isMatchConstraintEqualityCandidate(constraintWidget, this.mOrientation)) {
if (f < 0.0f) {
this.mHasUndefinedWeights = true;
} else {
this.mHasDefinedWeights = true;
}
if (this.mWeightedMatchConstraintsWidgets == null) {
this.mWeightedMatchConstraintsWidgets = new ArrayList<>();
}
this.mWeightedMatchConstraintsWidgets.add(constraintWidget);
}
if (this.mFirstMatchConstraintWidget == null) {
this.mFirstMatchConstraintWidget = constraintWidget;
}
ConstraintWidget constraintWidget4 = this.mLastMatchConstraintWidget;
if (constraintWidget4 != null) {
constraintWidget4.mListNextMatchConstraintsWidget[this.mOrientation] = constraintWidget;
}
this.mLastMatchConstraintWidget = constraintWidget;
}
if (this.mOrientation == 0) {
if (constraintWidget.mMatchConstraintDefaultWidth != 0) {
this.mOptimizable = false;
} else if (constraintWidget.mMatchConstraintMinWidth != 0 || constraintWidget.mMatchConstraintMaxWidth != 0) {
this.mOptimizable = false;
}
} else if (constraintWidget.mMatchConstraintDefaultHeight != 0) {
this.mOptimizable = false;
} else if (constraintWidget.mMatchConstraintMinHeight != 0 || constraintWidget.mMatchConstraintMaxHeight != 0) {
this.mOptimizable = false;
}
if (constraintWidget.mDimensionRatio != 0.0f) {
this.mOptimizable = false;
this.mHasRatio = true;
}
}
}
if (constraintWidget2 != constraintWidget) {
constraintWidget2.mNextChainWidget[this.mOrientation] = constraintWidget;
}
ConstraintAnchor constraintAnchor = constraintWidget.mListAnchors[i + 1].mTarget;
if (constraintAnchor != null) {
ConstraintWidget constraintWidget5 = constraintAnchor.mOwner;
if (constraintWidget5.mListAnchors[i].mTarget != null && constraintWidget5.mListAnchors[i].mTarget.mOwner == constraintWidget) {
constraintWidget3 = constraintWidget5;
}
}
if (constraintWidget3 == null) {
constraintWidget3 = constraintWidget;
z = true;
}
constraintWidget2 = constraintWidget;
constraintWidget = constraintWidget3;
}
ConstraintWidget constraintWidget6 = this.mFirstVisibleWidget;
if (constraintWidget6 != null) {
this.mTotalSize -= constraintWidget6.mListAnchors[i].getMargin();
}
ConstraintWidget constraintWidget7 = this.mLastVisibleWidget;
if (constraintWidget7 != null) {
this.mTotalSize -= constraintWidget7.mListAnchors[i + 1].getMargin();
}
this.mLast = constraintWidget;
if (this.mOrientation == 0 && this.mIsRtl) {
this.mHead = constraintWidget;
} else {
this.mHead = this.mFirst;
}
this.mHasComplexMatchWeights = this.mHasDefinedWeights && this.mHasUndefinedWeights;
}
public void define() {
if (!this.mDefined) {
defineChainProperties();
}
this.mDefined = true;
}
}

View File

@ -0,0 +1,409 @@
package androidx.constraintlayout.core.widgets;
import androidx.constraintlayout.core.Cache;
import androidx.constraintlayout.core.SolverVariable;
import androidx.constraintlayout.core.widgets.analyzer.Grouping;
import androidx.constraintlayout.core.widgets.analyzer.WidgetGroup;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
/* loaded from: classes.dex */
public class ConstraintAnchor {
private static final boolean ALLOW_BINARY = false;
private static final int UNSET_GONE_MARGIN = Integer.MIN_VALUE;
private int mFinalValue;
private boolean mHasFinalValue;
public final ConstraintWidget mOwner;
SolverVariable mSolverVariable;
public ConstraintAnchor mTarget;
public final Type mType;
private HashSet<ConstraintAnchor> mDependents = null;
public int mMargin = 0;
int mGoneMargin = Integer.MIN_VALUE;
public enum Type {
NONE,
LEFT,
TOP,
RIGHT,
BOTTOM,
BASELINE,
CENTER,
CENTER_X,
CENTER_Y
}
public HashSet<ConstraintAnchor> getDependents() {
return this.mDependents;
}
public int getFinalValue() {
if (this.mHasFinalValue) {
return this.mFinalValue;
}
return 0;
}
public ConstraintWidget getOwner() {
return this.mOwner;
}
public SolverVariable getSolverVariable() {
return this.mSolverVariable;
}
public ConstraintAnchor getTarget() {
return this.mTarget;
}
public Type getType() {
return this.mType;
}
public boolean hasFinalValue() {
return this.mHasFinalValue;
}
public boolean isConnected() {
return this.mTarget != null;
}
public void resetFinalResolution() {
this.mHasFinalValue = false;
this.mFinalValue = 0;
}
public void setFinalValue(int i) {
this.mFinalValue = i;
this.mHasFinalValue = true;
}
public void findDependents(int i, ArrayList<WidgetGroup> arrayList, WidgetGroup widgetGroup) {
HashSet<ConstraintAnchor> hashSet = this.mDependents;
if (hashSet != null) {
Iterator<ConstraintAnchor> it = hashSet.iterator();
while (it.hasNext()) {
Grouping.findDependents(it.next().mOwner, i, arrayList, widgetGroup);
}
}
}
public boolean hasDependents() {
HashSet<ConstraintAnchor> hashSet = this.mDependents;
return hashSet != null && hashSet.size() > 0;
}
public boolean hasCenteredDependents() {
HashSet<ConstraintAnchor> hashSet = this.mDependents;
if (hashSet == null) {
return false;
}
Iterator<ConstraintAnchor> it = hashSet.iterator();
while (it.hasNext()) {
if (it.next().getOpposite().isConnected()) {
return true;
}
}
return false;
}
public void copyFrom(ConstraintAnchor constraintAnchor, HashMap<ConstraintWidget, ConstraintWidget> hashMap) {
HashSet<ConstraintAnchor> hashSet;
ConstraintAnchor constraintAnchor2 = this.mTarget;
if (constraintAnchor2 != null && (hashSet = constraintAnchor2.mDependents) != null) {
hashSet.remove(this);
}
ConstraintAnchor constraintAnchor3 = constraintAnchor.mTarget;
if (constraintAnchor3 != null) {
this.mTarget = hashMap.get(constraintAnchor.mTarget.mOwner).getAnchor(constraintAnchor3.getType());
} else {
this.mTarget = null;
}
ConstraintAnchor constraintAnchor4 = this.mTarget;
if (constraintAnchor4 != null) {
if (constraintAnchor4.mDependents == null) {
constraintAnchor4.mDependents = new HashSet<>();
}
this.mTarget.mDependents.add(this);
}
this.mMargin = constraintAnchor.mMargin;
this.mGoneMargin = constraintAnchor.mGoneMargin;
}
public ConstraintAnchor(ConstraintWidget constraintWidget, Type type) {
this.mOwner = constraintWidget;
this.mType = type;
}
public void resetSolverVariable(Cache cache) {
SolverVariable solverVariable = this.mSolverVariable;
if (solverVariable == null) {
this.mSolverVariable = new SolverVariable(SolverVariable.Type.UNRESTRICTED, (String) null);
} else {
solverVariable.reset();
}
}
public int getMargin() {
ConstraintAnchor constraintAnchor;
if (this.mOwner.getVisibility() == 8) {
return 0;
}
return (this.mGoneMargin == Integer.MIN_VALUE || (constraintAnchor = this.mTarget) == null || constraintAnchor.mOwner.getVisibility() != 8) ? this.mMargin : this.mGoneMargin;
}
public void reset() {
HashSet<ConstraintAnchor> hashSet;
ConstraintAnchor constraintAnchor = this.mTarget;
if (constraintAnchor != null && (hashSet = constraintAnchor.mDependents) != null) {
hashSet.remove(this);
if (this.mTarget.mDependents.size() == 0) {
this.mTarget.mDependents = null;
}
}
this.mDependents = null;
this.mTarget = null;
this.mMargin = 0;
this.mGoneMargin = Integer.MIN_VALUE;
this.mHasFinalValue = false;
this.mFinalValue = 0;
}
public boolean connect(ConstraintAnchor constraintAnchor, int i, int i2, boolean z) {
if (constraintAnchor == null) {
reset();
return true;
}
if (!z && !isValidConnection(constraintAnchor)) {
return false;
}
this.mTarget = constraintAnchor;
if (constraintAnchor.mDependents == null) {
constraintAnchor.mDependents = new HashSet<>();
}
HashSet<ConstraintAnchor> hashSet = this.mTarget.mDependents;
if (hashSet != null) {
hashSet.add(this);
}
this.mMargin = i;
this.mGoneMargin = i2;
return true;
}
public boolean connect(ConstraintAnchor constraintAnchor, int i) {
return connect(constraintAnchor, i, Integer.MIN_VALUE, false);
}
public boolean isValidConnection(ConstraintAnchor constraintAnchor) {
if (constraintAnchor == null) {
return false;
}
Type type = constraintAnchor.getType();
Type type2 = this.mType;
if (type == type2) {
return type2 != Type.BASELINE || (constraintAnchor.getOwner().hasBaseline() && getOwner().hasBaseline());
}
switch (AnonymousClass1.$SwitchMap$androidx$constraintlayout$core$widgets$ConstraintAnchor$Type[this.mType.ordinal()]) {
case 1:
return (type == Type.BASELINE || type == Type.CENTER_X || type == Type.CENTER_Y) ? false : true;
case 2:
case 3:
boolean z = type == Type.LEFT || type == Type.RIGHT;
if (constraintAnchor.getOwner() instanceof Guideline) {
return z || type == Type.CENTER_X;
}
return z;
case 4:
case 5:
boolean z2 = type == Type.TOP || type == Type.BOTTOM;
if (constraintAnchor.getOwner() instanceof Guideline) {
return z2 || type == Type.CENTER_Y;
}
return z2;
case 6:
return (type == Type.LEFT || type == Type.RIGHT) ? false : true;
case 7:
case 8:
case 9:
return false;
default:
throw new AssertionError(this.mType.name());
}
}
/* renamed from: androidx.constraintlayout.core.widgets.ConstraintAnchor$1, reason: invalid class name */
static /* synthetic */ class AnonymousClass1 {
static final /* synthetic */ int[] $SwitchMap$androidx$constraintlayout$core$widgets$ConstraintAnchor$Type;
static {
int[] iArr = new int[Type.values().length];
$SwitchMap$androidx$constraintlayout$core$widgets$ConstraintAnchor$Type = iArr;
try {
iArr[Type.CENTER.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
$SwitchMap$androidx$constraintlayout$core$widgets$ConstraintAnchor$Type[Type.LEFT.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
$SwitchMap$androidx$constraintlayout$core$widgets$ConstraintAnchor$Type[Type.RIGHT.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
$SwitchMap$androidx$constraintlayout$core$widgets$ConstraintAnchor$Type[Type.TOP.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
try {
$SwitchMap$androidx$constraintlayout$core$widgets$ConstraintAnchor$Type[Type.BOTTOM.ordinal()] = 5;
} catch (NoSuchFieldError unused5) {
}
try {
$SwitchMap$androidx$constraintlayout$core$widgets$ConstraintAnchor$Type[Type.BASELINE.ordinal()] = 6;
} catch (NoSuchFieldError unused6) {
}
try {
$SwitchMap$androidx$constraintlayout$core$widgets$ConstraintAnchor$Type[Type.CENTER_X.ordinal()] = 7;
} catch (NoSuchFieldError unused7) {
}
try {
$SwitchMap$androidx$constraintlayout$core$widgets$ConstraintAnchor$Type[Type.CENTER_Y.ordinal()] = 8;
} catch (NoSuchFieldError unused8) {
}
try {
$SwitchMap$androidx$constraintlayout$core$widgets$ConstraintAnchor$Type[Type.NONE.ordinal()] = 9;
} catch (NoSuchFieldError unused9) {
}
}
}
public boolean isSideAnchor() {
switch (AnonymousClass1.$SwitchMap$androidx$constraintlayout$core$widgets$ConstraintAnchor$Type[this.mType.ordinal()]) {
case 1:
case 6:
case 7:
case 8:
case 9:
return false;
case 2:
case 3:
case 4:
case 5:
return true;
default:
throw new AssertionError(this.mType.name());
}
}
public boolean isSimilarDimensionConnection(ConstraintAnchor constraintAnchor) {
Type type = constraintAnchor.getType();
if (type == this.mType) {
return true;
}
switch (AnonymousClass1.$SwitchMap$androidx$constraintlayout$core$widgets$ConstraintAnchor$Type[this.mType.ordinal()]) {
case 1:
return type != Type.BASELINE;
case 2:
case 3:
case 7:
return type == Type.LEFT || type == Type.RIGHT || type == Type.CENTER_X;
case 4:
case 5:
case 6:
case 8:
return type == Type.TOP || type == Type.BOTTOM || type == Type.CENTER_Y || type == Type.BASELINE;
case 9:
return false;
default:
throw new AssertionError(this.mType.name());
}
}
public void setMargin(int i) {
if (isConnected()) {
this.mMargin = i;
}
}
public void setGoneMargin(int i) {
if (isConnected()) {
this.mGoneMargin = i;
}
}
public boolean isVerticalAnchor() {
switch (AnonymousClass1.$SwitchMap$androidx$constraintlayout$core$widgets$ConstraintAnchor$Type[this.mType.ordinal()]) {
case 1:
case 2:
case 3:
case 7:
return false;
case 4:
case 5:
case 6:
case 8:
case 9:
return true;
default:
throw new AssertionError(this.mType.name());
}
}
public String toString() {
return this.mOwner.getDebugName() + ":" + this.mType.toString();
}
public boolean isConnectionAllowed(ConstraintWidget constraintWidget, ConstraintAnchor constraintAnchor) {
return isConnectionAllowed(constraintWidget);
}
public boolean isConnectionAllowed(ConstraintWidget constraintWidget) {
if (isConnectionToMe(constraintWidget, new HashSet<>())) {
return false;
}
ConstraintWidget parent = getOwner().getParent();
return parent == constraintWidget || constraintWidget.getParent() == parent;
}
private boolean isConnectionToMe(ConstraintWidget constraintWidget, HashSet<ConstraintWidget> hashSet) {
if (hashSet.contains(constraintWidget)) {
return false;
}
hashSet.add(constraintWidget);
if (constraintWidget == getOwner()) {
return true;
}
ArrayList<ConstraintAnchor> anchors = constraintWidget.getAnchors();
int size = anchors.size();
for (int i = 0; i < size; i++) {
ConstraintAnchor constraintAnchor = anchors.get(i);
if (constraintAnchor.isSimilarDimensionConnection(this) && constraintAnchor.isConnected() && isConnectionToMe(constraintAnchor.getTarget().getOwner(), hashSet)) {
return true;
}
}
return false;
}
public final ConstraintAnchor getOpposite() {
switch (AnonymousClass1.$SwitchMap$androidx$constraintlayout$core$widgets$ConstraintAnchor$Type[this.mType.ordinal()]) {
case 1:
case 6:
case 7:
case 8:
case 9:
return null;
case 2:
return this.mOwner.mRight;
case 3:
return this.mOwner.mLeft;
case 4:
return this.mOwner.mBottom;
case 5:
return this.mOwner.mTop;
default:
throw new AssertionError(this.mType.name());
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,631 @@
package androidx.constraintlayout.core.widgets;
import androidx.constraintlayout.core.LinearSystem;
import androidx.constraintlayout.core.Metrics;
import androidx.constraintlayout.core.SolverVariable;
import androidx.constraintlayout.core.widgets.ConstraintWidget;
import androidx.constraintlayout.core.widgets.analyzer.BasicMeasure;
import androidx.constraintlayout.core.widgets.analyzer.DependencyGraph;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
/* loaded from: classes.dex */
public class ConstraintWidgetContainer extends WidgetContainer {
private static final boolean DEBUG = false;
static final boolean DEBUG_GRAPH = false;
private static final boolean DEBUG_LAYOUT = false;
private static final int MAX_ITERATIONS = 8;
static int myCounter;
private WeakReference<ConstraintAnchor> horizontalWrapMax;
private WeakReference<ConstraintAnchor> horizontalWrapMin;
BasicMeasure mBasicMeasureSolver;
int mDebugSolverPassCount;
public DependencyGraph mDependencyGraph;
public boolean mGroupsWrapOptimized;
private boolean mHeightMeasuredTooSmall;
ChainHead[] mHorizontalChainsArray;
public int mHorizontalChainsSize;
public boolean mHorizontalWrapOptimized;
private boolean mIsRtl;
public BasicMeasure.Measure mMeasure;
protected BasicMeasure.Measurer mMeasurer;
public Metrics mMetrics;
private int mOptimizationLevel;
int mPaddingBottom;
int mPaddingLeft;
int mPaddingRight;
int mPaddingTop;
public boolean mSkipSolver;
protected LinearSystem mSystem;
ChainHead[] mVerticalChainsArray;
public int mVerticalChainsSize;
public boolean mVerticalWrapOptimized;
private boolean mWidthMeasuredTooSmall;
public int mWrapFixedHeight;
public int mWrapFixedWidth;
private int pass;
private WeakReference<ConstraintAnchor> verticalWrapMax;
private WeakReference<ConstraintAnchor> verticalWrapMin;
HashSet<ConstraintWidget> widgetsToAdd;
private void resetChains() {
this.mHorizontalChainsSize = 0;
this.mVerticalChainsSize = 0;
}
public BasicMeasure.Measurer getMeasurer() {
return this.mMeasurer;
}
public int getOptimizationLevel() {
return this.mOptimizationLevel;
}
public LinearSystem getSystem() {
return this.mSystem;
}
@Override // androidx.constraintlayout.core.widgets.ConstraintWidget
public String getType() {
return "ConstraintLayout";
}
public boolean handlesInternalConstraints() {
return false;
}
public boolean isHeightMeasuredTooSmall() {
return this.mHeightMeasuredTooSmall;
}
public boolean isRtl() {
return this.mIsRtl;
}
public boolean isWidthMeasuredTooSmall() {
return this.mWidthMeasuredTooSmall;
}
public boolean optimizeFor(int i) {
return (this.mOptimizationLevel & i) == i;
}
public void setPadding(int i, int i2, int i3, int i4) {
this.mPaddingLeft = i;
this.mPaddingTop = i2;
this.mPaddingRight = i3;
this.mPaddingBottom = i4;
}
public void setPass(int i) {
this.pass = i;
}
public void setRtl(boolean z) {
this.mIsRtl = z;
}
public void invalidateGraph() {
this.mDependencyGraph.invalidateGraph();
}
public void invalidateMeasures() {
this.mDependencyGraph.invalidateMeasures();
}
public boolean directMeasure(boolean z) {
return this.mDependencyGraph.directMeasure(z);
}
public boolean directMeasureSetup(boolean z) {
return this.mDependencyGraph.directMeasureSetup(z);
}
public boolean directMeasureWithOrientation(boolean z, int i) {
return this.mDependencyGraph.directMeasureWithOrientation(z, i);
}
public void defineTerminalWidgets() {
this.mDependencyGraph.defineTerminalWidgets(getHorizontalDimensionBehaviour(), getVerticalDimensionBehaviour());
}
public long measure(int i, int i2, int i3, int i4, int i5, int i6, int i7, int i8, int i9) {
this.mPaddingLeft = i8;
this.mPaddingTop = i9;
return this.mBasicMeasureSolver.solverMeasure(this, i, i8, i9, i2, i3, i4, i5, i6, i7);
}
public void updateHierarchy() {
this.mBasicMeasureSolver.updateHierarchy(this);
}
public void setMeasurer(BasicMeasure.Measurer measurer) {
this.mMeasurer = measurer;
this.mDependencyGraph.setMeasurer(measurer);
}
public void fillMetrics(Metrics metrics) {
this.mMetrics = metrics;
this.mSystem.fillMetrics(metrics);
}
public ConstraintWidgetContainer() {
this.mBasicMeasureSolver = new BasicMeasure(this);
this.mDependencyGraph = new DependencyGraph(this);
this.mMeasurer = null;
this.mIsRtl = false;
this.mSystem = new LinearSystem();
this.mHorizontalChainsSize = 0;
this.mVerticalChainsSize = 0;
this.mVerticalChainsArray = new ChainHead[4];
this.mHorizontalChainsArray = new ChainHead[4];
this.mGroupsWrapOptimized = false;
this.mHorizontalWrapOptimized = false;
this.mVerticalWrapOptimized = false;
this.mWrapFixedWidth = 0;
this.mWrapFixedHeight = 0;
this.mOptimizationLevel = 257;
this.mSkipSolver = false;
this.mWidthMeasuredTooSmall = false;
this.mHeightMeasuredTooSmall = false;
this.mDebugSolverPassCount = 0;
this.verticalWrapMin = null;
this.horizontalWrapMin = null;
this.verticalWrapMax = null;
this.horizontalWrapMax = null;
this.widgetsToAdd = new HashSet<>();
this.mMeasure = new BasicMeasure.Measure();
}
public ConstraintWidgetContainer(int i, int i2, int i3, int i4) {
super(i, i2, i3, i4);
this.mBasicMeasureSolver = new BasicMeasure(this);
this.mDependencyGraph = new DependencyGraph(this);
this.mMeasurer = null;
this.mIsRtl = false;
this.mSystem = new LinearSystem();
this.mHorizontalChainsSize = 0;
this.mVerticalChainsSize = 0;
this.mVerticalChainsArray = new ChainHead[4];
this.mHorizontalChainsArray = new ChainHead[4];
this.mGroupsWrapOptimized = false;
this.mHorizontalWrapOptimized = false;
this.mVerticalWrapOptimized = false;
this.mWrapFixedWidth = 0;
this.mWrapFixedHeight = 0;
this.mOptimizationLevel = 257;
this.mSkipSolver = false;
this.mWidthMeasuredTooSmall = false;
this.mHeightMeasuredTooSmall = false;
this.mDebugSolverPassCount = 0;
this.verticalWrapMin = null;
this.horizontalWrapMin = null;
this.verticalWrapMax = null;
this.horizontalWrapMax = null;
this.widgetsToAdd = new HashSet<>();
this.mMeasure = new BasicMeasure.Measure();
}
public ConstraintWidgetContainer(int i, int i2) {
super(i, i2);
this.mBasicMeasureSolver = new BasicMeasure(this);
this.mDependencyGraph = new DependencyGraph(this);
this.mMeasurer = null;
this.mIsRtl = false;
this.mSystem = new LinearSystem();
this.mHorizontalChainsSize = 0;
this.mVerticalChainsSize = 0;
this.mVerticalChainsArray = new ChainHead[4];
this.mHorizontalChainsArray = new ChainHead[4];
this.mGroupsWrapOptimized = false;
this.mHorizontalWrapOptimized = false;
this.mVerticalWrapOptimized = false;
this.mWrapFixedWidth = 0;
this.mWrapFixedHeight = 0;
this.mOptimizationLevel = 257;
this.mSkipSolver = false;
this.mWidthMeasuredTooSmall = false;
this.mHeightMeasuredTooSmall = false;
this.mDebugSolverPassCount = 0;
this.verticalWrapMin = null;
this.horizontalWrapMin = null;
this.verticalWrapMax = null;
this.horizontalWrapMax = null;
this.widgetsToAdd = new HashSet<>();
this.mMeasure = new BasicMeasure.Measure();
}
public ConstraintWidgetContainer(String str, int i, int i2) {
super(i, i2);
this.mBasicMeasureSolver = new BasicMeasure(this);
this.mDependencyGraph = new DependencyGraph(this);
this.mMeasurer = null;
this.mIsRtl = false;
this.mSystem = new LinearSystem();
this.mHorizontalChainsSize = 0;
this.mVerticalChainsSize = 0;
this.mVerticalChainsArray = new ChainHead[4];
this.mHorizontalChainsArray = new ChainHead[4];
this.mGroupsWrapOptimized = false;
this.mHorizontalWrapOptimized = false;
this.mVerticalWrapOptimized = false;
this.mWrapFixedWidth = 0;
this.mWrapFixedHeight = 0;
this.mOptimizationLevel = 257;
this.mSkipSolver = false;
this.mWidthMeasuredTooSmall = false;
this.mHeightMeasuredTooSmall = false;
this.mDebugSolverPassCount = 0;
this.verticalWrapMin = null;
this.horizontalWrapMin = null;
this.verticalWrapMax = null;
this.horizontalWrapMax = null;
this.widgetsToAdd = new HashSet<>();
this.mMeasure = new BasicMeasure.Measure();
setDebugName(str);
}
public void setOptimizationLevel(int i) {
this.mOptimizationLevel = i;
LinearSystem.USE_DEPENDENCY_ORDERING = optimizeFor(512);
}
@Override // androidx.constraintlayout.core.widgets.WidgetContainer, androidx.constraintlayout.core.widgets.ConstraintWidget
public void reset() {
this.mSystem.reset();
this.mPaddingLeft = 0;
this.mPaddingRight = 0;
this.mPaddingTop = 0;
this.mPaddingBottom = 0;
this.mSkipSolver = false;
super.reset();
}
void addVerticalWrapMinVariable(ConstraintAnchor constraintAnchor) {
WeakReference<ConstraintAnchor> weakReference = this.verticalWrapMin;
if (weakReference == null || weakReference.get() == null || constraintAnchor.getFinalValue() > this.verticalWrapMin.get().getFinalValue()) {
this.verticalWrapMin = new WeakReference<>(constraintAnchor);
}
}
public void addHorizontalWrapMinVariable(ConstraintAnchor constraintAnchor) {
WeakReference<ConstraintAnchor> weakReference = this.horizontalWrapMin;
if (weakReference == null || weakReference.get() == null || constraintAnchor.getFinalValue() > this.horizontalWrapMin.get().getFinalValue()) {
this.horizontalWrapMin = new WeakReference<>(constraintAnchor);
}
}
void addVerticalWrapMaxVariable(ConstraintAnchor constraintAnchor) {
WeakReference<ConstraintAnchor> weakReference = this.verticalWrapMax;
if (weakReference == null || weakReference.get() == null || constraintAnchor.getFinalValue() > this.verticalWrapMax.get().getFinalValue()) {
this.verticalWrapMax = new WeakReference<>(constraintAnchor);
}
}
public void addHorizontalWrapMaxVariable(ConstraintAnchor constraintAnchor) {
WeakReference<ConstraintAnchor> weakReference = this.horizontalWrapMax;
if (weakReference == null || weakReference.get() == null || constraintAnchor.getFinalValue() > this.horizontalWrapMax.get().getFinalValue()) {
this.horizontalWrapMax = new WeakReference<>(constraintAnchor);
}
}
private void addMinWrap(ConstraintAnchor constraintAnchor, SolverVariable solverVariable) {
this.mSystem.addGreaterThan(this.mSystem.createObjectVariable(constraintAnchor), solverVariable, 0, 5);
}
private void addMaxWrap(ConstraintAnchor constraintAnchor, SolverVariable solverVariable) {
this.mSystem.addGreaterThan(solverVariable, this.mSystem.createObjectVariable(constraintAnchor), 0, 5);
}
public boolean addChildrenToSolver(LinearSystem linearSystem) {
boolean optimizeFor = optimizeFor(64);
addToSolver(linearSystem, optimizeFor);
int size = this.mChildren.size();
boolean z = false;
for (int i = 0; i < size; i++) {
ConstraintWidget constraintWidget = this.mChildren.get(i);
constraintWidget.setInBarrier(0, false);
constraintWidget.setInBarrier(1, false);
if (constraintWidget instanceof Barrier) {
z = true;
}
}
if (z) {
for (int i2 = 0; i2 < size; i2++) {
ConstraintWidget constraintWidget2 = this.mChildren.get(i2);
if (constraintWidget2 instanceof Barrier) {
((Barrier) constraintWidget2).markWidgets();
}
}
}
this.widgetsToAdd.clear();
for (int i3 = 0; i3 < size; i3++) {
ConstraintWidget constraintWidget3 = this.mChildren.get(i3);
if (constraintWidget3.addFirst()) {
if (constraintWidget3 instanceof VirtualLayout) {
this.widgetsToAdd.add(constraintWidget3);
} else {
constraintWidget3.addToSolver(linearSystem, optimizeFor);
}
}
}
while (this.widgetsToAdd.size() > 0) {
int size2 = this.widgetsToAdd.size();
Iterator<ConstraintWidget> it = this.widgetsToAdd.iterator();
while (true) {
if (!it.hasNext()) {
break;
}
VirtualLayout virtualLayout = (VirtualLayout) it.next();
if (virtualLayout.contains(this.widgetsToAdd)) {
virtualLayout.addToSolver(linearSystem, optimizeFor);
this.widgetsToAdd.remove(virtualLayout);
break;
}
}
if (size2 == this.widgetsToAdd.size()) {
Iterator<ConstraintWidget> it2 = this.widgetsToAdd.iterator();
while (it2.hasNext()) {
it2.next().addToSolver(linearSystem, optimizeFor);
}
this.widgetsToAdd.clear();
}
}
if (LinearSystem.USE_DEPENDENCY_ORDERING) {
HashSet<ConstraintWidget> hashSet = new HashSet<>();
for (int i4 = 0; i4 < size; i4++) {
ConstraintWidget constraintWidget4 = this.mChildren.get(i4);
if (!constraintWidget4.addFirst()) {
hashSet.add(constraintWidget4);
}
}
addChildrenToSolverByDependency(this, linearSystem, hashSet, getHorizontalDimensionBehaviour() == ConstraintWidget.DimensionBehaviour.WRAP_CONTENT ? 0 : 1, false);
Iterator<ConstraintWidget> it3 = hashSet.iterator();
while (it3.hasNext()) {
ConstraintWidget next = it3.next();
Optimizer.checkMatchParent(this, linearSystem, next);
next.addToSolver(linearSystem, optimizeFor);
}
} else {
for (int i5 = 0; i5 < size; i5++) {
ConstraintWidget constraintWidget5 = this.mChildren.get(i5);
if (constraintWidget5 instanceof ConstraintWidgetContainer) {
ConstraintWidget.DimensionBehaviour dimensionBehaviour = constraintWidget5.mListDimensionBehaviors[0];
ConstraintWidget.DimensionBehaviour dimensionBehaviour2 = constraintWidget5.mListDimensionBehaviors[1];
if (dimensionBehaviour == ConstraintWidget.DimensionBehaviour.WRAP_CONTENT) {
constraintWidget5.setHorizontalDimensionBehaviour(ConstraintWidget.DimensionBehaviour.FIXED);
}
if (dimensionBehaviour2 == ConstraintWidget.DimensionBehaviour.WRAP_CONTENT) {
constraintWidget5.setVerticalDimensionBehaviour(ConstraintWidget.DimensionBehaviour.FIXED);
}
constraintWidget5.addToSolver(linearSystem, optimizeFor);
if (dimensionBehaviour == ConstraintWidget.DimensionBehaviour.WRAP_CONTENT) {
constraintWidget5.setHorizontalDimensionBehaviour(dimensionBehaviour);
}
if (dimensionBehaviour2 == ConstraintWidget.DimensionBehaviour.WRAP_CONTENT) {
constraintWidget5.setVerticalDimensionBehaviour(dimensionBehaviour2);
}
} else {
Optimizer.checkMatchParent(this, linearSystem, constraintWidget5);
if (!constraintWidget5.addFirst()) {
constraintWidget5.addToSolver(linearSystem, optimizeFor);
}
}
}
}
if (this.mHorizontalChainsSize > 0) {
Chain.applyChainConstraints(this, linearSystem, null, 0);
}
if (this.mVerticalChainsSize > 0) {
Chain.applyChainConstraints(this, linearSystem, null, 1);
}
return true;
}
public boolean updateChildrenFromSolver(LinearSystem linearSystem, boolean[] zArr) {
zArr[2] = false;
boolean optimizeFor = optimizeFor(64);
updateFromSolver(linearSystem, optimizeFor);
int size = this.mChildren.size();
boolean z = false;
for (int i = 0; i < size; i++) {
ConstraintWidget constraintWidget = this.mChildren.get(i);
constraintWidget.updateFromSolver(linearSystem, optimizeFor);
if (constraintWidget.hasDimensionOverride()) {
z = true;
}
}
return z;
}
@Override // androidx.constraintlayout.core.widgets.ConstraintWidget
public void updateFromRuns(boolean z, boolean z2) {
super.updateFromRuns(z, z2);
int size = this.mChildren.size();
for (int i = 0; i < size; i++) {
this.mChildren.get(i).updateFromRuns(z, z2);
}
}
public static boolean measure(int i, ConstraintWidget constraintWidget, BasicMeasure.Measurer measurer, BasicMeasure.Measure measure, int i2) {
int i3;
int i4;
if (measurer == null) {
return false;
}
if (constraintWidget.getVisibility() == 8 || (constraintWidget instanceof Guideline) || (constraintWidget instanceof Barrier)) {
measure.measuredWidth = 0;
measure.measuredHeight = 0;
return false;
}
measure.horizontalBehavior = constraintWidget.getHorizontalDimensionBehaviour();
measure.verticalBehavior = constraintWidget.getVerticalDimensionBehaviour();
measure.horizontalDimension = constraintWidget.getWidth();
measure.verticalDimension = constraintWidget.getHeight();
measure.measuredNeedsSolverPass = false;
measure.measureStrategy = i2;
boolean z = measure.horizontalBehavior == ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT;
boolean z2 = measure.verticalBehavior == ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT;
boolean z3 = z && constraintWidget.mDimensionRatio > 0.0f;
boolean z4 = z2 && constraintWidget.mDimensionRatio > 0.0f;
if (z && constraintWidget.hasDanglingDimension(0) && constraintWidget.mMatchConstraintDefaultWidth == 0 && !z3) {
measure.horizontalBehavior = ConstraintWidget.DimensionBehaviour.WRAP_CONTENT;
if (z2 && constraintWidget.mMatchConstraintDefaultHeight == 0) {
measure.horizontalBehavior = ConstraintWidget.DimensionBehaviour.FIXED;
}
z = false;
}
if (z2 && constraintWidget.hasDanglingDimension(1) && constraintWidget.mMatchConstraintDefaultHeight == 0 && !z4) {
measure.verticalBehavior = ConstraintWidget.DimensionBehaviour.WRAP_CONTENT;
if (z && constraintWidget.mMatchConstraintDefaultWidth == 0) {
measure.verticalBehavior = ConstraintWidget.DimensionBehaviour.FIXED;
}
z2 = false;
}
if (constraintWidget.isResolvedHorizontally()) {
measure.horizontalBehavior = ConstraintWidget.DimensionBehaviour.FIXED;
z = false;
}
if (constraintWidget.isResolvedVertically()) {
measure.verticalBehavior = ConstraintWidget.DimensionBehaviour.FIXED;
z2 = false;
}
if (z3) {
if (constraintWidget.mResolvedMatchConstraintDefault[0] == 4) {
measure.horizontalBehavior = ConstraintWidget.DimensionBehaviour.FIXED;
} else if (!z2) {
if (measure.verticalBehavior == ConstraintWidget.DimensionBehaviour.FIXED) {
i4 = measure.verticalDimension;
} else {
measure.horizontalBehavior = ConstraintWidget.DimensionBehaviour.WRAP_CONTENT;
measurer.measure(constraintWidget, measure);
i4 = measure.measuredHeight;
}
measure.horizontalBehavior = ConstraintWidget.DimensionBehaviour.FIXED;
measure.horizontalDimension = (int) (constraintWidget.getDimensionRatio() * i4);
}
}
if (z4) {
if (constraintWidget.mResolvedMatchConstraintDefault[1] == 4) {
measure.verticalBehavior = ConstraintWidget.DimensionBehaviour.FIXED;
} else if (!z) {
if (measure.horizontalBehavior == ConstraintWidget.DimensionBehaviour.FIXED) {
i3 = measure.horizontalDimension;
} else {
measure.verticalBehavior = ConstraintWidget.DimensionBehaviour.WRAP_CONTENT;
measurer.measure(constraintWidget, measure);
i3 = measure.measuredWidth;
}
measure.verticalBehavior = ConstraintWidget.DimensionBehaviour.FIXED;
if (constraintWidget.getDimensionRatioSide() == -1) {
measure.verticalDimension = (int) (i3 / constraintWidget.getDimensionRatio());
} else {
measure.verticalDimension = (int) (constraintWidget.getDimensionRatio() * i3);
}
}
}
measurer.measure(constraintWidget, measure);
constraintWidget.setWidth(measure.measuredWidth);
constraintWidget.setHeight(measure.measuredHeight);
constraintWidget.setHasBaseline(measure.measuredHasBaseline);
constraintWidget.setBaselineDistance(measure.measuredBaseline);
measure.measureStrategy = BasicMeasure.Measure.SELF_DIMENSIONS;
return measure.measuredNeedsSolverPass;
}
/* JADX WARN: Removed duplicated region for block: B:157:0x032a */
/* JADX WARN: Removed duplicated region for block: B:160:0x032c */
/* JADX WARN: Type inference failed for: r6v3 */
/* JADX WARN: Type inference failed for: r6v4, types: [boolean] */
/* JADX WARN: Type inference failed for: r6v9 */
@Override // androidx.constraintlayout.core.widgets.WidgetContainer
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public void layout() {
/*
Method dump skipped, instructions count: 846
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.constraintlayout.core.widgets.ConstraintWidgetContainer.layout():void");
}
public ArrayList<Guideline> getVerticalGuidelines() {
ArrayList<Guideline> arrayList = new ArrayList<>();
int size = this.mChildren.size();
for (int i = 0; i < size; i++) {
ConstraintWidget constraintWidget = this.mChildren.get(i);
if (constraintWidget instanceof Guideline) {
Guideline guideline = (Guideline) constraintWidget;
if (guideline.getOrientation() == 1) {
arrayList.add(guideline);
}
}
}
return arrayList;
}
public ArrayList<Guideline> getHorizontalGuidelines() {
ArrayList<Guideline> arrayList = new ArrayList<>();
int size = this.mChildren.size();
for (int i = 0; i < size; i++) {
ConstraintWidget constraintWidget = this.mChildren.get(i);
if (constraintWidget instanceof Guideline) {
Guideline guideline = (Guideline) constraintWidget;
if (guideline.getOrientation() == 0) {
arrayList.add(guideline);
}
}
}
return arrayList;
}
void addChain(ConstraintWidget constraintWidget, int i) {
if (i == 0) {
addHorizontalChain(constraintWidget);
} else if (i == 1) {
addVerticalChain(constraintWidget);
}
}
private void addHorizontalChain(ConstraintWidget constraintWidget) {
int i = this.mHorizontalChainsSize + 1;
ChainHead[] chainHeadArr = this.mHorizontalChainsArray;
if (i >= chainHeadArr.length) {
this.mHorizontalChainsArray = (ChainHead[]) Arrays.copyOf(chainHeadArr, chainHeadArr.length * 2);
}
this.mHorizontalChainsArray[this.mHorizontalChainsSize] = new ChainHead(constraintWidget, 0, isRtl());
this.mHorizontalChainsSize++;
}
private void addVerticalChain(ConstraintWidget constraintWidget) {
int i = this.mVerticalChainsSize + 1;
ChainHead[] chainHeadArr = this.mVerticalChainsArray;
if (i >= chainHeadArr.length) {
this.mVerticalChainsArray = (ChainHead[]) Arrays.copyOf(chainHeadArr, chainHeadArr.length * 2);
}
this.mVerticalChainsArray[this.mVerticalChainsSize] = new ChainHead(constraintWidget, 1, isRtl());
this.mVerticalChainsSize++;
}
@Override // androidx.constraintlayout.core.widgets.ConstraintWidget
public void getSceneString(StringBuilder sb) {
sb.append(this.stringId + ":{\n");
StringBuilder sb2 = new StringBuilder(" actualWidth:");
sb2.append(this.mWidth);
sb.append(sb2.toString());
sb.append("\n");
sb.append(" actualHeight:" + this.mHeight);
sb.append("\n");
Iterator<ConstraintWidget> it = getChildren().iterator();
while (it.hasNext()) {
it.next().getSceneString(sb);
sb.append(",\n");
}
sb.append("}");
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,322 @@
package androidx.constraintlayout.core.widgets;
import androidx.constraintlayout.core.LinearSystem;
import androidx.constraintlayout.core.SolverVariable;
import androidx.constraintlayout.core.widgets.ConstraintAnchor;
import androidx.constraintlayout.core.widgets.ConstraintWidget;
import java.util.HashMap;
/* loaded from: classes.dex */
public class Guideline extends ConstraintWidget {
public static final int HORIZONTAL = 0;
public static final int RELATIVE_BEGIN = 1;
public static final int RELATIVE_END = 2;
public static final int RELATIVE_PERCENT = 0;
public static final int RELATIVE_UNKNOWN = -1;
public static final int VERTICAL = 1;
private boolean resolved;
protected float mRelativePercent = -1.0f;
protected int mRelativeBegin = -1;
protected int mRelativeEnd = -1;
protected boolean guidelineUseRtl = true;
private ConstraintAnchor mAnchor = this.mTop;
private int mOrientation = 0;
private int mMinimumPosition = 0;
@Override // androidx.constraintlayout.core.widgets.ConstraintWidget
public boolean allowedInBarrier() {
return true;
}
public ConstraintAnchor getAnchor() {
return this.mAnchor;
}
public int getOrientation() {
return this.mOrientation;
}
public int getRelativeBegin() {
return this.mRelativeBegin;
}
public int getRelativeBehaviour() {
if (this.mRelativePercent != -1.0f) {
return 0;
}
if (this.mRelativeBegin != -1) {
return 1;
}
return this.mRelativeEnd != -1 ? 2 : -1;
}
public int getRelativeEnd() {
return this.mRelativeEnd;
}
public float getRelativePercent() {
return this.mRelativePercent;
}
@Override // androidx.constraintlayout.core.widgets.ConstraintWidget
public String getType() {
return "Guideline";
}
public boolean isPercent() {
return this.mRelativePercent != -1.0f && this.mRelativeBegin == -1 && this.mRelativeEnd == -1;
}
@Override // androidx.constraintlayout.core.widgets.ConstraintWidget
public boolean isResolvedHorizontally() {
return this.resolved;
}
@Override // androidx.constraintlayout.core.widgets.ConstraintWidget
public boolean isResolvedVertically() {
return this.resolved;
}
public void setGuideBegin(int i) {
if (i > -1) {
this.mRelativePercent = -1.0f;
this.mRelativeBegin = i;
this.mRelativeEnd = -1;
}
}
public void setGuideEnd(int i) {
if (i > -1) {
this.mRelativePercent = -1.0f;
this.mRelativeBegin = -1;
this.mRelativeEnd = i;
}
}
public void setGuidePercent(float f) {
if (f > -1.0f) {
this.mRelativePercent = f;
this.mRelativeBegin = -1;
this.mRelativeEnd = -1;
}
}
public void setMinimumPosition(int i) {
this.mMinimumPosition = i;
}
public Guideline() {
this.mAnchors.clear();
this.mAnchors.add(this.mAnchor);
int length = this.mListAnchors.length;
for (int i = 0; i < length; i++) {
this.mListAnchors[i] = this.mAnchor;
}
}
@Override // androidx.constraintlayout.core.widgets.ConstraintWidget
public void copy(ConstraintWidget constraintWidget, HashMap<ConstraintWidget, ConstraintWidget> hashMap) {
super.copy(constraintWidget, hashMap);
Guideline guideline = (Guideline) constraintWidget;
this.mRelativePercent = guideline.mRelativePercent;
this.mRelativeBegin = guideline.mRelativeBegin;
this.mRelativeEnd = guideline.mRelativeEnd;
this.guidelineUseRtl = guideline.guidelineUseRtl;
setOrientation(guideline.mOrientation);
}
public void setOrientation(int i) {
if (this.mOrientation == i) {
return;
}
this.mOrientation = i;
this.mAnchors.clear();
if (this.mOrientation == 1) {
this.mAnchor = this.mLeft;
} else {
this.mAnchor = this.mTop;
}
this.mAnchors.add(this.mAnchor);
int length = this.mListAnchors.length;
for (int i2 = 0; i2 < length; i2++) {
this.mListAnchors[i2] = this.mAnchor;
}
}
/* renamed from: androidx.constraintlayout.core.widgets.Guideline$1, reason: invalid class name */
static /* synthetic */ class AnonymousClass1 {
static final /* synthetic */ int[] $SwitchMap$androidx$constraintlayout$core$widgets$ConstraintAnchor$Type;
static {
int[] iArr = new int[ConstraintAnchor.Type.values().length];
$SwitchMap$androidx$constraintlayout$core$widgets$ConstraintAnchor$Type = iArr;
try {
iArr[ConstraintAnchor.Type.LEFT.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
$SwitchMap$androidx$constraintlayout$core$widgets$ConstraintAnchor$Type[ConstraintAnchor.Type.RIGHT.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
$SwitchMap$androidx$constraintlayout$core$widgets$ConstraintAnchor$Type[ConstraintAnchor.Type.TOP.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
$SwitchMap$androidx$constraintlayout$core$widgets$ConstraintAnchor$Type[ConstraintAnchor.Type.BOTTOM.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
try {
$SwitchMap$androidx$constraintlayout$core$widgets$ConstraintAnchor$Type[ConstraintAnchor.Type.BASELINE.ordinal()] = 5;
} catch (NoSuchFieldError unused5) {
}
try {
$SwitchMap$androidx$constraintlayout$core$widgets$ConstraintAnchor$Type[ConstraintAnchor.Type.CENTER.ordinal()] = 6;
} catch (NoSuchFieldError unused6) {
}
try {
$SwitchMap$androidx$constraintlayout$core$widgets$ConstraintAnchor$Type[ConstraintAnchor.Type.CENTER_X.ordinal()] = 7;
} catch (NoSuchFieldError unused7) {
}
try {
$SwitchMap$androidx$constraintlayout$core$widgets$ConstraintAnchor$Type[ConstraintAnchor.Type.CENTER_Y.ordinal()] = 8;
} catch (NoSuchFieldError unused8) {
}
try {
$SwitchMap$androidx$constraintlayout$core$widgets$ConstraintAnchor$Type[ConstraintAnchor.Type.NONE.ordinal()] = 9;
} catch (NoSuchFieldError unused9) {
}
}
}
@Override // androidx.constraintlayout.core.widgets.ConstraintWidget
public ConstraintAnchor getAnchor(ConstraintAnchor.Type type) {
int i = AnonymousClass1.$SwitchMap$androidx$constraintlayout$core$widgets$ConstraintAnchor$Type[type.ordinal()];
if (i == 1 || i == 2) {
if (this.mOrientation == 1) {
return this.mAnchor;
}
return null;
}
if ((i == 3 || i == 4) && this.mOrientation == 0) {
return this.mAnchor;
}
return null;
}
public void setGuidePercent(int i) {
setGuidePercent(i / 100.0f);
}
public void setFinalValue(int i) {
this.mAnchor.setFinalValue(i);
this.resolved = true;
}
@Override // androidx.constraintlayout.core.widgets.ConstraintWidget
public void addToSolver(LinearSystem linearSystem, boolean z) {
ConstraintWidgetContainer constraintWidgetContainer = (ConstraintWidgetContainer) getParent();
if (constraintWidgetContainer == null) {
return;
}
ConstraintAnchor anchor = constraintWidgetContainer.getAnchor(ConstraintAnchor.Type.LEFT);
ConstraintAnchor anchor2 = constraintWidgetContainer.getAnchor(ConstraintAnchor.Type.RIGHT);
boolean z2 = this.mParent != null && this.mParent.mListDimensionBehaviors[0] == ConstraintWidget.DimensionBehaviour.WRAP_CONTENT;
if (this.mOrientation == 0) {
anchor = constraintWidgetContainer.getAnchor(ConstraintAnchor.Type.TOP);
anchor2 = constraintWidgetContainer.getAnchor(ConstraintAnchor.Type.BOTTOM);
z2 = this.mParent != null && this.mParent.mListDimensionBehaviors[1] == ConstraintWidget.DimensionBehaviour.WRAP_CONTENT;
}
if (this.resolved && this.mAnchor.hasFinalValue()) {
SolverVariable createObjectVariable = linearSystem.createObjectVariable(this.mAnchor);
linearSystem.addEquality(createObjectVariable, this.mAnchor.getFinalValue());
if (this.mRelativeBegin != -1) {
if (z2) {
linearSystem.addGreaterThan(linearSystem.createObjectVariable(anchor2), createObjectVariable, 0, 5);
}
} else if (this.mRelativeEnd != -1 && z2) {
SolverVariable createObjectVariable2 = linearSystem.createObjectVariable(anchor2);
linearSystem.addGreaterThan(createObjectVariable, linearSystem.createObjectVariable(anchor), 0, 5);
linearSystem.addGreaterThan(createObjectVariable2, createObjectVariable, 0, 5);
}
this.resolved = false;
return;
}
if (this.mRelativeBegin != -1) {
SolverVariable createObjectVariable3 = linearSystem.createObjectVariable(this.mAnchor);
linearSystem.addEquality(createObjectVariable3, linearSystem.createObjectVariable(anchor), this.mRelativeBegin, 8);
if (z2) {
linearSystem.addGreaterThan(linearSystem.createObjectVariable(anchor2), createObjectVariable3, 0, 5);
return;
}
return;
}
if (this.mRelativeEnd == -1) {
if (this.mRelativePercent != -1.0f) {
linearSystem.addConstraint(LinearSystem.createRowDimensionPercent(linearSystem, linearSystem.createObjectVariable(this.mAnchor), linearSystem.createObjectVariable(anchor2), this.mRelativePercent));
return;
}
return;
}
SolverVariable createObjectVariable4 = linearSystem.createObjectVariable(this.mAnchor);
SolverVariable createObjectVariable5 = linearSystem.createObjectVariable(anchor2);
linearSystem.addEquality(createObjectVariable4, createObjectVariable5, -this.mRelativeEnd, 8);
if (z2) {
linearSystem.addGreaterThan(createObjectVariable4, linearSystem.createObjectVariable(anchor), 0, 5);
linearSystem.addGreaterThan(createObjectVariable5, createObjectVariable4, 0, 5);
}
}
@Override // androidx.constraintlayout.core.widgets.ConstraintWidget
public void updateFromSolver(LinearSystem linearSystem, boolean z) {
if (getParent() == null) {
return;
}
int objectVariableValue = linearSystem.getObjectVariableValue(this.mAnchor);
if (this.mOrientation == 1) {
setX(objectVariableValue);
setY(0);
setHeight(getParent().getHeight());
setWidth(0);
return;
}
setX(0);
setY(objectVariableValue);
setWidth(getParent().getWidth());
setHeight(0);
}
void inferRelativePercentPosition() {
float x = getX() / getParent().getWidth();
if (this.mOrientation == 0) {
x = getY() / getParent().getHeight();
}
setGuidePercent(x);
}
void inferRelativeBeginPosition() {
int x = getX();
if (this.mOrientation == 0) {
x = getY();
}
setGuideBegin(x);
}
void inferRelativeEndPosition() {
int width = getParent().getWidth() - getX();
if (this.mOrientation == 0) {
width = getParent().getHeight() - getY();
}
setGuideEnd(width);
}
public void cyclePosition() {
if (this.mRelativeBegin != -1) {
inferRelativePercentPosition();
} else if (this.mRelativePercent != -1.0f) {
inferRelativeEndPosition();
} else if (this.mRelativeEnd != -1) {
inferRelativeBeginPosition();
}
}
}

View File

@ -0,0 +1,10 @@
package androidx.constraintlayout.core.widgets;
/* loaded from: classes.dex */
public interface Helper {
void add(ConstraintWidget constraintWidget);
void removeAllIds();
void updateConstraints(ConstraintWidgetContainer constraintWidgetContainer);
}

View File

@ -0,0 +1,72 @@
package androidx.constraintlayout.core.widgets;
import androidx.constraintlayout.core.widgets.analyzer.Grouping;
import androidx.constraintlayout.core.widgets.analyzer.WidgetGroup;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
/* loaded from: classes.dex */
public class HelperWidget extends ConstraintWidget implements Helper {
public ConstraintWidget[] mWidgets = new ConstraintWidget[4];
public int mWidgetsCount = 0;
@Override // androidx.constraintlayout.core.widgets.Helper
public void updateConstraints(ConstraintWidgetContainer constraintWidgetContainer) {
}
@Override // androidx.constraintlayout.core.widgets.Helper
public void add(ConstraintWidget constraintWidget) {
if (constraintWidget == this || constraintWidget == null) {
return;
}
int i = this.mWidgetsCount + 1;
ConstraintWidget[] constraintWidgetArr = this.mWidgets;
if (i > constraintWidgetArr.length) {
this.mWidgets = (ConstraintWidget[]) Arrays.copyOf(constraintWidgetArr, constraintWidgetArr.length * 2);
}
ConstraintWidget[] constraintWidgetArr2 = this.mWidgets;
int i2 = this.mWidgetsCount;
constraintWidgetArr2[i2] = constraintWidget;
this.mWidgetsCount = i2 + 1;
}
@Override // androidx.constraintlayout.core.widgets.ConstraintWidget
public void copy(ConstraintWidget constraintWidget, HashMap<ConstraintWidget, ConstraintWidget> hashMap) {
super.copy(constraintWidget, hashMap);
HelperWidget helperWidget = (HelperWidget) constraintWidget;
this.mWidgetsCount = 0;
int i = helperWidget.mWidgetsCount;
for (int i2 = 0; i2 < i; i2++) {
add(hashMap.get(helperWidget.mWidgets[i2]));
}
}
@Override // androidx.constraintlayout.core.widgets.Helper
public void removeAllIds() {
this.mWidgetsCount = 0;
Arrays.fill(this.mWidgets, (Object) null);
}
public void addDependents(ArrayList<WidgetGroup> arrayList, int i, WidgetGroup widgetGroup) {
for (int i2 = 0; i2 < this.mWidgetsCount; i2++) {
widgetGroup.add(this.mWidgets[i2]);
}
for (int i3 = 0; i3 < this.mWidgetsCount; i3++) {
Grouping.findDependents(this.mWidgets[i3], i, arrayList, widgetGroup);
}
}
public int findGroupInDependents(int i) {
for (int i2 = 0; i2 < this.mWidgetsCount; i2++) {
ConstraintWidget constraintWidget = this.mWidgets[i2];
if (i == 0 && constraintWidget.horizontalGroup != -1) {
return constraintWidget.horizontalGroup;
}
if (i == 1 && constraintWidget.verticalGroup != -1) {
return constraintWidget.verticalGroup;
}
}
return -1;
}
}

View File

@ -0,0 +1,59 @@
package androidx.constraintlayout.core.widgets;
import androidx.constraintlayout.core.LinearSystem;
import androidx.constraintlayout.core.widgets.ConstraintWidget;
/* loaded from: classes.dex */
public class Optimizer {
static final int FLAG_CHAIN_DANGLING = 1;
static final int FLAG_RECOMPUTE_BOUNDS = 2;
static final int FLAG_USE_OPTIMIZE = 0;
public static final int OPTIMIZATION_BARRIER = 2;
public static final int OPTIMIZATION_CACHE_MEASURES = 256;
public static final int OPTIMIZATION_CHAIN = 4;
public static final int OPTIMIZATION_DEPENDENCY_ORDERING = 512;
public static final int OPTIMIZATION_DIMENSIONS = 8;
public static final int OPTIMIZATION_DIRECT = 1;
public static final int OPTIMIZATION_GRAPH = 64;
public static final int OPTIMIZATION_GRAPH_WRAP = 128;
public static final int OPTIMIZATION_GROUPING = 1024;
public static final int OPTIMIZATION_GROUPS = 32;
public static final int OPTIMIZATION_NONE = 0;
public static final int OPTIMIZATION_RATIO = 16;
public static final int OPTIMIZATION_STANDARD = 257;
static boolean[] flags = new boolean[3];
public static final boolean enabled(int i, int i2) {
return (i & i2) == i2;
}
static void checkMatchParent(ConstraintWidgetContainer constraintWidgetContainer, LinearSystem linearSystem, ConstraintWidget constraintWidget) {
constraintWidget.mHorizontalResolution = -1;
constraintWidget.mVerticalResolution = -1;
if (constraintWidgetContainer.mListDimensionBehaviors[0] != ConstraintWidget.DimensionBehaviour.WRAP_CONTENT && constraintWidget.mListDimensionBehaviors[0] == ConstraintWidget.DimensionBehaviour.MATCH_PARENT) {
int i = constraintWidget.mLeft.mMargin;
int width = constraintWidgetContainer.getWidth() - constraintWidget.mRight.mMargin;
constraintWidget.mLeft.mSolverVariable = linearSystem.createObjectVariable(constraintWidget.mLeft);
constraintWidget.mRight.mSolverVariable = linearSystem.createObjectVariable(constraintWidget.mRight);
linearSystem.addEquality(constraintWidget.mLeft.mSolverVariable, i);
linearSystem.addEquality(constraintWidget.mRight.mSolverVariable, width);
constraintWidget.mHorizontalResolution = 2;
constraintWidget.setHorizontalDimension(i, width);
}
if (constraintWidgetContainer.mListDimensionBehaviors[1] == ConstraintWidget.DimensionBehaviour.WRAP_CONTENT || constraintWidget.mListDimensionBehaviors[1] != ConstraintWidget.DimensionBehaviour.MATCH_PARENT) {
return;
}
int i2 = constraintWidget.mTop.mMargin;
int height = constraintWidgetContainer.getHeight() - constraintWidget.mBottom.mMargin;
constraintWidget.mTop.mSolverVariable = linearSystem.createObjectVariable(constraintWidget.mTop);
constraintWidget.mBottom.mSolverVariable = linearSystem.createObjectVariable(constraintWidget.mBottom);
linearSystem.addEquality(constraintWidget.mTop.mSolverVariable, i2);
linearSystem.addEquality(constraintWidget.mBottom.mSolverVariable, height);
if (constraintWidget.mBaselineDistance > 0 || constraintWidget.getVisibility() == 8) {
constraintWidget.mBaseline.mSolverVariable = linearSystem.createObjectVariable(constraintWidget.mBaseline);
linearSystem.addEquality(constraintWidget.mBaseline.mSolverVariable, constraintWidget.mBaselineDistance + i2);
}
constraintWidget.mVerticalResolution = 2;
constraintWidget.setVerticalDimension(i2, height);
}
}

View File

@ -0,0 +1,50 @@
package androidx.constraintlayout.core.widgets;
import androidx.constraintlayout.core.LinearSystem;
import androidx.constraintlayout.core.widgets.ConstraintAnchor;
/* loaded from: classes.dex */
public class Placeholder extends VirtualLayout {
@Override // androidx.constraintlayout.core.widgets.VirtualLayout
public void measure(int i, int i2, int i3, int i4) {
int paddingLeft = getPaddingLeft() + getPaddingRight();
int paddingTop = getPaddingTop() + getPaddingBottom();
if (this.mWidgetsCount > 0) {
paddingLeft += this.mWidgets[0].getWidth();
paddingTop += this.mWidgets[0].getHeight();
}
int max = Math.max(getMinWidth(), paddingLeft);
int max2 = Math.max(getMinHeight(), paddingTop);
if (i != 1073741824) {
if (i == Integer.MIN_VALUE) {
i2 = Math.min(max, i2);
} else {
i2 = i == 0 ? max : 0;
}
}
if (i3 != 1073741824) {
if (i3 == Integer.MIN_VALUE) {
i4 = Math.min(max2, i4);
} else {
i4 = i3 == 0 ? max2 : 0;
}
}
setMeasure(i2, i4);
setWidth(i2);
setHeight(i4);
needsCallbackFromSolver(this.mWidgetsCount > 0);
}
@Override // androidx.constraintlayout.core.widgets.ConstraintWidget
public void addToSolver(LinearSystem linearSystem, boolean z) {
super.addToSolver(linearSystem, z);
if (this.mWidgetsCount > 0) {
ConstraintWidget constraintWidget = this.mWidgets[0];
constraintWidget.resetAllConstraints();
constraintWidget.connect(ConstraintAnchor.Type.LEFT, this, ConstraintAnchor.Type.LEFT);
constraintWidget.connect(ConstraintAnchor.Type.RIGHT, this, ConstraintAnchor.Type.RIGHT);
constraintWidget.connect(ConstraintAnchor.Type.TOP, this, ConstraintAnchor.Type.TOP);
constraintWidget.connect(ConstraintAnchor.Type.BOTTOM, this, ConstraintAnchor.Type.BOTTOM);
}
}
}

View File

@ -0,0 +1,45 @@
package androidx.constraintlayout.core.widgets;
/* loaded from: classes.dex */
public class Rectangle {
public int height;
public int width;
public int x;
public int y;
public boolean contains(int i, int i2) {
int i3;
int i4 = this.x;
return i >= i4 && i < i4 + this.width && i2 >= (i3 = this.y) && i2 < i3 + this.height;
}
void grow(int i, int i2) {
this.x -= i;
this.y -= i2;
this.width += i * 2;
this.height += i2 * 2;
}
public void setBounds(int i, int i2, int i3, int i4) {
this.x = i;
this.y = i2;
this.width = i3;
this.height = i4;
}
boolean intersects(Rectangle rectangle) {
int i;
int i2;
int i3 = this.x;
int i4 = rectangle.x;
return i3 >= i4 && i3 < i4 + rectangle.width && (i = this.y) >= (i2 = rectangle.y) && i < i2 + rectangle.height;
}
public int getCenterX() {
return (this.x + this.width) / 2;
}
public int getCenterY() {
return (this.y + this.height) / 2;
}
}

View File

@ -0,0 +1,181 @@
package androidx.constraintlayout.core.widgets;
import androidx.constraintlayout.core.widgets.ConstraintWidget;
import androidx.constraintlayout.core.widgets.analyzer.BasicMeasure;
import java.util.HashSet;
/* 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;
}
protected 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.core.widgets.HelperWidget, androidx.constraintlayout.core.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);
}
}
}
protected 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;
}
protected 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);
}
public boolean contains(HashSet<ConstraintWidget> hashSet) {
for (int i = 0; i < this.mWidgetsCount; i++) {
if (hashSet.contains(this.mWidgets[i])) {
return true;
}
}
return false;
}
}

View File

@ -0,0 +1,101 @@
package androidx.constraintlayout.core.widgets;
import androidx.constraintlayout.core.Cache;
import java.util.ArrayList;
/* loaded from: classes.dex */
public class WidgetContainer extends ConstraintWidget {
public ArrayList<ConstraintWidget> mChildren;
public ArrayList<ConstraintWidget> getChildren() {
return this.mChildren;
}
public WidgetContainer() {
this.mChildren = new ArrayList<>();
}
public WidgetContainer(int i, int i2, int i3, int i4) {
super(i, i2, i3, i4);
this.mChildren = new ArrayList<>();
}
public WidgetContainer(int i, int i2) {
super(i, i2);
this.mChildren = new ArrayList<>();
}
@Override // androidx.constraintlayout.core.widgets.ConstraintWidget
public void reset() {
this.mChildren.clear();
super.reset();
}
public void add(ConstraintWidget constraintWidget) {
this.mChildren.add(constraintWidget);
if (constraintWidget.getParent() != null) {
((WidgetContainer) constraintWidget.getParent()).remove(constraintWidget);
}
constraintWidget.setParent(this);
}
public void add(ConstraintWidget... constraintWidgetArr) {
for (ConstraintWidget constraintWidget : constraintWidgetArr) {
add(constraintWidget);
}
}
public void remove(ConstraintWidget constraintWidget) {
this.mChildren.remove(constraintWidget);
constraintWidget.reset();
}
public ConstraintWidgetContainer getRootConstraintContainer() {
ConstraintWidget parent = getParent();
ConstraintWidgetContainer constraintWidgetContainer = this instanceof ConstraintWidgetContainer ? (ConstraintWidgetContainer) this : null;
while (parent != null) {
ConstraintWidget parent2 = parent.getParent();
if (parent instanceof ConstraintWidgetContainer) {
constraintWidgetContainer = (ConstraintWidgetContainer) parent;
}
parent = parent2;
}
return constraintWidgetContainer;
}
@Override // androidx.constraintlayout.core.widgets.ConstraintWidget
public void setOffset(int i, int i2) {
super.setOffset(i, i2);
int size = this.mChildren.size();
for (int i3 = 0; i3 < size; i3++) {
this.mChildren.get(i3).setOffset(getRootX(), getRootY());
}
}
public void layout() {
ArrayList<ConstraintWidget> arrayList = this.mChildren;
if (arrayList == null) {
return;
}
int size = arrayList.size();
for (int i = 0; i < size; i++) {
ConstraintWidget constraintWidget = this.mChildren.get(i);
if (constraintWidget instanceof WidgetContainer) {
((WidgetContainer) constraintWidget).layout();
}
}
}
@Override // androidx.constraintlayout.core.widgets.ConstraintWidget
public void resetSolverVariables(Cache cache) {
super.resetSolverVariables(cache);
int size = this.mChildren.size();
for (int i = 0; i < size; i++) {
this.mChildren.get(i).resetSolverVariables(cache);
}
}
public void removeAllChildren() {
this.mChildren.clear();
}
}

View File

@ -0,0 +1,13 @@
package androidx.constraintlayout.core.widgets.analyzer;
/* loaded from: classes.dex */
class BaselineDimensionDependency extends DimensionDependency {
public BaselineDimensionDependency(WidgetRun widgetRun) {
super(widgetRun);
}
public void update(DependencyNode dependencyNode) {
((VerticalWidgetRun) this.run).baseline.margin = this.run.widget.getBaselineDistance();
this.resolved = true;
}
}

View File

@ -0,0 +1,342 @@
package androidx.constraintlayout.core.widgets.analyzer;
import androidx.constraintlayout.core.LinearSystem;
import androidx.constraintlayout.core.widgets.Barrier;
import androidx.constraintlayout.core.widgets.ConstraintAnchor;
import androidx.constraintlayout.core.widgets.ConstraintWidget;
import androidx.constraintlayout.core.widgets.ConstraintWidgetContainer;
import androidx.constraintlayout.core.widgets.Guideline;
import androidx.constraintlayout.core.widgets.Helper;
import androidx.constraintlayout.core.widgets.Optimizer;
import androidx.constraintlayout.core.widgets.VirtualLayout;
import java.util.ArrayList;
/* loaded from: classes.dex */
public class BasicMeasure {
public static final int AT_MOST = Integer.MIN_VALUE;
private static final boolean DEBUG = false;
public static final int EXACTLY = 1073741824;
public static final int FIXED = -3;
public static final int MATCH_PARENT = -1;
private static final int MODE_SHIFT = 30;
public static final int UNSPECIFIED = 0;
public static final int WRAP_CONTENT = -2;
private ConstraintWidgetContainer constraintWidgetContainer;
private final ArrayList<ConstraintWidget> mVariableDimensionsWidgets = new ArrayList<>();
private Measure mMeasure = new Measure();
public static class Measure {
public static int SELF_DIMENSIONS = 0;
public static int TRY_GIVEN_DIMENSIONS = 1;
public static int USE_GIVEN_DIMENSIONS = 2;
public ConstraintWidget.DimensionBehaviour horizontalBehavior;
public int horizontalDimension;
public int measureStrategy;
public int measuredBaseline;
public boolean measuredHasBaseline;
public int measuredHeight;
public boolean measuredNeedsSolverPass;
public int measuredWidth;
public ConstraintWidget.DimensionBehaviour verticalBehavior;
public int verticalDimension;
}
public interface Measurer {
void didMeasures();
void measure(ConstraintWidget constraintWidget, Measure measure);
}
public void updateHierarchy(ConstraintWidgetContainer constraintWidgetContainer) {
this.mVariableDimensionsWidgets.clear();
int size = constraintWidgetContainer.mChildren.size();
for (int i = 0; i < size; i++) {
ConstraintWidget constraintWidget = constraintWidgetContainer.mChildren.get(i);
if (constraintWidget.getHorizontalDimensionBehaviour() == ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT || constraintWidget.getVerticalDimensionBehaviour() == ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT) {
this.mVariableDimensionsWidgets.add(constraintWidget);
}
}
constraintWidgetContainer.invalidateGraph();
}
public BasicMeasure(ConstraintWidgetContainer constraintWidgetContainer) {
this.constraintWidgetContainer = constraintWidgetContainer;
}
private void measureChildren(ConstraintWidgetContainer constraintWidgetContainer) {
int size = constraintWidgetContainer.mChildren.size();
boolean optimizeFor = constraintWidgetContainer.optimizeFor(64);
Measurer measurer = constraintWidgetContainer.getMeasurer();
for (int i = 0; i < size; i++) {
ConstraintWidget constraintWidget = constraintWidgetContainer.mChildren.get(i);
if (!(constraintWidget instanceof Guideline) && !(constraintWidget instanceof Barrier) && !constraintWidget.isInVirtualLayout() && (!optimizeFor || constraintWidget.horizontalRun == null || constraintWidget.verticalRun == null || !constraintWidget.horizontalRun.dimension.resolved || !constraintWidget.verticalRun.dimension.resolved)) {
ConstraintWidget.DimensionBehaviour dimensionBehaviour = constraintWidget.getDimensionBehaviour(0);
ConstraintWidget.DimensionBehaviour dimensionBehaviour2 = constraintWidget.getDimensionBehaviour(1);
boolean z = dimensionBehaviour == ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT && constraintWidget.mMatchConstraintDefaultWidth != 1 && dimensionBehaviour2 == ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT && constraintWidget.mMatchConstraintDefaultHeight != 1;
if (!z && constraintWidgetContainer.optimizeFor(1) && !(constraintWidget instanceof VirtualLayout)) {
if (dimensionBehaviour == ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT && constraintWidget.mMatchConstraintDefaultWidth == 0 && dimensionBehaviour2 != ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT && !constraintWidget.isInHorizontalChain()) {
z = true;
}
boolean z2 = (dimensionBehaviour2 != ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT || constraintWidget.mMatchConstraintDefaultHeight != 0 || dimensionBehaviour == ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT || constraintWidget.isInHorizontalChain()) ? z : true;
if ((dimensionBehaviour != ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT && dimensionBehaviour2 != ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT) || constraintWidget.mDimensionRatio <= 0.0f) {
z = z2;
}
}
if (!z) {
measure(measurer, constraintWidget, Measure.SELF_DIMENSIONS);
if (constraintWidgetContainer.mMetrics != null) {
constraintWidgetContainer.mMetrics.measuredWidgets++;
}
}
}
}
measurer.didMeasures();
}
private void solveLinearSystem(ConstraintWidgetContainer constraintWidgetContainer, String str, int i, int i2, int i3) {
int minWidth = constraintWidgetContainer.getMinWidth();
int minHeight = constraintWidgetContainer.getMinHeight();
constraintWidgetContainer.setMinWidth(0);
constraintWidgetContainer.setMinHeight(0);
constraintWidgetContainer.setWidth(i2);
constraintWidgetContainer.setHeight(i3);
constraintWidgetContainer.setMinWidth(minWidth);
constraintWidgetContainer.setMinHeight(minHeight);
this.constraintWidgetContainer.setPass(i);
this.constraintWidgetContainer.layout();
}
public long solverMeasure(ConstraintWidgetContainer constraintWidgetContainer, int i, int i2, int i3, int i4, int i5, int i6, int i7, int i8, int i9) {
boolean z;
int i10;
int i11;
boolean z2;
int i12;
Measurer measurer;
int i13;
int i14;
int i15;
boolean z3;
boolean z4;
Measurer measurer2 = constraintWidgetContainer.getMeasurer();
int size = constraintWidgetContainer.mChildren.size();
int width = constraintWidgetContainer.getWidth();
int height = constraintWidgetContainer.getHeight();
boolean enabled = Optimizer.enabled(i, 128);
boolean z5 = enabled || Optimizer.enabled(i, 64);
if (z5) {
for (int i16 = 0; i16 < size; i16++) {
ConstraintWidget constraintWidget = constraintWidgetContainer.mChildren.get(i16);
boolean z6 = (constraintWidget.getHorizontalDimensionBehaviour() == ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT) && (constraintWidget.getVerticalDimensionBehaviour() == ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT) && constraintWidget.getDimensionRatio() > 0.0f;
if ((constraintWidget.isInHorizontalChain() && z6) || ((constraintWidget.isInVerticalChain() && z6) || (constraintWidget instanceof VirtualLayout) || constraintWidget.isInHorizontalChain() || constraintWidget.isInVerticalChain())) {
z5 = false;
break;
}
}
}
if (z5 && LinearSystem.sMetrics != null) {
LinearSystem.sMetrics.measures++;
}
boolean z7 = z5 & ((i4 == 1073741824 && i6 == 1073741824) || enabled);
if (z7) {
int min = Math.min(constraintWidgetContainer.getMaxWidth(), i5);
int min2 = Math.min(constraintWidgetContainer.getMaxHeight(), i7);
if (i4 == 1073741824 && constraintWidgetContainer.getWidth() != min) {
constraintWidgetContainer.setWidth(min);
constraintWidgetContainer.invalidateGraph();
}
if (i6 == 1073741824 && constraintWidgetContainer.getHeight() != min2) {
constraintWidgetContainer.setHeight(min2);
constraintWidgetContainer.invalidateGraph();
}
if (i4 == 1073741824 && i6 == 1073741824) {
z = constraintWidgetContainer.directMeasure(enabled);
i10 = 2;
} else {
boolean directMeasureSetup = constraintWidgetContainer.directMeasureSetup(enabled);
if (i4 == 1073741824) {
directMeasureSetup &= constraintWidgetContainer.directMeasureWithOrientation(enabled, 0);
i10 = 1;
} else {
i10 = 0;
}
if (i6 == 1073741824) {
z = constraintWidgetContainer.directMeasureWithOrientation(enabled, 1) & directMeasureSetup;
i10++;
} else {
z = directMeasureSetup;
}
}
if (z) {
constraintWidgetContainer.updateFromRuns(i4 == 1073741824, i6 == 1073741824);
}
} else {
z = false;
i10 = 0;
}
if (z && i10 == 2) {
return 0L;
}
int optimizationLevel = constraintWidgetContainer.getOptimizationLevel();
if (size > 0) {
measureChildren(constraintWidgetContainer);
}
updateHierarchy(constraintWidgetContainer);
int size2 = this.mVariableDimensionsWidgets.size();
if (size > 0) {
solveLinearSystem(constraintWidgetContainer, "First pass", 0, width, height);
}
if (size2 > 0) {
boolean z8 = constraintWidgetContainer.getHorizontalDimensionBehaviour() == ConstraintWidget.DimensionBehaviour.WRAP_CONTENT;
boolean z9 = constraintWidgetContainer.getVerticalDimensionBehaviour() == ConstraintWidget.DimensionBehaviour.WRAP_CONTENT;
int max = Math.max(constraintWidgetContainer.getWidth(), this.constraintWidgetContainer.getMinWidth());
int max2 = Math.max(constraintWidgetContainer.getHeight(), this.constraintWidgetContainer.getMinHeight());
int i17 = 0;
boolean z10 = false;
while (i17 < size2) {
ConstraintWidget constraintWidget2 = this.mVariableDimensionsWidgets.get(i17);
if (constraintWidget2 instanceof VirtualLayout) {
int width2 = constraintWidget2.getWidth();
i13 = optimizationLevel;
int height2 = constraintWidget2.getHeight();
i14 = height;
boolean measure = measure(measurer2, constraintWidget2, Measure.TRY_GIVEN_DIMENSIONS) | z10;
if (constraintWidgetContainer.mMetrics != null) {
i15 = width;
z3 = measure;
constraintWidgetContainer.mMetrics.measuredMatchWidgets++;
} else {
i15 = width;
z3 = measure;
}
int width3 = constraintWidget2.getWidth();
int height3 = constraintWidget2.getHeight();
if (width3 != width2) {
constraintWidget2.setWidth(width3);
if (z8 && constraintWidget2.getRight() > max) {
max = Math.max(max, constraintWidget2.getRight() + constraintWidget2.getAnchor(ConstraintAnchor.Type.RIGHT).getMargin());
}
z4 = true;
} else {
z4 = z3;
}
if (height3 != height2) {
constraintWidget2.setHeight(height3);
if (z9 && constraintWidget2.getBottom() > max2) {
max2 = Math.max(max2, constraintWidget2.getBottom() + constraintWidget2.getAnchor(ConstraintAnchor.Type.BOTTOM).getMargin());
}
z4 = true;
}
z10 = z4 | ((VirtualLayout) constraintWidget2).needSolverPass();
} else {
i13 = optimizationLevel;
i15 = width;
i14 = height;
}
i17++;
optimizationLevel = i13;
height = i14;
width = i15;
}
int i18 = optimizationLevel;
int i19 = width;
int i20 = height;
int i21 = 0;
int i22 = 2;
while (i21 < i22) {
int i23 = 0;
while (i23 < size2) {
ConstraintWidget constraintWidget3 = this.mVariableDimensionsWidgets.get(i23);
if (((constraintWidget3 instanceof Helper) && !(constraintWidget3 instanceof VirtualLayout)) || (constraintWidget3 instanceof Guideline) || constraintWidget3.getVisibility() == 8 || ((z7 && constraintWidget3.horizontalRun.dimension.resolved && constraintWidget3.verticalRun.dimension.resolved) || (constraintWidget3 instanceof VirtualLayout))) {
z2 = z7;
i12 = size2;
measurer = measurer2;
} else {
int width4 = constraintWidget3.getWidth();
int height4 = constraintWidget3.getHeight();
int baselineDistance = constraintWidget3.getBaselineDistance();
int i24 = Measure.TRY_GIVEN_DIMENSIONS;
z2 = z7;
if (i21 == 1) {
i24 = Measure.USE_GIVEN_DIMENSIONS;
}
boolean measure2 = measure(measurer2, constraintWidget3, i24) | z10;
if (constraintWidgetContainer.mMetrics != null) {
i12 = size2;
measurer = measurer2;
constraintWidgetContainer.mMetrics.measuredMatchWidgets++;
} else {
i12 = size2;
measurer = measurer2;
}
int width5 = constraintWidget3.getWidth();
int height5 = constraintWidget3.getHeight();
if (width5 != width4) {
constraintWidget3.setWidth(width5);
if (z8 && constraintWidget3.getRight() > max) {
max = Math.max(max, constraintWidget3.getRight() + constraintWidget3.getAnchor(ConstraintAnchor.Type.RIGHT).getMargin());
}
measure2 = true;
}
if (height5 != height4) {
constraintWidget3.setHeight(height5);
if (z9 && constraintWidget3.getBottom() > max2) {
max2 = Math.max(max2, constraintWidget3.getBottom() + constraintWidget3.getAnchor(ConstraintAnchor.Type.BOTTOM).getMargin());
}
measure2 = true;
}
z10 = (!constraintWidget3.hasBaseline() || baselineDistance == constraintWidget3.getBaselineDistance()) ? measure2 : true;
}
i23++;
measurer2 = measurer;
z7 = z2;
size2 = i12;
}
boolean z11 = z7;
int i25 = size2;
Measurer measurer3 = measurer2;
if (!z10) {
break;
}
i21++;
solveLinearSystem(constraintWidgetContainer, "intermediate pass", i21, i19, i20);
measurer2 = measurer3;
z7 = z11;
size2 = i25;
i22 = 2;
z10 = false;
}
i11 = i18;
} else {
i11 = optimizationLevel;
}
constraintWidgetContainer.setOptimizationLevel(i11);
return 0L;
}
private boolean measure(Measurer measurer, ConstraintWidget constraintWidget, int i) {
this.mMeasure.horizontalBehavior = constraintWidget.getHorizontalDimensionBehaviour();
this.mMeasure.verticalBehavior = constraintWidget.getVerticalDimensionBehaviour();
this.mMeasure.horizontalDimension = constraintWidget.getWidth();
this.mMeasure.verticalDimension = constraintWidget.getHeight();
this.mMeasure.measuredNeedsSolverPass = false;
this.mMeasure.measureStrategy = i;
boolean z = this.mMeasure.horizontalBehavior == ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT;
boolean z2 = this.mMeasure.verticalBehavior == ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT;
boolean z3 = z && constraintWidget.mDimensionRatio > 0.0f;
boolean z4 = z2 && constraintWidget.mDimensionRatio > 0.0f;
if (z3 && constraintWidget.mResolvedMatchConstraintDefault[0] == 4) {
this.mMeasure.horizontalBehavior = ConstraintWidget.DimensionBehaviour.FIXED;
}
if (z4 && constraintWidget.mResolvedMatchConstraintDefault[1] == 4) {
this.mMeasure.verticalBehavior = ConstraintWidget.DimensionBehaviour.FIXED;
}
measurer.measure(constraintWidget, this.mMeasure);
constraintWidget.setWidth(this.mMeasure.measuredWidth);
constraintWidget.setHeight(this.mMeasure.measuredHeight);
constraintWidget.setHasBaseline(this.mMeasure.measuredHasBaseline);
constraintWidget.setBaselineDistance(this.mMeasure.measuredBaseline);
this.mMeasure.measureStrategy = Measure.SELF_DIMENSIONS;
return this.mMeasure.measuredNeedsSolverPass;
}
}

View File

@ -0,0 +1,213 @@
package androidx.constraintlayout.core.widgets.analyzer;
import androidx.constraintlayout.core.widgets.ConstraintAnchor;
import androidx.constraintlayout.core.widgets.ConstraintWidget;
import androidx.constraintlayout.core.widgets.ConstraintWidgetContainer;
import java.util.ArrayList;
import java.util.Iterator;
/* loaded from: classes.dex */
public class ChainRun extends WidgetRun {
private int chainStyle;
ArrayList<WidgetRun> widgets;
public ChainRun(ConstraintWidget constraintWidget, int i) {
super(constraintWidget);
this.widgets = new ArrayList<>();
this.orientation = i;
build();
}
public String toString() {
StringBuilder sb = new StringBuilder("ChainRun ");
sb.append(this.orientation == 0 ? "horizontal : " : "vertical : ");
Iterator<WidgetRun> it = this.widgets.iterator();
while (it.hasNext()) {
WidgetRun next = it.next();
sb.append("<");
sb.append(next);
sb.append("> ");
}
return sb.toString();
}
@Override // androidx.constraintlayout.core.widgets.analyzer.WidgetRun
boolean supportsWrapComputation() {
int size = this.widgets.size();
for (int i = 0; i < size; i++) {
if (!this.widgets.get(i).supportsWrapComputation()) {
return false;
}
}
return true;
}
@Override // androidx.constraintlayout.core.widgets.analyzer.WidgetRun
public long getWrapDimension() {
int size = this.widgets.size();
long j = 0;
for (int i = 0; i < size; i++) {
j = j + r4.start.margin + this.widgets.get(i).getWrapDimension() + r4.end.margin;
}
return j;
}
private void build() {
ConstraintWidget constraintWidget;
ConstraintWidget constraintWidget2 = this.widget;
ConstraintWidget previousChainMember = constraintWidget2.getPreviousChainMember(this.orientation);
while (true) {
ConstraintWidget constraintWidget3 = previousChainMember;
constraintWidget = constraintWidget2;
constraintWidget2 = constraintWidget3;
if (constraintWidget2 == null) {
break;
} else {
previousChainMember = constraintWidget2.getPreviousChainMember(this.orientation);
}
}
this.widget = constraintWidget;
this.widgets.add(constraintWidget.getRun(this.orientation));
ConstraintWidget nextChainMember = constraintWidget.getNextChainMember(this.orientation);
while (nextChainMember != null) {
this.widgets.add(nextChainMember.getRun(this.orientation));
nextChainMember = nextChainMember.getNextChainMember(this.orientation);
}
Iterator<WidgetRun> it = this.widgets.iterator();
while (it.hasNext()) {
WidgetRun next = it.next();
if (this.orientation == 0) {
next.widget.horizontalChainRun = this;
} else if (this.orientation == 1) {
next.widget.verticalChainRun = this;
}
}
if (this.orientation == 0 && ((ConstraintWidgetContainer) this.widget.getParent()).isRtl() && this.widgets.size() > 1) {
ArrayList<WidgetRun> arrayList = this.widgets;
this.widget = arrayList.get(arrayList.size() - 1).widget;
}
this.chainStyle = this.orientation == 0 ? this.widget.getHorizontalChainStyle() : this.widget.getVerticalChainStyle();
}
@Override // androidx.constraintlayout.core.widgets.analyzer.WidgetRun
void clear() {
this.runGroup = null;
Iterator<WidgetRun> it = this.widgets.iterator();
while (it.hasNext()) {
it.next().clear();
}
}
@Override // androidx.constraintlayout.core.widgets.analyzer.WidgetRun
void reset() {
this.start.resolved = false;
this.end.resolved = false;
}
/* JADX WARN: Code restructure failed: missing block: B:283:0x03eb, code lost:
r2 = r2 - r9;
*/
/* JADX WARN: Code restructure failed: missing block: B:68:0x00cd, code lost:
if (r3.dimension.resolved != false) goto L57;
*/
@Override // androidx.constraintlayout.core.widgets.analyzer.WidgetRun, androidx.constraintlayout.core.widgets.analyzer.Dependency
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public void update(androidx.constraintlayout.core.widgets.analyzer.Dependency r23) {
/*
Method dump skipped, instructions count: 1043
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.constraintlayout.core.widgets.analyzer.ChainRun.update(androidx.constraintlayout.core.widgets.analyzer.Dependency):void");
}
@Override // androidx.constraintlayout.core.widgets.analyzer.WidgetRun
public void applyToWidget() {
for (int i = 0; i < this.widgets.size(); i++) {
this.widgets.get(i).applyToWidget();
}
}
private ConstraintWidget getFirstVisibleWidget() {
for (int i = 0; i < this.widgets.size(); i++) {
WidgetRun widgetRun = this.widgets.get(i);
if (widgetRun.widget.getVisibility() != 8) {
return widgetRun.widget;
}
}
return null;
}
private ConstraintWidget getLastVisibleWidget() {
for (int size = this.widgets.size() - 1; size >= 0; size--) {
WidgetRun widgetRun = this.widgets.get(size);
if (widgetRun.widget.getVisibility() != 8) {
return widgetRun.widget;
}
}
return null;
}
@Override // androidx.constraintlayout.core.widgets.analyzer.WidgetRun
void apply() {
Iterator<WidgetRun> it = this.widgets.iterator();
while (it.hasNext()) {
it.next().apply();
}
int size = this.widgets.size();
if (size < 1) {
return;
}
ConstraintWidget constraintWidget = this.widgets.get(0).widget;
ConstraintWidget constraintWidget2 = this.widgets.get(size - 1).widget;
if (this.orientation == 0) {
ConstraintAnchor constraintAnchor = constraintWidget.mLeft;
ConstraintAnchor constraintAnchor2 = constraintWidget2.mRight;
DependencyNode target = getTarget(constraintAnchor, 0);
int margin = constraintAnchor.getMargin();
ConstraintWidget firstVisibleWidget = getFirstVisibleWidget();
if (firstVisibleWidget != null) {
margin = firstVisibleWidget.mLeft.getMargin();
}
if (target != null) {
addTarget(this.start, target, margin);
}
DependencyNode target2 = getTarget(constraintAnchor2, 0);
int margin2 = constraintAnchor2.getMargin();
ConstraintWidget lastVisibleWidget = getLastVisibleWidget();
if (lastVisibleWidget != null) {
margin2 = lastVisibleWidget.mRight.getMargin();
}
if (target2 != null) {
addTarget(this.end, target2, -margin2);
}
} else {
ConstraintAnchor constraintAnchor3 = constraintWidget.mTop;
ConstraintAnchor constraintAnchor4 = constraintWidget2.mBottom;
DependencyNode target3 = getTarget(constraintAnchor3, 1);
int margin3 = constraintAnchor3.getMargin();
ConstraintWidget firstVisibleWidget2 = getFirstVisibleWidget();
if (firstVisibleWidget2 != null) {
margin3 = firstVisibleWidget2.mTop.getMargin();
}
if (target3 != null) {
addTarget(this.start, target3, margin3);
}
DependencyNode target4 = getTarget(constraintAnchor4, 1);
int margin4 = constraintAnchor4.getMargin();
ConstraintWidget lastVisibleWidget2 = getLastVisibleWidget();
if (lastVisibleWidget2 != null) {
margin4 = lastVisibleWidget2.mBottom.getMargin();
}
if (target4 != null) {
addTarget(this.end, target4, -margin4);
}
}
this.start.updateDelegate = this;
this.end.updateDelegate = this;
}
}

View File

@ -0,0 +1,6 @@
package androidx.constraintlayout.core.widgets.analyzer;
/* loaded from: classes.dex */
public interface Dependency {
void update(Dependency dependency);
}

View File

@ -0,0 +1,826 @@
package androidx.constraintlayout.core.widgets.analyzer;
import androidx.constraintlayout.core.widgets.Barrier;
import androidx.constraintlayout.core.widgets.ConstraintWidget;
import androidx.constraintlayout.core.widgets.ConstraintWidgetContainer;
import androidx.constraintlayout.core.widgets.Guideline;
import androidx.constraintlayout.core.widgets.HelperWidget;
import androidx.constraintlayout.core.widgets.analyzer.BasicMeasure;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
/* loaded from: classes.dex */
public class DependencyGraph {
private static final boolean USE_GROUPS = true;
private ConstraintWidgetContainer container;
private ConstraintWidgetContainer mContainer;
private boolean mNeedBuildGraph = USE_GROUPS;
private boolean mNeedRedoMeasures = USE_GROUPS;
private ArrayList<WidgetRun> mRuns = new ArrayList<>();
private ArrayList<RunGroup> runGroups = new ArrayList<>();
private BasicMeasure.Measurer mMeasurer = null;
private BasicMeasure.Measure mMeasure = new BasicMeasure.Measure();
ArrayList<RunGroup> mGroups = new ArrayList<>();
public void invalidateGraph() {
this.mNeedBuildGraph = USE_GROUPS;
}
public void invalidateMeasures() {
this.mNeedRedoMeasures = USE_GROUPS;
}
public void setMeasurer(BasicMeasure.Measurer measurer) {
this.mMeasurer = measurer;
}
public DependencyGraph(ConstraintWidgetContainer constraintWidgetContainer) {
this.container = constraintWidgetContainer;
this.mContainer = constraintWidgetContainer;
}
private int computeWrap(ConstraintWidgetContainer constraintWidgetContainer, int i) {
int size = this.mGroups.size();
long j = 0;
for (int i2 = 0; i2 < size; i2++) {
j = Math.max(j, this.mGroups.get(i2).computeWrapSize(constraintWidgetContainer, i));
}
return (int) j;
}
public void defineTerminalWidgets(ConstraintWidget.DimensionBehaviour dimensionBehaviour, ConstraintWidget.DimensionBehaviour dimensionBehaviour2) {
if (this.mNeedBuildGraph) {
buildGraph();
Iterator<ConstraintWidget> it = this.container.mChildren.iterator();
boolean z = false;
while (it.hasNext()) {
ConstraintWidget next = it.next();
next.isTerminalWidget[0] = USE_GROUPS;
next.isTerminalWidget[1] = USE_GROUPS;
if (next instanceof Barrier) {
z = USE_GROUPS;
}
}
if (z) {
return;
}
Iterator<RunGroup> it2 = this.mGroups.iterator();
while (it2.hasNext()) {
it2.next().defineTerminalWidgets(dimensionBehaviour == ConstraintWidget.DimensionBehaviour.WRAP_CONTENT ? USE_GROUPS : false, dimensionBehaviour2 == ConstraintWidget.DimensionBehaviour.WRAP_CONTENT ? USE_GROUPS : false);
}
}
}
public boolean directMeasure(boolean z) {
boolean z2;
boolean z3 = USE_GROUPS;
boolean z4 = z & USE_GROUPS;
if (this.mNeedBuildGraph || this.mNeedRedoMeasures) {
Iterator<ConstraintWidget> it = this.container.mChildren.iterator();
while (it.hasNext()) {
ConstraintWidget next = it.next();
next.ensureWidgetRuns();
next.measured = false;
next.horizontalRun.reset();
next.verticalRun.reset();
}
this.container.ensureWidgetRuns();
this.container.measured = false;
this.container.horizontalRun.reset();
this.container.verticalRun.reset();
this.mNeedRedoMeasures = false;
}
if (basicMeasureWidgets(this.mContainer)) {
return false;
}
this.container.setX(0);
this.container.setY(0);
ConstraintWidget.DimensionBehaviour dimensionBehaviour = this.container.getDimensionBehaviour(0);
ConstraintWidget.DimensionBehaviour dimensionBehaviour2 = this.container.getDimensionBehaviour(1);
if (this.mNeedBuildGraph) {
buildGraph();
}
int x = this.container.getX();
int y = this.container.getY();
this.container.horizontalRun.start.resolve(x);
this.container.verticalRun.start.resolve(y);
measureWidgets();
if (dimensionBehaviour == ConstraintWidget.DimensionBehaviour.WRAP_CONTENT || dimensionBehaviour2 == ConstraintWidget.DimensionBehaviour.WRAP_CONTENT) {
if (z4) {
Iterator<WidgetRun> it2 = this.mRuns.iterator();
while (true) {
if (!it2.hasNext()) {
break;
}
if (!it2.next().supportsWrapComputation()) {
z4 = false;
break;
}
}
}
if (z4 && dimensionBehaviour == ConstraintWidget.DimensionBehaviour.WRAP_CONTENT) {
this.container.setHorizontalDimensionBehaviour(ConstraintWidget.DimensionBehaviour.FIXED);
ConstraintWidgetContainer constraintWidgetContainer = this.container;
constraintWidgetContainer.setWidth(computeWrap(constraintWidgetContainer, 0));
this.container.horizontalRun.dimension.resolve(this.container.getWidth());
}
if (z4 && dimensionBehaviour2 == ConstraintWidget.DimensionBehaviour.WRAP_CONTENT) {
this.container.setVerticalDimensionBehaviour(ConstraintWidget.DimensionBehaviour.FIXED);
ConstraintWidgetContainer constraintWidgetContainer2 = this.container;
constraintWidgetContainer2.setHeight(computeWrap(constraintWidgetContainer2, 1));
this.container.verticalRun.dimension.resolve(this.container.getHeight());
}
}
if (this.container.mListDimensionBehaviors[0] == ConstraintWidget.DimensionBehaviour.FIXED || this.container.mListDimensionBehaviors[0] == ConstraintWidget.DimensionBehaviour.MATCH_PARENT) {
int width = this.container.getWidth() + x;
this.container.horizontalRun.end.resolve(width);
this.container.horizontalRun.dimension.resolve(width - x);
measureWidgets();
if (this.container.mListDimensionBehaviors[1] == ConstraintWidget.DimensionBehaviour.FIXED || this.container.mListDimensionBehaviors[1] == ConstraintWidget.DimensionBehaviour.MATCH_PARENT) {
int height = this.container.getHeight() + y;
this.container.verticalRun.end.resolve(height);
this.container.verticalRun.dimension.resolve(height - y);
}
measureWidgets();
z2 = USE_GROUPS;
} else {
z2 = false;
}
Iterator<WidgetRun> it3 = this.mRuns.iterator();
while (it3.hasNext()) {
WidgetRun next2 = it3.next();
if (next2.widget != this.container || next2.resolved) {
next2.applyToWidget();
}
}
Iterator<WidgetRun> it4 = this.mRuns.iterator();
while (it4.hasNext()) {
WidgetRun next3 = it4.next();
if (z2 || next3.widget != this.container) {
if (!next3.start.resolved || ((!next3.end.resolved && !(next3 instanceof GuidelineReference)) || (!next3.dimension.resolved && !(next3 instanceof ChainRun) && !(next3 instanceof GuidelineReference)))) {
z3 = false;
break;
}
}
}
this.container.setHorizontalDimensionBehaviour(dimensionBehaviour);
this.container.setVerticalDimensionBehaviour(dimensionBehaviour2);
return z3;
}
public boolean directMeasureSetup(boolean z) {
if (this.mNeedBuildGraph) {
Iterator<ConstraintWidget> it = this.container.mChildren.iterator();
while (it.hasNext()) {
ConstraintWidget next = it.next();
next.ensureWidgetRuns();
next.measured = false;
next.horizontalRun.dimension.resolved = false;
next.horizontalRun.resolved = false;
next.horizontalRun.reset();
next.verticalRun.dimension.resolved = false;
next.verticalRun.resolved = false;
next.verticalRun.reset();
}
this.container.ensureWidgetRuns();
this.container.measured = false;
this.container.horizontalRun.dimension.resolved = false;
this.container.horizontalRun.resolved = false;
this.container.horizontalRun.reset();
this.container.verticalRun.dimension.resolved = false;
this.container.verticalRun.resolved = false;
this.container.verticalRun.reset();
buildGraph();
}
if (basicMeasureWidgets(this.mContainer)) {
return false;
}
this.container.setX(0);
this.container.setY(0);
this.container.horizontalRun.start.resolve(0);
this.container.verticalRun.start.resolve(0);
return USE_GROUPS;
}
public boolean directMeasureWithOrientation(boolean z, int i) {
boolean z2;
boolean z3 = USE_GROUPS;
boolean z4 = z & USE_GROUPS;
ConstraintWidget.DimensionBehaviour dimensionBehaviour = this.container.getDimensionBehaviour(0);
ConstraintWidget.DimensionBehaviour dimensionBehaviour2 = this.container.getDimensionBehaviour(1);
int x = this.container.getX();
int y = this.container.getY();
if (z4 && (dimensionBehaviour == ConstraintWidget.DimensionBehaviour.WRAP_CONTENT || dimensionBehaviour2 == ConstraintWidget.DimensionBehaviour.WRAP_CONTENT)) {
Iterator<WidgetRun> it = this.mRuns.iterator();
while (true) {
if (!it.hasNext()) {
break;
}
WidgetRun next = it.next();
if (next.orientation == i && !next.supportsWrapComputation()) {
z4 = false;
break;
}
}
if (i == 0) {
if (z4 && dimensionBehaviour == ConstraintWidget.DimensionBehaviour.WRAP_CONTENT) {
this.container.setHorizontalDimensionBehaviour(ConstraintWidget.DimensionBehaviour.FIXED);
ConstraintWidgetContainer constraintWidgetContainer = this.container;
constraintWidgetContainer.setWidth(computeWrap(constraintWidgetContainer, 0));
this.container.horizontalRun.dimension.resolve(this.container.getWidth());
}
} else if (z4 && dimensionBehaviour2 == ConstraintWidget.DimensionBehaviour.WRAP_CONTENT) {
this.container.setVerticalDimensionBehaviour(ConstraintWidget.DimensionBehaviour.FIXED);
ConstraintWidgetContainer constraintWidgetContainer2 = this.container;
constraintWidgetContainer2.setHeight(computeWrap(constraintWidgetContainer2, 1));
this.container.verticalRun.dimension.resolve(this.container.getHeight());
}
}
if (i == 0) {
if (this.container.mListDimensionBehaviors[0] == ConstraintWidget.DimensionBehaviour.FIXED || this.container.mListDimensionBehaviors[0] == ConstraintWidget.DimensionBehaviour.MATCH_PARENT) {
int width = this.container.getWidth() + x;
this.container.horizontalRun.end.resolve(width);
this.container.horizontalRun.dimension.resolve(width - x);
z2 = USE_GROUPS;
}
z2 = false;
} else {
if (this.container.mListDimensionBehaviors[1] == ConstraintWidget.DimensionBehaviour.FIXED || this.container.mListDimensionBehaviors[1] == ConstraintWidget.DimensionBehaviour.MATCH_PARENT) {
int height = this.container.getHeight() + y;
this.container.verticalRun.end.resolve(height);
this.container.verticalRun.dimension.resolve(height - y);
z2 = USE_GROUPS;
}
z2 = false;
}
measureWidgets();
Iterator<WidgetRun> it2 = this.mRuns.iterator();
while (it2.hasNext()) {
WidgetRun next2 = it2.next();
if (next2.orientation == i && (next2.widget != this.container || next2.resolved)) {
next2.applyToWidget();
}
}
Iterator<WidgetRun> it3 = this.mRuns.iterator();
while (it3.hasNext()) {
WidgetRun next3 = it3.next();
if (next3.orientation == i && (z2 || next3.widget != this.container)) {
if (!next3.start.resolved || !next3.end.resolved || (!(next3 instanceof ChainRun) && !next3.dimension.resolved)) {
z3 = false;
break;
}
}
}
this.container.setHorizontalDimensionBehaviour(dimensionBehaviour);
this.container.setVerticalDimensionBehaviour(dimensionBehaviour2);
return z3;
}
private void measure(ConstraintWidget constraintWidget, ConstraintWidget.DimensionBehaviour dimensionBehaviour, int i, ConstraintWidget.DimensionBehaviour dimensionBehaviour2, int i2) {
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);
}
private boolean basicMeasureWidgets(ConstraintWidgetContainer constraintWidgetContainer) {
int i;
int i2;
Iterator<ConstraintWidget> it = constraintWidgetContainer.mChildren.iterator();
while (it.hasNext()) {
ConstraintWidget next = it.next();
ConstraintWidget.DimensionBehaviour dimensionBehaviour = next.mListDimensionBehaviors[0];
ConstraintWidget.DimensionBehaviour dimensionBehaviour2 = next.mListDimensionBehaviors[1];
if (next.getVisibility() == 8) {
next.measured = USE_GROUPS;
} else {
if (next.mMatchConstraintPercentWidth < 1.0f && dimensionBehaviour == ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT) {
next.mMatchConstraintDefaultWidth = 2;
}
if (next.mMatchConstraintPercentHeight < 1.0f && dimensionBehaviour2 == ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT) {
next.mMatchConstraintDefaultHeight = 2;
}
if (next.getDimensionRatio() > 0.0f) {
if (dimensionBehaviour == ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT && (dimensionBehaviour2 == ConstraintWidget.DimensionBehaviour.WRAP_CONTENT || dimensionBehaviour2 == ConstraintWidget.DimensionBehaviour.FIXED)) {
next.mMatchConstraintDefaultWidth = 3;
} else if (dimensionBehaviour2 == ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT && (dimensionBehaviour == ConstraintWidget.DimensionBehaviour.WRAP_CONTENT || dimensionBehaviour == ConstraintWidget.DimensionBehaviour.FIXED)) {
next.mMatchConstraintDefaultHeight = 3;
} else if (dimensionBehaviour == ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT && dimensionBehaviour2 == ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT) {
if (next.mMatchConstraintDefaultWidth == 0) {
next.mMatchConstraintDefaultWidth = 3;
}
if (next.mMatchConstraintDefaultHeight == 0) {
next.mMatchConstraintDefaultHeight = 3;
}
}
}
if (dimensionBehaviour == ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT && next.mMatchConstraintDefaultWidth == 1 && (next.mLeft.mTarget == null || next.mRight.mTarget == null)) {
dimensionBehaviour = ConstraintWidget.DimensionBehaviour.WRAP_CONTENT;
}
ConstraintWidget.DimensionBehaviour dimensionBehaviour3 = dimensionBehaviour;
ConstraintWidget.DimensionBehaviour dimensionBehaviour4 = (dimensionBehaviour2 == ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT && next.mMatchConstraintDefaultHeight == 1 && (next.mTop.mTarget == null || next.mBottom.mTarget == null)) ? ConstraintWidget.DimensionBehaviour.WRAP_CONTENT : dimensionBehaviour2;
next.horizontalRun.dimensionBehavior = dimensionBehaviour3;
next.horizontalRun.matchConstraintsType = next.mMatchConstraintDefaultWidth;
next.verticalRun.dimensionBehavior = dimensionBehaviour4;
next.verticalRun.matchConstraintsType = next.mMatchConstraintDefaultHeight;
if ((dimensionBehaviour3 == ConstraintWidget.DimensionBehaviour.MATCH_PARENT || dimensionBehaviour3 == ConstraintWidget.DimensionBehaviour.FIXED || dimensionBehaviour3 == ConstraintWidget.DimensionBehaviour.WRAP_CONTENT) && (dimensionBehaviour4 == ConstraintWidget.DimensionBehaviour.MATCH_PARENT || dimensionBehaviour4 == ConstraintWidget.DimensionBehaviour.FIXED || dimensionBehaviour4 == ConstraintWidget.DimensionBehaviour.WRAP_CONTENT)) {
int width = next.getWidth();
if (dimensionBehaviour3 == ConstraintWidget.DimensionBehaviour.MATCH_PARENT) {
i = (constraintWidgetContainer.getWidth() - next.mLeft.mMargin) - next.mRight.mMargin;
dimensionBehaviour3 = ConstraintWidget.DimensionBehaviour.FIXED;
} else {
i = width;
}
int height = next.getHeight();
if (dimensionBehaviour4 == ConstraintWidget.DimensionBehaviour.MATCH_PARENT) {
i2 = (constraintWidgetContainer.getHeight() - next.mTop.mMargin) - next.mBottom.mMargin;
dimensionBehaviour4 = ConstraintWidget.DimensionBehaviour.FIXED;
} else {
i2 = height;
}
measure(next, dimensionBehaviour3, i, dimensionBehaviour4, i2);
next.horizontalRun.dimension.resolve(next.getWidth());
next.verticalRun.dimension.resolve(next.getHeight());
next.measured = USE_GROUPS;
} else {
if (dimensionBehaviour3 == ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT && (dimensionBehaviour4 == ConstraintWidget.DimensionBehaviour.WRAP_CONTENT || dimensionBehaviour4 == ConstraintWidget.DimensionBehaviour.FIXED)) {
if (next.mMatchConstraintDefaultWidth == 3) {
if (dimensionBehaviour4 == ConstraintWidget.DimensionBehaviour.WRAP_CONTENT) {
measure(next, ConstraintWidget.DimensionBehaviour.WRAP_CONTENT, 0, ConstraintWidget.DimensionBehaviour.WRAP_CONTENT, 0);
}
int height2 = next.getHeight();
measure(next, ConstraintWidget.DimensionBehaviour.FIXED, (int) ((height2 * next.mDimensionRatio) + 0.5f), ConstraintWidget.DimensionBehaviour.FIXED, height2);
next.horizontalRun.dimension.resolve(next.getWidth());
next.verticalRun.dimension.resolve(next.getHeight());
next.measured = USE_GROUPS;
} else if (next.mMatchConstraintDefaultWidth == 1) {
measure(next, ConstraintWidget.DimensionBehaviour.WRAP_CONTENT, 0, dimensionBehaviour4, 0);
next.horizontalRun.dimension.wrapValue = next.getWidth();
} else if (next.mMatchConstraintDefaultWidth == 2) {
if (constraintWidgetContainer.mListDimensionBehaviors[0] == ConstraintWidget.DimensionBehaviour.FIXED || constraintWidgetContainer.mListDimensionBehaviors[0] == ConstraintWidget.DimensionBehaviour.MATCH_PARENT) {
measure(next, ConstraintWidget.DimensionBehaviour.FIXED, (int) ((next.mMatchConstraintPercentWidth * constraintWidgetContainer.getWidth()) + 0.5f), dimensionBehaviour4, next.getHeight());
next.horizontalRun.dimension.resolve(next.getWidth());
next.verticalRun.dimension.resolve(next.getHeight());
next.measured = USE_GROUPS;
}
} else if (next.mListAnchors[0].mTarget == null || next.mListAnchors[1].mTarget == null) {
measure(next, ConstraintWidget.DimensionBehaviour.WRAP_CONTENT, 0, dimensionBehaviour4, 0);
next.horizontalRun.dimension.resolve(next.getWidth());
next.verticalRun.dimension.resolve(next.getHeight());
next.measured = USE_GROUPS;
}
}
if (dimensionBehaviour4 == ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT && (dimensionBehaviour3 == ConstraintWidget.DimensionBehaviour.WRAP_CONTENT || dimensionBehaviour3 == ConstraintWidget.DimensionBehaviour.FIXED)) {
if (next.mMatchConstraintDefaultHeight == 3) {
if (dimensionBehaviour3 == ConstraintWidget.DimensionBehaviour.WRAP_CONTENT) {
measure(next, ConstraintWidget.DimensionBehaviour.WRAP_CONTENT, 0, ConstraintWidget.DimensionBehaviour.WRAP_CONTENT, 0);
}
int width2 = next.getWidth();
float f = next.mDimensionRatio;
if (next.getDimensionRatioSide() == -1) {
f = 1.0f / f;
}
measure(next, ConstraintWidget.DimensionBehaviour.FIXED, width2, ConstraintWidget.DimensionBehaviour.FIXED, (int) ((width2 * f) + 0.5f));
next.horizontalRun.dimension.resolve(next.getWidth());
next.verticalRun.dimension.resolve(next.getHeight());
next.measured = USE_GROUPS;
} else if (next.mMatchConstraintDefaultHeight == 1) {
measure(next, dimensionBehaviour3, 0, ConstraintWidget.DimensionBehaviour.WRAP_CONTENT, 0);
next.verticalRun.dimension.wrapValue = next.getHeight();
} else if (next.mMatchConstraintDefaultHeight == 2) {
if (constraintWidgetContainer.mListDimensionBehaviors[1] == ConstraintWidget.DimensionBehaviour.FIXED || constraintWidgetContainer.mListDimensionBehaviors[1] == ConstraintWidget.DimensionBehaviour.MATCH_PARENT) {
measure(next, dimensionBehaviour3, next.getWidth(), ConstraintWidget.DimensionBehaviour.FIXED, (int) ((next.mMatchConstraintPercentHeight * constraintWidgetContainer.getHeight()) + 0.5f));
next.horizontalRun.dimension.resolve(next.getWidth());
next.verticalRun.dimension.resolve(next.getHeight());
next.measured = USE_GROUPS;
}
} else if (next.mListAnchors[2].mTarget == null || next.mListAnchors[3].mTarget == null) {
measure(next, ConstraintWidget.DimensionBehaviour.WRAP_CONTENT, 0, dimensionBehaviour4, 0);
next.horizontalRun.dimension.resolve(next.getWidth());
next.verticalRun.dimension.resolve(next.getHeight());
next.measured = USE_GROUPS;
}
}
if (dimensionBehaviour3 == ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT && dimensionBehaviour4 == ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT) {
if (next.mMatchConstraintDefaultWidth == 1 || next.mMatchConstraintDefaultHeight == 1) {
measure(next, ConstraintWidget.DimensionBehaviour.WRAP_CONTENT, 0, ConstraintWidget.DimensionBehaviour.WRAP_CONTENT, 0);
next.horizontalRun.dimension.wrapValue = next.getWidth();
next.verticalRun.dimension.wrapValue = next.getHeight();
} else if (next.mMatchConstraintDefaultHeight == 2 && next.mMatchConstraintDefaultWidth == 2 && constraintWidgetContainer.mListDimensionBehaviors[0] == ConstraintWidget.DimensionBehaviour.FIXED && constraintWidgetContainer.mListDimensionBehaviors[1] == ConstraintWidget.DimensionBehaviour.FIXED) {
measure(next, ConstraintWidget.DimensionBehaviour.FIXED, (int) ((next.mMatchConstraintPercentWidth * constraintWidgetContainer.getWidth()) + 0.5f), ConstraintWidget.DimensionBehaviour.FIXED, (int) ((next.mMatchConstraintPercentHeight * constraintWidgetContainer.getHeight()) + 0.5f));
next.horizontalRun.dimension.resolve(next.getWidth());
next.verticalRun.dimension.resolve(next.getHeight());
next.measured = USE_GROUPS;
}
}
}
}
}
return false;
}
public void measureWidgets() {
Iterator<ConstraintWidget> it = this.container.mChildren.iterator();
while (it.hasNext()) {
ConstraintWidget next = it.next();
if (!next.measured) {
boolean z = false;
ConstraintWidget.DimensionBehaviour dimensionBehaviour = next.mListDimensionBehaviors[0];
ConstraintWidget.DimensionBehaviour dimensionBehaviour2 = next.mListDimensionBehaviors[1];
int i = next.mMatchConstraintDefaultWidth;
int i2 = next.mMatchConstraintDefaultHeight;
boolean z2 = (dimensionBehaviour == ConstraintWidget.DimensionBehaviour.WRAP_CONTENT || (dimensionBehaviour == ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT && i == 1)) ? USE_GROUPS : false;
if (dimensionBehaviour2 == ConstraintWidget.DimensionBehaviour.WRAP_CONTENT || (dimensionBehaviour2 == ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT && i2 == 1)) {
z = USE_GROUPS;
}
boolean z3 = next.horizontalRun.dimension.resolved;
boolean z4 = next.verticalRun.dimension.resolved;
if (z3 && z4) {
measure(next, ConstraintWidget.DimensionBehaviour.FIXED, next.horizontalRun.dimension.value, ConstraintWidget.DimensionBehaviour.FIXED, next.verticalRun.dimension.value);
next.measured = USE_GROUPS;
} else if (z3 && z) {
measure(next, ConstraintWidget.DimensionBehaviour.FIXED, next.horizontalRun.dimension.value, ConstraintWidget.DimensionBehaviour.WRAP_CONTENT, next.verticalRun.dimension.value);
if (dimensionBehaviour2 == ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT) {
next.verticalRun.dimension.wrapValue = next.getHeight();
} else {
next.verticalRun.dimension.resolve(next.getHeight());
next.measured = USE_GROUPS;
}
} else if (z4 && z2) {
measure(next, ConstraintWidget.DimensionBehaviour.WRAP_CONTENT, next.horizontalRun.dimension.value, ConstraintWidget.DimensionBehaviour.FIXED, next.verticalRun.dimension.value);
if (dimensionBehaviour == ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT) {
next.horizontalRun.dimension.wrapValue = next.getWidth();
} else {
next.horizontalRun.dimension.resolve(next.getWidth());
next.measured = USE_GROUPS;
}
}
if (next.measured && next.verticalRun.baselineDimension != null) {
next.verticalRun.baselineDimension.resolve(next.getBaselineDistance());
}
}
}
}
public void buildGraph() {
buildGraph(this.mRuns);
this.mGroups.clear();
RunGroup.index = 0;
findGroup(this.container.horizontalRun, 0, this.mGroups);
findGroup(this.container.verticalRun, 1, this.mGroups);
this.mNeedBuildGraph = false;
}
public void buildGraph(ArrayList<WidgetRun> arrayList) {
arrayList.clear();
this.mContainer.horizontalRun.clear();
this.mContainer.verticalRun.clear();
arrayList.add(this.mContainer.horizontalRun);
arrayList.add(this.mContainer.verticalRun);
Iterator<ConstraintWidget> it = this.mContainer.mChildren.iterator();
HashSet hashSet = null;
while (it.hasNext()) {
ConstraintWidget next = it.next();
if (next instanceof Guideline) {
arrayList.add(new GuidelineReference(next));
} else {
if (next.isInHorizontalChain()) {
if (next.horizontalChainRun == null) {
next.horizontalChainRun = new ChainRun(next, 0);
}
if (hashSet == null) {
hashSet = new HashSet();
}
hashSet.add(next.horizontalChainRun);
} else {
arrayList.add(next.horizontalRun);
}
if (next.isInVerticalChain()) {
if (next.verticalChainRun == null) {
next.verticalChainRun = new ChainRun(next, 1);
}
if (hashSet == null) {
hashSet = new HashSet();
}
hashSet.add(next.verticalChainRun);
} else {
arrayList.add(next.verticalRun);
}
if (next instanceof HelperWidget) {
arrayList.add(new HelperReferences(next));
}
}
}
if (hashSet != null) {
arrayList.addAll(hashSet);
}
Iterator<WidgetRun> it2 = arrayList.iterator();
while (it2.hasNext()) {
it2.next().clear();
}
Iterator<WidgetRun> it3 = arrayList.iterator();
while (it3.hasNext()) {
WidgetRun next2 = it3.next();
if (next2.widget != this.mContainer) {
next2.apply();
}
}
}
private void displayGraph() {
Iterator<WidgetRun> it = this.mRuns.iterator();
String str = "digraph {\n";
while (it.hasNext()) {
str = generateDisplayGraph(it.next(), str);
}
String str2 = str + "\n}\n";
System.out.println("content:<<\n" + str2 + "\n>>");
}
private void applyGroup(DependencyNode dependencyNode, int i, int i2, DependencyNode dependencyNode2, ArrayList<RunGroup> arrayList, RunGroup runGroup) {
WidgetRun widgetRun = dependencyNode.run;
if (widgetRun.runGroup != null || widgetRun == this.container.horizontalRun || widgetRun == this.container.verticalRun) {
return;
}
if (runGroup == null) {
runGroup = new RunGroup(widgetRun, i2);
arrayList.add(runGroup);
}
widgetRun.runGroup = runGroup;
runGroup.add(widgetRun);
for (Dependency dependency : widgetRun.start.dependencies) {
if (dependency instanceof DependencyNode) {
applyGroup((DependencyNode) dependency, i, 0, dependencyNode2, arrayList, runGroup);
}
}
for (Dependency dependency2 : widgetRun.end.dependencies) {
if (dependency2 instanceof DependencyNode) {
applyGroup((DependencyNode) dependency2, i, 1, dependencyNode2, arrayList, runGroup);
}
}
if (i == 1 && (widgetRun instanceof VerticalWidgetRun)) {
for (Dependency dependency3 : ((VerticalWidgetRun) widgetRun).baseline.dependencies) {
if (dependency3 instanceof DependencyNode) {
applyGroup((DependencyNode) dependency3, i, 2, dependencyNode2, arrayList, runGroup);
}
}
}
for (DependencyNode dependencyNode3 : widgetRun.start.targets) {
if (dependencyNode3 == dependencyNode2) {
runGroup.dual = USE_GROUPS;
}
applyGroup(dependencyNode3, i, 0, dependencyNode2, arrayList, runGroup);
}
for (DependencyNode dependencyNode4 : widgetRun.end.targets) {
if (dependencyNode4 == dependencyNode2) {
runGroup.dual = USE_GROUPS;
}
applyGroup(dependencyNode4, i, 1, dependencyNode2, arrayList, runGroup);
}
if (i == 1 && (widgetRun instanceof VerticalWidgetRun)) {
Iterator<DependencyNode> it = ((VerticalWidgetRun) widgetRun).baseline.targets.iterator();
while (it.hasNext()) {
applyGroup(it.next(), i, 2, dependencyNode2, arrayList, runGroup);
}
}
}
private void findGroup(WidgetRun widgetRun, int i, ArrayList<RunGroup> arrayList) {
for (Dependency dependency : widgetRun.start.dependencies) {
if (dependency instanceof DependencyNode) {
applyGroup((DependencyNode) dependency, i, 0, widgetRun.end, arrayList, null);
} else if (dependency instanceof WidgetRun) {
applyGroup(((WidgetRun) dependency).start, i, 0, widgetRun.end, arrayList, null);
}
}
for (Dependency dependency2 : widgetRun.end.dependencies) {
if (dependency2 instanceof DependencyNode) {
applyGroup((DependencyNode) dependency2, i, 1, widgetRun.start, arrayList, null);
} else if (dependency2 instanceof WidgetRun) {
applyGroup(((WidgetRun) dependency2).end, i, 1, widgetRun.start, arrayList, null);
}
}
if (i == 1) {
for (Dependency dependency3 : ((VerticalWidgetRun) widgetRun).baseline.dependencies) {
if (dependency3 instanceof DependencyNode) {
applyGroup((DependencyNode) dependency3, i, 2, null, arrayList, null);
}
}
}
}
private String generateDisplayNode(DependencyNode dependencyNode, boolean z, String str) {
StringBuilder sb = new StringBuilder(str);
for (DependencyNode dependencyNode2 : dependencyNode.targets) {
String str2 = ("\n" + dependencyNode.name()) + " -> " + dependencyNode2.name();
if (dependencyNode.margin > 0 || z || (dependencyNode.run instanceof HelperReferences)) {
String str3 = str2 + "[";
if (dependencyNode.margin > 0) {
str3 = str3 + "label=\"" + dependencyNode.margin + "\"";
if (z) {
str3 = str3 + ",";
}
}
if (z) {
str3 = str3 + " style=dashed ";
}
if (dependencyNode.run instanceof HelperReferences) {
str3 = str3 + " style=bold,color=gray ";
}
str2 = str3 + "]";
}
sb.append(str2 + "\n");
}
return sb.toString();
}
private String nodeDefinition(WidgetRun widgetRun) {
boolean z = widgetRun instanceof VerticalWidgetRun;
String debugName = widgetRun.widget.getDebugName();
StringBuilder sb = new StringBuilder(debugName);
ConstraintWidget constraintWidget = widgetRun.widget;
ConstraintWidget.DimensionBehaviour horizontalDimensionBehaviour = !z ? constraintWidget.getHorizontalDimensionBehaviour() : constraintWidget.getVerticalDimensionBehaviour();
RunGroup runGroup = widgetRun.runGroup;
if (!z) {
sb.append("_HORIZONTAL");
} else {
sb.append("_VERTICAL");
}
sb.append(" [shape=none, label=<<TABLE BORDER=\"0\" CELLSPACING=\"0\" CELLPADDING=\"2\"> <TR>");
if (!z) {
sb.append(" <TD ");
if (widgetRun.start.resolved) {
sb.append(" BGCOLOR=\"green\"");
}
sb.append(" PORT=\"LEFT\" BORDER=\"1\">L</TD>");
} else {
sb.append(" <TD ");
if (widgetRun.start.resolved) {
sb.append(" BGCOLOR=\"green\"");
}
sb.append(" PORT=\"TOP\" BORDER=\"1\">T</TD>");
}
sb.append(" <TD BORDER=\"1\" ");
if (widgetRun.dimension.resolved && !widgetRun.widget.measured) {
sb.append(" BGCOLOR=\"green\" ");
} else if (widgetRun.dimension.resolved) {
sb.append(" BGCOLOR=\"lightgray\" ");
} else if (widgetRun.widget.measured) {
sb.append(" BGCOLOR=\"yellow\" ");
}
if (horizontalDimensionBehaviour == ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT) {
sb.append("style=\"dashed\"");
}
sb.append(">");
sb.append(debugName);
if (runGroup != null) {
sb.append(" [");
sb.append(runGroup.groupIndex + 1);
sb.append("/");
sb.append(RunGroup.index);
sb.append("]");
}
sb.append(" </TD>");
if (!z) {
sb.append(" <TD ");
if (widgetRun.end.resolved) {
sb.append(" BGCOLOR=\"green\"");
}
sb.append(" PORT=\"RIGHT\" BORDER=\"1\">R</TD>");
} else {
sb.append(" <TD ");
if (((VerticalWidgetRun) widgetRun).baseline.resolved) {
sb.append(" BGCOLOR=\"green\"");
}
sb.append(" PORT=\"BASELINE\" BORDER=\"1\">b</TD> <TD ");
if (widgetRun.end.resolved) {
sb.append(" BGCOLOR=\"green\"");
}
sb.append(" PORT=\"BOTTOM\" BORDER=\"1\">B</TD>");
}
sb.append(" </TR></TABLE>>];\n");
return sb.toString();
}
private String generateChainDisplayGraph(ChainRun chainRun, String str) {
int i = chainRun.orientation;
StringBuilder sb = new StringBuilder("subgraph cluster_");
sb.append(chainRun.widget.getDebugName());
if (i == 0) {
sb.append("_h");
} else {
sb.append("_v");
}
sb.append(" {\n");
Iterator<WidgetRun> it = chainRun.widgets.iterator();
String str2 = "";
while (it.hasNext()) {
WidgetRun next = it.next();
sb.append(next.widget.getDebugName());
if (i == 0) {
sb.append("_HORIZONTAL");
} else {
sb.append("_VERTICAL");
}
sb.append(";\n");
str2 = generateDisplayGraph(next, str2);
}
sb.append("}\n");
return str + str2 + ((Object) sb);
}
private boolean isCenteredConnection(DependencyNode dependencyNode, DependencyNode dependencyNode2) {
Iterator<DependencyNode> it = dependencyNode.targets.iterator();
int i = 0;
while (it.hasNext()) {
if (it.next() != dependencyNode2) {
i++;
}
}
Iterator<DependencyNode> it2 = dependencyNode2.targets.iterator();
int i2 = 0;
while (it2.hasNext()) {
if (it2.next() != dependencyNode) {
i2++;
}
}
if (i <= 0 || i2 <= 0) {
return false;
}
return USE_GROUPS;
}
private String generateDisplayGraph(WidgetRun widgetRun, String str) {
boolean z;
DependencyNode dependencyNode = widgetRun.start;
DependencyNode dependencyNode2 = widgetRun.end;
StringBuilder sb = new StringBuilder(str);
if (!(widgetRun instanceof HelperReferences) && dependencyNode.dependencies.isEmpty() && (dependencyNode2.dependencies.isEmpty() && dependencyNode.targets.isEmpty()) && dependencyNode2.targets.isEmpty()) {
return str;
}
sb.append(nodeDefinition(widgetRun));
boolean isCenteredConnection = isCenteredConnection(dependencyNode, dependencyNode2);
String generateDisplayNode = generateDisplayNode(dependencyNode2, isCenteredConnection, generateDisplayNode(dependencyNode, isCenteredConnection, str));
boolean z2 = widgetRun instanceof VerticalWidgetRun;
if (z2) {
generateDisplayNode = generateDisplayNode(((VerticalWidgetRun) widgetRun).baseline, isCenteredConnection, generateDisplayNode);
}
if ((widgetRun instanceof HorizontalWidgetRun) || (((z = widgetRun instanceof ChainRun)) && ((ChainRun) widgetRun).orientation == 0)) {
ConstraintWidget.DimensionBehaviour horizontalDimensionBehaviour = widgetRun.widget.getHorizontalDimensionBehaviour();
if (horizontalDimensionBehaviour == ConstraintWidget.DimensionBehaviour.FIXED || horizontalDimensionBehaviour == ConstraintWidget.DimensionBehaviour.WRAP_CONTENT) {
if (!dependencyNode.targets.isEmpty() && dependencyNode2.targets.isEmpty()) {
sb.append("\n");
sb.append(dependencyNode2.name());
sb.append(" -> ");
sb.append(dependencyNode.name());
sb.append("\n");
} else if (dependencyNode.targets.isEmpty() && !dependencyNode2.targets.isEmpty()) {
sb.append("\n");
sb.append(dependencyNode.name());
sb.append(" -> ");
sb.append(dependencyNode2.name());
sb.append("\n");
}
} else if (horizontalDimensionBehaviour == ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT && widgetRun.widget.getDimensionRatio() > 0.0f) {
sb.append("\n");
sb.append(widgetRun.widget.getDebugName());
sb.append("_HORIZONTAL -> ");
sb.append(widgetRun.widget.getDebugName());
sb.append("_VERTICAL;\n");
}
} else if (z2 || (z && ((ChainRun) widgetRun).orientation == 1)) {
ConstraintWidget.DimensionBehaviour verticalDimensionBehaviour = widgetRun.widget.getVerticalDimensionBehaviour();
if (verticalDimensionBehaviour == ConstraintWidget.DimensionBehaviour.FIXED || verticalDimensionBehaviour == ConstraintWidget.DimensionBehaviour.WRAP_CONTENT) {
if (!dependencyNode.targets.isEmpty() && dependencyNode2.targets.isEmpty()) {
sb.append("\n");
sb.append(dependencyNode2.name());
sb.append(" -> ");
sb.append(dependencyNode.name());
sb.append("\n");
} else if (dependencyNode.targets.isEmpty() && !dependencyNode2.targets.isEmpty()) {
sb.append("\n");
sb.append(dependencyNode.name());
sb.append(" -> ");
sb.append(dependencyNode2.name());
sb.append("\n");
}
} else if (verticalDimensionBehaviour == ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT && widgetRun.widget.getDimensionRatio() > 0.0f) {
sb.append("\n");
sb.append(widgetRun.widget.getDebugName());
sb.append("_VERTICAL -> ");
sb.append(widgetRun.widget.getDebugName());
sb.append("_HORIZONTAL;\n");
}
}
if (widgetRun instanceof ChainRun) {
return generateChainDisplayGraph((ChainRun) widgetRun, generateDisplayNode);
}
return sb.toString();
}
}

View File

@ -0,0 +1,131 @@
package androidx.constraintlayout.core.widgets.analyzer;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/* loaded from: classes.dex */
public class DependencyNode implements Dependency {
int margin;
WidgetRun run;
public int value;
public Dependency updateDelegate = null;
public boolean delegateToWidgetRun = false;
public boolean readyToSolve = false;
Type type = Type.UNKNOWN;
int marginFactor = 1;
DimensionDependency marginDependency = null;
public boolean resolved = false;
List<Dependency> dependencies = new ArrayList();
List<DependencyNode> targets = new ArrayList();
enum Type {
UNKNOWN,
HORIZONTAL_DIMENSION,
VERTICAL_DIMENSION,
LEFT,
RIGHT,
TOP,
BOTTOM,
BASELINE
}
public DependencyNode(WidgetRun widgetRun) {
this.run = widgetRun;
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(this.run.widget.getDebugName());
sb.append(":");
sb.append(this.type);
sb.append("(");
sb.append(this.resolved ? Integer.valueOf(this.value) : "unresolved");
sb.append(") <t=");
sb.append(this.targets.size());
sb.append(":d=");
sb.append(this.dependencies.size());
sb.append(">");
return sb.toString();
}
public void resolve(int i) {
if (this.resolved) {
return;
}
this.resolved = true;
this.value = i;
for (Dependency dependency : this.dependencies) {
dependency.update(dependency);
}
}
@Override // androidx.constraintlayout.core.widgets.analyzer.Dependency
public void update(Dependency dependency) {
Iterator<DependencyNode> it = this.targets.iterator();
while (it.hasNext()) {
if (!it.next().resolved) {
return;
}
}
this.readyToSolve = true;
Dependency dependency2 = this.updateDelegate;
if (dependency2 != null) {
dependency2.update(this);
}
if (this.delegateToWidgetRun) {
this.run.update(this);
return;
}
DependencyNode dependencyNode = null;
int i = 0;
for (DependencyNode dependencyNode2 : this.targets) {
if (!(dependencyNode2 instanceof DimensionDependency)) {
i++;
dependencyNode = dependencyNode2;
}
}
if (dependencyNode != null && i == 1 && dependencyNode.resolved) {
DimensionDependency dimensionDependency = this.marginDependency;
if (dimensionDependency != null) {
if (!dimensionDependency.resolved) {
return;
} else {
this.margin = this.marginFactor * this.marginDependency.value;
}
}
resolve(dependencyNode.value + this.margin);
}
Dependency dependency3 = this.updateDelegate;
if (dependency3 != null) {
dependency3.update(this);
}
}
public void addDependency(Dependency dependency) {
this.dependencies.add(dependency);
if (this.resolved) {
dependency.update(dependency);
}
}
public String name() {
String str;
String debugName = this.run.widget.getDebugName();
if (this.type == Type.LEFT || this.type == Type.RIGHT) {
str = debugName + "_HORIZONTAL";
} else {
str = debugName + "_VERTICAL";
}
return str + ":" + this.type.name();
}
public void clear() {
this.targets.clear();
this.dependencies.clear();
this.resolved = false;
this.value = 0;
this.readyToSolve = false;
this.delegateToWidgetRun = false;
}
}

View File

@ -0,0 +1,29 @@
package androidx.constraintlayout.core.widgets.analyzer;
import androidx.constraintlayout.core.widgets.analyzer.DependencyNode;
/* loaded from: classes.dex */
class DimensionDependency extends DependencyNode {
public int wrapValue;
public DimensionDependency(WidgetRun widgetRun) {
super(widgetRun);
if (widgetRun instanceof HorizontalWidgetRun) {
this.type = DependencyNode.Type.HORIZONTAL_DIMENSION;
} else {
this.type = DependencyNode.Type.VERTICAL_DIMENSION;
}
}
@Override // androidx.constraintlayout.core.widgets.analyzer.DependencyNode
public void resolve(int i) {
if (this.resolved) {
return;
}
this.resolved = true;
this.value = i;
for (Dependency dependency : this.dependencies) {
dependency.update(dependency);
}
}
}

View File

@ -0,0 +1,509 @@
package androidx.constraintlayout.core.widgets.analyzer;
import androidx.constraintlayout.core.widgets.Barrier;
import androidx.constraintlayout.core.widgets.ConstraintAnchor;
import androidx.constraintlayout.core.widgets.ConstraintWidget;
import androidx.constraintlayout.core.widgets.ConstraintWidgetContainer;
import androidx.constraintlayout.core.widgets.Guideline;
import androidx.constraintlayout.core.widgets.analyzer.BasicMeasure;
import java.util.ArrayList;
import java.util.Iterator;
/* loaded from: classes.dex */
public class Direct {
private static final boolean APPLY_MATCH_PARENT = false;
private static final boolean DEBUG = false;
private static final boolean EARLY_TERMINATION = true;
private static BasicMeasure.Measure measure = new BasicMeasure.Measure();
private static int hcount = 0;
private static int vcount = 0;
public static void solvingPass(ConstraintWidgetContainer constraintWidgetContainer, BasicMeasure.Measurer measurer) {
ConstraintWidget.DimensionBehaviour horizontalDimensionBehaviour = constraintWidgetContainer.getHorizontalDimensionBehaviour();
ConstraintWidget.DimensionBehaviour verticalDimensionBehaviour = constraintWidgetContainer.getVerticalDimensionBehaviour();
hcount = 0;
vcount = 0;
constraintWidgetContainer.resetFinalResolution();
ArrayList<ConstraintWidget> children = constraintWidgetContainer.getChildren();
int size = children.size();
for (int i = 0; i < size; i++) {
children.get(i).resetFinalResolution();
}
boolean isRtl = constraintWidgetContainer.isRtl();
if (horizontalDimensionBehaviour == ConstraintWidget.DimensionBehaviour.FIXED) {
constraintWidgetContainer.setFinalHorizontal(0, constraintWidgetContainer.getWidth());
} else {
constraintWidgetContainer.setFinalLeft(0);
}
boolean z = false;
boolean z2 = false;
for (int i2 = 0; i2 < size; i2++) {
ConstraintWidget constraintWidget = children.get(i2);
if (constraintWidget instanceof Guideline) {
Guideline guideline = (Guideline) constraintWidget;
if (guideline.getOrientation() == 1) {
if (guideline.getRelativeBegin() != -1) {
guideline.setFinalValue(guideline.getRelativeBegin());
} else if (guideline.getRelativeEnd() != -1 && constraintWidgetContainer.isResolvedHorizontally()) {
guideline.setFinalValue(constraintWidgetContainer.getWidth() - guideline.getRelativeEnd());
} else if (constraintWidgetContainer.isResolvedHorizontally()) {
guideline.setFinalValue((int) ((guideline.getRelativePercent() * constraintWidgetContainer.getWidth()) + 0.5f));
}
z = EARLY_TERMINATION;
}
} else if ((constraintWidget instanceof Barrier) && ((Barrier) constraintWidget).getOrientation() == 0) {
z2 = EARLY_TERMINATION;
}
}
if (z) {
for (int i3 = 0; i3 < size; i3++) {
ConstraintWidget constraintWidget2 = children.get(i3);
if (constraintWidget2 instanceof Guideline) {
Guideline guideline2 = (Guideline) constraintWidget2;
if (guideline2.getOrientation() == 1) {
horizontalSolvingPass(0, guideline2, measurer, isRtl);
}
}
}
}
horizontalSolvingPass(0, constraintWidgetContainer, measurer, isRtl);
if (z2) {
for (int i4 = 0; i4 < size; i4++) {
ConstraintWidget constraintWidget3 = children.get(i4);
if (constraintWidget3 instanceof Barrier) {
Barrier barrier = (Barrier) constraintWidget3;
if (barrier.getOrientation() == 0) {
solveBarrier(0, barrier, measurer, 0, isRtl);
}
}
}
}
if (verticalDimensionBehaviour == ConstraintWidget.DimensionBehaviour.FIXED) {
constraintWidgetContainer.setFinalVertical(0, constraintWidgetContainer.getHeight());
} else {
constraintWidgetContainer.setFinalTop(0);
}
boolean z3 = false;
boolean z4 = false;
for (int i5 = 0; i5 < size; i5++) {
ConstraintWidget constraintWidget4 = children.get(i5);
if (constraintWidget4 instanceof Guideline) {
Guideline guideline3 = (Guideline) constraintWidget4;
if (guideline3.getOrientation() == 0) {
if (guideline3.getRelativeBegin() != -1) {
guideline3.setFinalValue(guideline3.getRelativeBegin());
} else if (guideline3.getRelativeEnd() != -1 && constraintWidgetContainer.isResolvedVertically()) {
guideline3.setFinalValue(constraintWidgetContainer.getHeight() - guideline3.getRelativeEnd());
} else if (constraintWidgetContainer.isResolvedVertically()) {
guideline3.setFinalValue((int) ((guideline3.getRelativePercent() * constraintWidgetContainer.getHeight()) + 0.5f));
}
z3 = EARLY_TERMINATION;
}
} else if ((constraintWidget4 instanceof Barrier) && ((Barrier) constraintWidget4).getOrientation() == 1) {
z4 = EARLY_TERMINATION;
}
}
if (z3) {
for (int i6 = 0; i6 < size; i6++) {
ConstraintWidget constraintWidget5 = children.get(i6);
if (constraintWidget5 instanceof Guideline) {
Guideline guideline4 = (Guideline) constraintWidget5;
if (guideline4.getOrientation() == 0) {
verticalSolvingPass(1, guideline4, measurer);
}
}
}
}
verticalSolvingPass(0, constraintWidgetContainer, measurer);
if (z4) {
for (int i7 = 0; i7 < size; i7++) {
ConstraintWidget constraintWidget6 = children.get(i7);
if (constraintWidget6 instanceof Barrier) {
Barrier barrier2 = (Barrier) constraintWidget6;
if (barrier2.getOrientation() == 1) {
solveBarrier(0, barrier2, measurer, 1, isRtl);
}
}
}
}
for (int i8 = 0; i8 < size; i8++) {
ConstraintWidget constraintWidget7 = children.get(i8);
if (constraintWidget7.isMeasureRequested() && canMeasure(0, constraintWidget7)) {
ConstraintWidgetContainer.measure(0, constraintWidget7, measurer, measure, BasicMeasure.Measure.SELF_DIMENSIONS);
if (constraintWidget7 instanceof Guideline) {
if (((Guideline) constraintWidget7).getOrientation() == 0) {
verticalSolvingPass(0, constraintWidget7, measurer);
} else {
horizontalSolvingPass(0, constraintWidget7, measurer, isRtl);
}
} else {
horizontalSolvingPass(0, constraintWidget7, measurer, isRtl);
verticalSolvingPass(0, constraintWidget7, measurer);
}
}
}
}
private static void solveBarrier(int i, Barrier barrier, BasicMeasure.Measurer measurer, int i2, boolean z) {
if (barrier.allSolved()) {
if (i2 == 0) {
horizontalSolvingPass(i + 1, barrier, measurer, z);
} else {
verticalSolvingPass(i + 1, barrier, measurer);
}
}
}
public static String ls(int i) {
StringBuilder sb = new StringBuilder();
for (int i2 = 0; i2 < i; i2++) {
sb.append(" ");
}
sb.append("+-(" + i + ") ");
return sb.toString();
}
private static void horizontalSolvingPass(int i, ConstraintWidget constraintWidget, BasicMeasure.Measurer measurer, boolean z) {
if (constraintWidget.isHorizontalSolvingPassDone()) {
return;
}
hcount++;
if (!(constraintWidget instanceof ConstraintWidgetContainer) && constraintWidget.isMeasureRequested()) {
int i2 = i + 1;
if (canMeasure(i2, constraintWidget)) {
ConstraintWidgetContainer.measure(i2, constraintWidget, measurer, new BasicMeasure.Measure(), BasicMeasure.Measure.SELF_DIMENSIONS);
}
}
ConstraintAnchor anchor = constraintWidget.getAnchor(ConstraintAnchor.Type.LEFT);
ConstraintAnchor anchor2 = constraintWidget.getAnchor(ConstraintAnchor.Type.RIGHT);
int finalValue = anchor.getFinalValue();
int finalValue2 = anchor2.getFinalValue();
if (anchor.getDependents() != null && anchor.hasFinalValue()) {
Iterator<ConstraintAnchor> it = anchor.getDependents().iterator();
while (it.hasNext()) {
ConstraintAnchor next = it.next();
ConstraintWidget constraintWidget2 = next.mOwner;
int i3 = i + 1;
boolean canMeasure = canMeasure(i3, constraintWidget2);
if (constraintWidget2.isMeasureRequested() && canMeasure) {
ConstraintWidgetContainer.measure(i3, constraintWidget2, measurer, new BasicMeasure.Measure(), BasicMeasure.Measure.SELF_DIMENSIONS);
}
boolean z2 = ((next == constraintWidget2.mLeft && constraintWidget2.mRight.mTarget != null && constraintWidget2.mRight.mTarget.hasFinalValue()) || (next == constraintWidget2.mRight && constraintWidget2.mLeft.mTarget != null && constraintWidget2.mLeft.mTarget.hasFinalValue())) ? EARLY_TERMINATION : false;
if (constraintWidget2.getHorizontalDimensionBehaviour() != ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT || canMeasure) {
if (!constraintWidget2.isMeasureRequested()) {
if (next == constraintWidget2.mLeft && constraintWidget2.mRight.mTarget == null) {
int margin = constraintWidget2.mLeft.getMargin() + finalValue;
constraintWidget2.setFinalHorizontal(margin, constraintWidget2.getWidth() + margin);
horizontalSolvingPass(i3, constraintWidget2, measurer, z);
} else if (next == constraintWidget2.mRight && constraintWidget2.mLeft.mTarget == null) {
int margin2 = finalValue - constraintWidget2.mRight.getMargin();
constraintWidget2.setFinalHorizontal(margin2 - constraintWidget2.getWidth(), margin2);
horizontalSolvingPass(i3, constraintWidget2, measurer, z);
} else if (z2 && !constraintWidget2.isInHorizontalChain()) {
solveHorizontalCenterConstraints(i3, measurer, constraintWidget2, z);
}
}
} else if (constraintWidget2.getHorizontalDimensionBehaviour() == ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT && constraintWidget2.mMatchConstraintMaxWidth >= 0 && constraintWidget2.mMatchConstraintMinWidth >= 0 && ((constraintWidget2.getVisibility() == 8 || (constraintWidget2.mMatchConstraintDefaultWidth == 0 && constraintWidget2.getDimensionRatio() == 0.0f)) && !constraintWidget2.isInHorizontalChain() && !constraintWidget2.isInVirtualLayout() && z2 && !constraintWidget2.isInHorizontalChain())) {
solveHorizontalMatchConstraint(i3, constraintWidget, measurer, constraintWidget2, z);
}
}
}
if (constraintWidget instanceof Guideline) {
return;
}
if (anchor2.getDependents() != null && anchor2.hasFinalValue()) {
Iterator<ConstraintAnchor> it2 = anchor2.getDependents().iterator();
while (it2.hasNext()) {
ConstraintAnchor next2 = it2.next();
ConstraintWidget constraintWidget3 = next2.mOwner;
int i4 = i + 1;
boolean canMeasure2 = canMeasure(i4, constraintWidget3);
if (constraintWidget3.isMeasureRequested() && canMeasure2) {
ConstraintWidgetContainer.measure(i4, constraintWidget3, measurer, new BasicMeasure.Measure(), BasicMeasure.Measure.SELF_DIMENSIONS);
}
boolean z3 = ((next2 == constraintWidget3.mLeft && constraintWidget3.mRight.mTarget != null && constraintWidget3.mRight.mTarget.hasFinalValue()) || (next2 == constraintWidget3.mRight && constraintWidget3.mLeft.mTarget != null && constraintWidget3.mLeft.mTarget.hasFinalValue())) ? EARLY_TERMINATION : false;
if (constraintWidget3.getHorizontalDimensionBehaviour() != ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT || canMeasure2) {
if (!constraintWidget3.isMeasureRequested()) {
if (next2 == constraintWidget3.mLeft && constraintWidget3.mRight.mTarget == null) {
int margin3 = constraintWidget3.mLeft.getMargin() + finalValue2;
constraintWidget3.setFinalHorizontal(margin3, constraintWidget3.getWidth() + margin3);
horizontalSolvingPass(i4, constraintWidget3, measurer, z);
} else if (next2 == constraintWidget3.mRight && constraintWidget3.mLeft.mTarget == null) {
int margin4 = finalValue2 - constraintWidget3.mRight.getMargin();
constraintWidget3.setFinalHorizontal(margin4 - constraintWidget3.getWidth(), margin4);
horizontalSolvingPass(i4, constraintWidget3, measurer, z);
} else if (z3 && !constraintWidget3.isInHorizontalChain()) {
solveHorizontalCenterConstraints(i4, measurer, constraintWidget3, z);
}
}
} else if (constraintWidget3.getHorizontalDimensionBehaviour() == ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT && constraintWidget3.mMatchConstraintMaxWidth >= 0 && constraintWidget3.mMatchConstraintMinWidth >= 0 && (constraintWidget3.getVisibility() == 8 || (constraintWidget3.mMatchConstraintDefaultWidth == 0 && constraintWidget3.getDimensionRatio() == 0.0f))) {
if (!constraintWidget3.isInHorizontalChain() && !constraintWidget3.isInVirtualLayout() && z3 && !constraintWidget3.isInHorizontalChain()) {
solveHorizontalMatchConstraint(i4, constraintWidget, measurer, constraintWidget3, z);
}
}
}
}
constraintWidget.markHorizontalSolvingPassDone();
}
private static void verticalSolvingPass(int i, ConstraintWidget constraintWidget, BasicMeasure.Measurer measurer) {
if (constraintWidget.isVerticalSolvingPassDone()) {
return;
}
vcount++;
if (!(constraintWidget instanceof ConstraintWidgetContainer) && constraintWidget.isMeasureRequested()) {
int i2 = i + 1;
if (canMeasure(i2, constraintWidget)) {
ConstraintWidgetContainer.measure(i2, constraintWidget, measurer, new BasicMeasure.Measure(), BasicMeasure.Measure.SELF_DIMENSIONS);
}
}
ConstraintAnchor anchor = constraintWidget.getAnchor(ConstraintAnchor.Type.TOP);
ConstraintAnchor anchor2 = constraintWidget.getAnchor(ConstraintAnchor.Type.BOTTOM);
int finalValue = anchor.getFinalValue();
int finalValue2 = anchor2.getFinalValue();
if (anchor.getDependents() != null && anchor.hasFinalValue()) {
Iterator<ConstraintAnchor> it = anchor.getDependents().iterator();
while (it.hasNext()) {
ConstraintAnchor next = it.next();
ConstraintWidget constraintWidget2 = next.mOwner;
int i3 = i + 1;
boolean canMeasure = canMeasure(i3, constraintWidget2);
if (constraintWidget2.isMeasureRequested() && canMeasure) {
ConstraintWidgetContainer.measure(i3, constraintWidget2, measurer, new BasicMeasure.Measure(), BasicMeasure.Measure.SELF_DIMENSIONS);
}
boolean z = ((next == constraintWidget2.mTop && constraintWidget2.mBottom.mTarget != null && constraintWidget2.mBottom.mTarget.hasFinalValue()) || (next == constraintWidget2.mBottom && constraintWidget2.mTop.mTarget != null && constraintWidget2.mTop.mTarget.hasFinalValue())) ? EARLY_TERMINATION : false;
if (constraintWidget2.getVerticalDimensionBehaviour() != ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT || canMeasure) {
if (!constraintWidget2.isMeasureRequested()) {
if (next == constraintWidget2.mTop && constraintWidget2.mBottom.mTarget == null) {
int margin = constraintWidget2.mTop.getMargin() + finalValue;
constraintWidget2.setFinalVertical(margin, constraintWidget2.getHeight() + margin);
verticalSolvingPass(i3, constraintWidget2, measurer);
} else if (next == constraintWidget2.mBottom && constraintWidget2.mTop.mTarget == null) {
int margin2 = finalValue - constraintWidget2.mBottom.getMargin();
constraintWidget2.setFinalVertical(margin2 - constraintWidget2.getHeight(), margin2);
verticalSolvingPass(i3, constraintWidget2, measurer);
} else if (z && !constraintWidget2.isInVerticalChain()) {
solveVerticalCenterConstraints(i3, measurer, constraintWidget2);
}
}
} else if (constraintWidget2.getVerticalDimensionBehaviour() == ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT && constraintWidget2.mMatchConstraintMaxHeight >= 0 && constraintWidget2.mMatchConstraintMinHeight >= 0 && (constraintWidget2.getVisibility() == 8 || (constraintWidget2.mMatchConstraintDefaultHeight == 0 && constraintWidget2.getDimensionRatio() == 0.0f))) {
if (!constraintWidget2.isInVerticalChain() && !constraintWidget2.isInVirtualLayout() && z && !constraintWidget2.isInVerticalChain()) {
solveVerticalMatchConstraint(i3, constraintWidget, measurer, constraintWidget2);
}
}
}
}
if (constraintWidget instanceof Guideline) {
return;
}
if (anchor2.getDependents() != null && anchor2.hasFinalValue()) {
Iterator<ConstraintAnchor> it2 = anchor2.getDependents().iterator();
while (it2.hasNext()) {
ConstraintAnchor next2 = it2.next();
ConstraintWidget constraintWidget3 = next2.mOwner;
int i4 = i + 1;
boolean canMeasure2 = canMeasure(i4, constraintWidget3);
if (constraintWidget3.isMeasureRequested() && canMeasure2) {
ConstraintWidgetContainer.measure(i4, constraintWidget3, measurer, new BasicMeasure.Measure(), BasicMeasure.Measure.SELF_DIMENSIONS);
}
boolean z2 = ((next2 == constraintWidget3.mTop && constraintWidget3.mBottom.mTarget != null && constraintWidget3.mBottom.mTarget.hasFinalValue()) || (next2 == constraintWidget3.mBottom && constraintWidget3.mTop.mTarget != null && constraintWidget3.mTop.mTarget.hasFinalValue())) ? EARLY_TERMINATION : false;
if (constraintWidget3.getVerticalDimensionBehaviour() != ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT || canMeasure2) {
if (constraintWidget3.isMeasureRequested()) {
continue;
} else if (next2 == constraintWidget3.mTop && constraintWidget3.mBottom.mTarget == null) {
int margin3 = constraintWidget3.mTop.getMargin() + finalValue2;
constraintWidget3.setFinalVertical(margin3, constraintWidget3.getHeight() + margin3);
verticalSolvingPass(i4, constraintWidget3, measurer);
} else if (next2 == constraintWidget3.mBottom && constraintWidget3.mTop.mTarget == null) {
int margin4 = finalValue2 - constraintWidget3.mBottom.getMargin();
constraintWidget3.setFinalVertical(margin4 - constraintWidget3.getHeight(), margin4);
verticalSolvingPass(i4, constraintWidget3, measurer);
} else if (z2 && !constraintWidget3.isInVerticalChain()) {
solveVerticalCenterConstraints(i4, measurer, constraintWidget3);
}
} else if (constraintWidget3.getVerticalDimensionBehaviour() == ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT && constraintWidget3.mMatchConstraintMaxHeight >= 0 && constraintWidget3.mMatchConstraintMinHeight >= 0 && (constraintWidget3.getVisibility() == 8 || (constraintWidget3.mMatchConstraintDefaultHeight == 0 && constraintWidget3.getDimensionRatio() == 0.0f))) {
if (!constraintWidget3.isInVerticalChain() && !constraintWidget3.isInVirtualLayout() && z2 && !constraintWidget3.isInVerticalChain()) {
solveVerticalMatchConstraint(i4, constraintWidget, measurer, constraintWidget3);
}
}
}
}
ConstraintAnchor anchor3 = constraintWidget.getAnchor(ConstraintAnchor.Type.BASELINE);
if (anchor3.getDependents() != null && anchor3.hasFinalValue()) {
int finalValue3 = anchor3.getFinalValue();
Iterator<ConstraintAnchor> it3 = anchor3.getDependents().iterator();
while (it3.hasNext()) {
ConstraintAnchor next3 = it3.next();
ConstraintWidget constraintWidget4 = next3.mOwner;
int i5 = i + 1;
boolean canMeasure3 = canMeasure(i5, constraintWidget4);
if (constraintWidget4.isMeasureRequested() && canMeasure3) {
ConstraintWidgetContainer.measure(i5, constraintWidget4, measurer, new BasicMeasure.Measure(), BasicMeasure.Measure.SELF_DIMENSIONS);
}
if (constraintWidget4.getVerticalDimensionBehaviour() != ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT || canMeasure3) {
if (!constraintWidget4.isMeasureRequested() && next3 == constraintWidget4.mBaseline) {
constraintWidget4.setFinalBaseline(next3.getMargin() + finalValue3);
verticalSolvingPass(i5, constraintWidget4, measurer);
}
}
}
}
constraintWidget.markVerticalSolvingPassDone();
}
private static void solveHorizontalCenterConstraints(int i, BasicMeasure.Measurer measurer, ConstraintWidget constraintWidget, boolean z) {
float horizontalBiasPercent = constraintWidget.getHorizontalBiasPercent();
int finalValue = constraintWidget.mLeft.mTarget.getFinalValue();
int finalValue2 = constraintWidget.mRight.mTarget.getFinalValue();
int margin = constraintWidget.mLeft.getMargin() + finalValue;
int margin2 = finalValue2 - constraintWidget.mRight.getMargin();
if (finalValue == finalValue2) {
horizontalBiasPercent = 0.5f;
} else {
finalValue = margin;
finalValue2 = margin2;
}
int width = constraintWidget.getWidth();
int i2 = (finalValue2 - finalValue) - width;
if (finalValue > finalValue2) {
i2 = (finalValue - finalValue2) - width;
}
int i3 = ((int) (i2 > 0 ? (horizontalBiasPercent * i2) + 0.5f : horizontalBiasPercent * i2)) + finalValue;
int i4 = i3 + width;
if (finalValue > finalValue2) {
i4 = i3 - width;
}
constraintWidget.setFinalHorizontal(i3, i4);
horizontalSolvingPass(i + 1, constraintWidget, measurer, z);
}
private static void solveVerticalCenterConstraints(int i, BasicMeasure.Measurer measurer, ConstraintWidget constraintWidget) {
float verticalBiasPercent = constraintWidget.getVerticalBiasPercent();
int finalValue = constraintWidget.mTop.mTarget.getFinalValue();
int finalValue2 = constraintWidget.mBottom.mTarget.getFinalValue();
int margin = constraintWidget.mTop.getMargin() + finalValue;
int margin2 = finalValue2 - constraintWidget.mBottom.getMargin();
if (finalValue == finalValue2) {
verticalBiasPercent = 0.5f;
} else {
finalValue = margin;
finalValue2 = margin2;
}
int height = constraintWidget.getHeight();
int i2 = (finalValue2 - finalValue) - height;
if (finalValue > finalValue2) {
i2 = (finalValue - finalValue2) - height;
}
int i3 = (int) (i2 > 0 ? (verticalBiasPercent * i2) + 0.5f : verticalBiasPercent * i2);
int i4 = finalValue + i3;
int i5 = i4 + height;
if (finalValue > finalValue2) {
i4 = finalValue - i3;
i5 = i4 - height;
}
constraintWidget.setFinalVertical(i4, i5);
verticalSolvingPass(i + 1, constraintWidget, measurer);
}
private static void solveHorizontalMatchConstraint(int i, ConstraintWidget constraintWidget, BasicMeasure.Measurer measurer, ConstraintWidget constraintWidget2, boolean z) {
int width;
float horizontalBiasPercent = constraintWidget2.getHorizontalBiasPercent();
int finalValue = constraintWidget2.mLeft.mTarget.getFinalValue() + constraintWidget2.mLeft.getMargin();
int finalValue2 = constraintWidget2.mRight.mTarget.getFinalValue() - constraintWidget2.mRight.getMargin();
if (finalValue2 >= finalValue) {
int width2 = constraintWidget2.getWidth();
if (constraintWidget2.getVisibility() != 8) {
if (constraintWidget2.mMatchConstraintDefaultWidth == 2) {
if (constraintWidget instanceof ConstraintWidgetContainer) {
width = constraintWidget.getWidth();
} else {
width = constraintWidget.getParent().getWidth();
}
width2 = (int) (constraintWidget2.getHorizontalBiasPercent() * 0.5f * width);
} else if (constraintWidget2.mMatchConstraintDefaultWidth == 0) {
width2 = finalValue2 - finalValue;
}
width2 = Math.max(constraintWidget2.mMatchConstraintMinWidth, width2);
if (constraintWidget2.mMatchConstraintMaxWidth > 0) {
width2 = Math.min(constraintWidget2.mMatchConstraintMaxWidth, width2);
}
}
int i2 = finalValue + ((int) ((horizontalBiasPercent * ((finalValue2 - finalValue) - width2)) + 0.5f));
constraintWidget2.setFinalHorizontal(i2, width2 + i2);
horizontalSolvingPass(i + 1, constraintWidget2, measurer, z);
}
}
private static void solveVerticalMatchConstraint(int i, ConstraintWidget constraintWidget, BasicMeasure.Measurer measurer, ConstraintWidget constraintWidget2) {
int height;
float verticalBiasPercent = constraintWidget2.getVerticalBiasPercent();
int finalValue = constraintWidget2.mTop.mTarget.getFinalValue() + constraintWidget2.mTop.getMargin();
int finalValue2 = constraintWidget2.mBottom.mTarget.getFinalValue() - constraintWidget2.mBottom.getMargin();
if (finalValue2 >= finalValue) {
int height2 = constraintWidget2.getHeight();
if (constraintWidget2.getVisibility() != 8) {
if (constraintWidget2.mMatchConstraintDefaultHeight == 2) {
if (constraintWidget instanceof ConstraintWidgetContainer) {
height = constraintWidget.getHeight();
} else {
height = constraintWidget.getParent().getHeight();
}
height2 = (int) (verticalBiasPercent * 0.5f * height);
} else if (constraintWidget2.mMatchConstraintDefaultHeight == 0) {
height2 = finalValue2 - finalValue;
}
height2 = Math.max(constraintWidget2.mMatchConstraintMinHeight, height2);
if (constraintWidget2.mMatchConstraintMaxHeight > 0) {
height2 = Math.min(constraintWidget2.mMatchConstraintMaxHeight, height2);
}
}
int i2 = finalValue + ((int) ((verticalBiasPercent * ((finalValue2 - finalValue) - height2)) + 0.5f));
constraintWidget2.setFinalVertical(i2, height2 + i2);
verticalSolvingPass(i + 1, constraintWidget2, measurer);
}
}
private static boolean canMeasure(int i, ConstraintWidget constraintWidget) {
ConstraintWidget.DimensionBehaviour horizontalDimensionBehaviour = constraintWidget.getHorizontalDimensionBehaviour();
ConstraintWidget.DimensionBehaviour verticalDimensionBehaviour = constraintWidget.getVerticalDimensionBehaviour();
ConstraintWidgetContainer constraintWidgetContainer = constraintWidget.getParent() != null ? (ConstraintWidgetContainer) constraintWidget.getParent() : null;
if (constraintWidgetContainer != null) {
constraintWidgetContainer.getHorizontalDimensionBehaviour();
ConstraintWidget.DimensionBehaviour dimensionBehaviour = ConstraintWidget.DimensionBehaviour.FIXED;
}
if (constraintWidgetContainer != null) {
constraintWidgetContainer.getVerticalDimensionBehaviour();
ConstraintWidget.DimensionBehaviour dimensionBehaviour2 = ConstraintWidget.DimensionBehaviour.FIXED;
}
boolean z = (horizontalDimensionBehaviour == ConstraintWidget.DimensionBehaviour.FIXED || constraintWidget.isResolvedHorizontally() || horizontalDimensionBehaviour == ConstraintWidget.DimensionBehaviour.WRAP_CONTENT || (horizontalDimensionBehaviour == ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT && constraintWidget.mMatchConstraintDefaultWidth == 0 && constraintWidget.mDimensionRatio == 0.0f && constraintWidget.hasDanglingDimension(0)) || (horizontalDimensionBehaviour == ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT && constraintWidget.mMatchConstraintDefaultWidth == 1 && constraintWidget.hasResolvedTargets(0, constraintWidget.getWidth()))) ? EARLY_TERMINATION : false;
boolean z2 = (verticalDimensionBehaviour == ConstraintWidget.DimensionBehaviour.FIXED || constraintWidget.isResolvedVertically() || verticalDimensionBehaviour == ConstraintWidget.DimensionBehaviour.WRAP_CONTENT || (verticalDimensionBehaviour == ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT && constraintWidget.mMatchConstraintDefaultHeight == 0 && constraintWidget.mDimensionRatio == 0.0f && constraintWidget.hasDanglingDimension(1)) || (verticalDimensionBehaviour == ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT && constraintWidget.mMatchConstraintDefaultHeight == 1 && constraintWidget.hasResolvedTargets(1, constraintWidget.getHeight()))) ? EARLY_TERMINATION : false;
if (constraintWidget.mDimensionRatio > 0.0f && (z || z2)) {
return EARLY_TERMINATION;
}
if (z && z2) {
return EARLY_TERMINATION;
}
return false;
}
/* JADX WARN: Code restructure failed: missing block: B:93:0x01e1, code lost:
if (r4.mListAnchors[r23].mTarget.mOwner == r0) goto L108;
*/
/* JADX WARN: Removed duplicated region for block: B:71:0x0129 */
/* JADX WARN: Removed duplicated region for block: B:80:0x0159 */
/* JADX WARN: Type inference failed for: r2v24 */
/* JADX WARN: Type inference failed for: r2v46 */
/* JADX WARN: Type inference failed for: r2v7, types: [boolean, int] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public static boolean solveChain(androidx.constraintlayout.core.widgets.ConstraintWidgetContainer r20, androidx.constraintlayout.core.LinearSystem r21, int r22, int r23, androidx.constraintlayout.core.widgets.ChainHead r24, boolean r25, boolean r26, boolean r27) {
/*
Method dump skipped, instructions count: 570
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.constraintlayout.core.widgets.analyzer.Direct.solveChain(androidx.constraintlayout.core.widgets.ConstraintWidgetContainer, androidx.constraintlayout.core.LinearSystem, int, int, androidx.constraintlayout.core.widgets.ChainHead, boolean, boolean, boolean):boolean");
}
}

Some files were not shown because too many files have changed in this diff Show More