Rabbit-R1/android (non root)/java/sources/androidx/constraintlayout/motion/widget/MotionPaths.java
2024-05-21 17:08:36 -04:00

454 lines
17 KiB
Java

package androidx.constraintlayout.motion.widget;
import android.view.View;
import androidx.constraintlayout.motion.utils.Easing;
import androidx.constraintlayout.widget.ConstraintAttribute;
import androidx.constraintlayout.widget.ConstraintSet;
import io.sentry.protocol.ViewHierarchyNode;
import java.util.Arrays;
import java.util.LinkedHashMap;
import tech.rabbit.r1launcher.BuildConfig;
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes.dex */
public class MotionPaths implements Comparable<MotionPaths> {
static final int CARTESIAN = 2;
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;
static final int PERPENDICULAR = 1;
static final int SCREEN = 3;
public static final String TAG = "MotionPaths";
static String[] names = {"position", ViewHierarchyNode.JsonKeys.X, ViewHierarchyNode.JsonKeys.Y, ViewHierarchyNode.JsonKeys.WIDTH, ViewHierarchyNode.JsonKeys.HEIGHT, "pathRotate"};
LinkedHashMap<String, ConstraintAttribute> attributes;
float height;
int mDrawPath;
Easing mKeyFrameEasing;
int mMode;
int mPathMotionArc;
float mPathRotate;
float mProgress;
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;
}
/* JADX INFO: Access modifiers changed from: package-private */
public 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 = Key.UNSET;
this.attributes = new LinkedHashMap<>();
this.mMode = 0;
this.mTempValue = new double[18];
this.mTempDelta = new double[18];
}
void initCartesian(KeyPosition keyPosition, MotionPaths motionPaths, MotionPaths motionPaths2) {
float f = keyPosition.mFramePosition / 100.0f;
this.time = f;
this.mDrawPath = keyPosition.mDrawPath;
float f2 = Float.isNaN(keyPosition.mPercentWidth) ? f : keyPosition.mPercentWidth;
float f3 = Float.isNaN(keyPosition.mPercentHeight) ? f : keyPosition.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(keyPosition.mPercentX) ? f : keyPosition.mPercentX;
float f15 = Float.isNaN(keyPosition.mAltPercentY) ? 0.0f : keyPosition.mAltPercentY;
if (!Float.isNaN(keyPosition.mPercentY)) {
f = keyPosition.mPercentY;
}
float f16 = Float.isNaN(keyPosition.mAltPercentX) ? 0.0f : keyPosition.mAltPercentX;
this.mMode = 2;
this.x = (int) (((motionPaths.x + (f14 * f10)) + (f16 * f11)) - f12);
this.y = (int) (((motionPaths.y + (f10 * f15)) + (f11 * f)) - f13);
this.mKeyFrameEasing = Easing.getInterpolator(keyPosition.mTransitionEasing);
this.mPathMotionArc = keyPosition.mPathMotionArc;
}
public MotionPaths(int i, int i2, KeyPosition keyPosition, MotionPaths motionPaths, MotionPaths motionPaths2) {
this.mDrawPath = 0;
this.mPathRotate = Float.NaN;
this.mProgress = Float.NaN;
this.mPathMotionArc = Key.UNSET;
this.attributes = new LinkedHashMap<>();
this.mMode = 0;
this.mTempValue = new double[18];
this.mTempDelta = new double[18];
int i3 = keyPosition.mPositionType;
if (i3 == 1) {
initPath(keyPosition, motionPaths, motionPaths2);
} else if (i3 == 2) {
initScreen(i, i2, keyPosition, motionPaths, motionPaths2);
} else {
initCartesian(keyPosition, motionPaths, motionPaths2);
}
}
void initScreen(int i, int i2, KeyPosition keyPosition, MotionPaths motionPaths, MotionPaths motionPaths2) {
float f = keyPosition.mFramePosition / 100.0f;
this.time = f;
this.mDrawPath = keyPosition.mDrawPath;
float f2 = Float.isNaN(keyPosition.mPercentWidth) ? f : keyPosition.mPercentWidth;
float f3 = Float.isNaN(keyPosition.mPercentHeight) ? f : keyPosition.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 = 3;
if (!Float.isNaN(keyPosition.mPercentX)) {
this.x = (int) (keyPosition.mPercentX * ((int) (i - this.width)));
}
if (!Float.isNaN(keyPosition.mPercentY)) {
this.y = (int) (keyPosition.mPercentY * ((int) (i2 - this.height)));
}
this.mKeyFrameEasing = Easing.getInterpolator(keyPosition.mTransitionEasing);
this.mPathMotionArc = keyPosition.mPathMotionArc;
}
void initPath(KeyPosition keyPosition, MotionPaths motionPaths, MotionPaths motionPaths2) {
float f = keyPosition.mFramePosition / 100.0f;
this.time = f;
this.mDrawPath = keyPosition.mDrawPath;
float f2 = Float.isNaN(keyPosition.mPercentWidth) ? f : keyPosition.mPercentWidth;
float f3 = Float.isNaN(keyPosition.mPercentHeight) ? f : keyPosition.mPercentHeight;
float f4 = motionPaths2.width - motionPaths.width;
float f5 = motionPaths2.height - motionPaths.height;
this.position = this.time;
if (!Float.isNaN(keyPosition.mPercentX)) {
f = keyPosition.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(keyPosition.mPercentY) ? 0.0f : keyPosition.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.mKeyFrameEasing = Easing.getInterpolator(keyPosition.mTransitionEasing);
this.mPathMotionArc = keyPosition.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;
}
/* JADX INFO: Access modifiers changed from: package-private */
public void different(MotionPaths motionPaths, boolean[] zArr, String[] strArr, boolean z) {
zArr[0] = zArr[0] | diff(this.position, motionPaths.position);
zArr[1] = zArr[1] | diff(this.x, motionPaths.x) | z;
zArr[2] = z | diff(this.y, motionPaths.y) | zArr[2];
zArr[3] = zArr[3] | diff(this.width, motionPaths.width);
zArr[4] = diff(this.height, motionPaths.height) | zArr[4];
}
/* JADX INFO: Access modifiers changed from: package-private */
public void getCenter(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;
}
}
fArr[i] = f + (f3 / 2.0f) + 0.0f;
fArr[i + 1] = f2 + (f4 / 2.0f) + 0.0f;
}
/* JADX INFO: Access modifiers changed from: package-private */
public 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;
}
/* JADX INFO: Access modifiers changed from: package-private */
public void setView(View view, int[] iArr, double[] dArr, double[] dArr2, double[] dArr3) {
float f;
float f2 = this.x;
float f3 = this.y;
float f4 = this.width;
float f5 = 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);
int i2 = 0;
for (int i3 = 0; i3 < iArr.length; i3++) {
double[] dArr4 = this.mTempValue;
int i4 = iArr[i3];
dArr4[i4] = dArr[i3];
this.mTempDelta[i4] = dArr2[i3];
}
float f6 = Float.NaN;
float f7 = 0.0f;
float f8 = 0.0f;
float f9 = 0.0f;
float f10 = 0.0f;
while (true) {
double[] dArr5 = this.mTempValue;
if (i2 >= dArr5.length) {
break;
}
boolean isNaN = Double.isNaN(dArr5[i2]);
double d = BuildConfig.SENTRY_SAMPLE_RATE;
if (isNaN && (dArr3 == null || dArr3[i2] == BuildConfig.SENTRY_SAMPLE_RATE)) {
f = f6;
} else {
if (dArr3 != null) {
d = dArr3[i2];
}
if (!Double.isNaN(this.mTempValue[i2])) {
d = this.mTempValue[i2] + d;
}
f = f6;
float f11 = (float) d;
float f12 = (float) this.mTempDelta[i2];
if (i2 == 1) {
f6 = f;
f2 = f11;
f7 = f12;
} else if (i2 == 2) {
f6 = f;
f3 = f11;
f9 = f12;
} else if (i2 == 3) {
f6 = f;
f4 = f11;
f8 = f12;
} else if (i2 == 4) {
f6 = f;
f5 = f11;
f10 = f12;
} else if (i2 == 5) {
f6 = f11;
}
i2++;
}
f6 = f;
i2++;
}
float f13 = f6;
if (Float.isNaN(f13)) {
if (!Float.isNaN(Float.NaN)) {
view.setRotation(Float.NaN);
}
} else {
view.setRotation((float) ((Float.isNaN(Float.NaN) ? 0.0f : Float.NaN) + f13 + Math.toDegrees(Math.atan2(f9 + (f10 / 2.0f), f7 + (f8 / 2.0f)))));
}
float f14 = f2 + 0.5f;
int i5 = (int) f14;
float f15 = f3 + 0.5f;
int i6 = (int) f15;
int i7 = (int) (f14 + f4);
int i8 = (int) (f15 + f5);
int i9 = i7 - i5;
int i10 = i8 - i6;
if (i9 != view.getMeasuredWidth() || i10 != view.getMeasuredHeight()) {
view.measure(View.MeasureSpec.makeMeasureSpec(i9, 1073741824), View.MeasureSpec.makeMeasureSpec(i10, 1073741824));
}
view.layout(i5, i6, i7, i8);
}
/* JADX INFO: Access modifiers changed from: package-private */
public 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;
}
}
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;
int i4 = i + 6;
fArr[i + 5] = f7 + 0.0f;
fArr[i4] = f + 0.0f;
fArr[i + 7] = f7 + 0.0f;
}
/* JADX INFO: Access modifiers changed from: package-private */
public 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;
}
/* JADX INFO: Access modifiers changed from: package-private */
public 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[r2];
i++;
}
}
}
/* JADX INFO: Access modifiers changed from: package-private */
public boolean hasCustomData(String str) {
return this.attributes.containsKey(str);
}
/* JADX INFO: Access modifiers changed from: package-private */
public int getCustomDataCount(String str) {
return this.attributes.get(str).noOfInterpValues();
}
/* JADX INFO: Access modifiers changed from: package-private */
public int getCustomData(String str, double[] dArr, int i) {
ConstraintAttribute constraintAttribute = this.attributes.get(str);
if (constraintAttribute.noOfInterpValues() == 1) {
dArr[i] = constraintAttribute.getValueToInterpolate();
return 1;
}
int noOfInterpValues = constraintAttribute.noOfInterpValues();
constraintAttribute.getValuesToInterpolate(new float[noOfInterpValues]);
int i2 = 0;
while (i2 < noOfInterpValues) {
dArr[i] = r0[i2];
i2++;
i++;
}
return noOfInterpValues;
}
@Override // java.lang.Comparable
public int compareTo(MotionPaths motionPaths) {
return Float.compare(this.position, motionPaths.position);
}
public void applyParameters(ConstraintSet.Constraint constraint) {
this.mKeyFrameEasing = Easing.getInterpolator(constraint.motion.mTransitionEasing);
this.mPathMotionArc = constraint.motion.mPathMotionArc;
this.mPathRotate = constraint.motion.mPathRotate;
this.mDrawPath = constraint.motion.mDrawPath;
this.mProgress = constraint.propertySet.mProgress;
for (String str : constraint.mCustomConstraints.keySet()) {
ConstraintAttribute constraintAttribute = constraint.mCustomConstraints.get(str);
if (constraintAttribute.getType() != ConstraintAttribute.AttributeType.STRING_TYPE) {
this.attributes.put(str, constraintAttribute);
}
}
}
}