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,108 @@
package androidx.constraintlayout.motion.utils;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.util.Log;
import android.view.View;
import androidx.constraintlayout.motion.widget.Debug;
import androidx.constraintlayout.widget.ConstraintAttribute;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
/* loaded from: classes.dex */
public class CustomSupport {
private static final String TAG = "CustomSupport";
private static int clamp(int c) {
int i = (c & (~(c >> 31))) - 255;
return (i & (i >> 31)) + 255;
}
public static void setInterpolatedValue(ConstraintAttribute att, View view, float[] value) {
Class<?> cls = view.getClass();
String str = "set" + att.getName();
try {
boolean z = true;
switch (AnonymousClass1.$SwitchMap$androidx$constraintlayout$widget$ConstraintAttribute$AttributeType[att.getType().ordinal()]) {
case 1:
cls.getMethod(str, Integer.TYPE).invoke(view, Integer.valueOf((int) value[0]));
return;
case 2:
cls.getMethod(str, Float.TYPE).invoke(view, Float.valueOf(value[0]));
return;
case 3:
Method method = cls.getMethod(str, Drawable.class);
int clamp = (clamp((int) (((float) Math.pow(value[0], 0.45454545454545453d)) * 255.0f)) << 16) | (clamp((int) (value[3] * 255.0f)) << 24) | (clamp((int) (((float) Math.pow(value[1], 0.45454545454545453d)) * 255.0f)) << 8) | clamp((int) (((float) Math.pow(value[2], 0.45454545454545453d)) * 255.0f));
ColorDrawable colorDrawable = new ColorDrawable();
colorDrawable.setColor(clamp);
method.invoke(view, colorDrawable);
return;
case 4:
cls.getMethod(str, Integer.TYPE).invoke(view, Integer.valueOf((clamp((int) (((float) Math.pow(value[0], 0.45454545454545453d)) * 255.0f)) << 16) | (clamp((int) (value[3] * 255.0f)) << 24) | (clamp((int) (((float) Math.pow(value[1], 0.45454545454545453d)) * 255.0f)) << 8) | clamp((int) (((float) Math.pow(value[2], 0.45454545454545453d)) * 255.0f))));
return;
case 5:
throw new RuntimeException("unable to interpolate strings " + att.getName());
case 6:
Method method2 = cls.getMethod(str, Boolean.TYPE);
Object[] objArr = new Object[1];
if (value[0] <= 0.5f) {
z = false;
}
objArr[0] = Boolean.valueOf(z);
method2.invoke(view, objArr);
return;
case 7:
cls.getMethod(str, Float.TYPE).invoke(view, Float.valueOf(value[0]));
return;
default:
return;
}
} catch (IllegalAccessException e) {
Log.e(TAG, "cannot access method " + str + " on View \"" + Debug.getName(view) + "\"");
e.printStackTrace();
} catch (NoSuchMethodException e2) {
Log.e(TAG, "no method " + str + " on View \"" + Debug.getName(view) + "\"");
e2.printStackTrace();
} catch (InvocationTargetException e3) {
e3.printStackTrace();
}
}
/* renamed from: androidx.constraintlayout.motion.utils.CustomSupport$1, reason: invalid class name */
static /* synthetic */ class AnonymousClass1 {
static final /* synthetic */ int[] $SwitchMap$androidx$constraintlayout$widget$ConstraintAttribute$AttributeType;
static {
int[] iArr = new int[ConstraintAttribute.AttributeType.values().length];
$SwitchMap$androidx$constraintlayout$widget$ConstraintAttribute$AttributeType = iArr;
try {
iArr[ConstraintAttribute.AttributeType.INT_TYPE.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
$SwitchMap$androidx$constraintlayout$widget$ConstraintAttribute$AttributeType[ConstraintAttribute.AttributeType.FLOAT_TYPE.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
$SwitchMap$androidx$constraintlayout$widget$ConstraintAttribute$AttributeType[ConstraintAttribute.AttributeType.COLOR_DRAWABLE_TYPE.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
$SwitchMap$androidx$constraintlayout$widget$ConstraintAttribute$AttributeType[ConstraintAttribute.AttributeType.COLOR_TYPE.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
try {
$SwitchMap$androidx$constraintlayout$widget$ConstraintAttribute$AttributeType[ConstraintAttribute.AttributeType.STRING_TYPE.ordinal()] = 5;
} catch (NoSuchFieldError unused5) {
}
try {
$SwitchMap$androidx$constraintlayout$widget$ConstraintAttribute$AttributeType[ConstraintAttribute.AttributeType.BOOLEAN_TYPE.ordinal()] = 6;
} catch (NoSuchFieldError unused6) {
}
try {
$SwitchMap$androidx$constraintlayout$widget$ConstraintAttribute$AttributeType[ConstraintAttribute.AttributeType.DIMENSION_TYPE.ordinal()] = 7;
} catch (NoSuchFieldError unused7) {
}
}
}
}

View File

@ -0,0 +1,56 @@
package androidx.constraintlayout.motion.utils;
import androidx.constraintlayout.core.motion.utils.SpringStopEngine;
import androidx.constraintlayout.core.motion.utils.StopEngine;
import androidx.constraintlayout.core.motion.utils.StopLogicEngine;
import androidx.constraintlayout.motion.widget.MotionInterpolator;
/* loaded from: classes.dex */
public class StopLogic extends MotionInterpolator {
private StopEngine mEngine;
private SpringStopEngine mSpringStopEngine;
private StopLogicEngine mStopLogicEngine;
public StopLogic() {
StopLogicEngine stopLogicEngine = new StopLogicEngine();
this.mStopLogicEngine = stopLogicEngine;
this.mEngine = stopLogicEngine;
}
public String debug(String desc, float time) {
return this.mEngine.debug(desc, time);
}
public float getVelocity(float x) {
return this.mEngine.getVelocity(x);
}
public void config(float currentPos, float destination, float currentVelocity, float maxTime, float maxAcceleration, float maxVelocity) {
StopLogicEngine stopLogicEngine = this.mStopLogicEngine;
this.mEngine = stopLogicEngine;
stopLogicEngine.config(currentPos, destination, currentVelocity, maxTime, maxAcceleration, maxVelocity);
}
public void springConfig(float currentPos, float destination, float currentVelocity, float mass, float stiffness, float damping, float stopThreshold, int boundaryMode) {
if (this.mSpringStopEngine == null) {
this.mSpringStopEngine = new SpringStopEngine();
}
SpringStopEngine springStopEngine = this.mSpringStopEngine;
this.mEngine = springStopEngine;
springStopEngine.springConfig(currentPos, destination, currentVelocity, mass, stiffness, damping, stopThreshold, boundaryMode);
}
@Override // androidx.constraintlayout.motion.widget.MotionInterpolator, android.animation.TimeInterpolator
public float getInterpolation(float v) {
return this.mEngine.getInterpolation(v);
}
@Override // androidx.constraintlayout.motion.widget.MotionInterpolator
public float getVelocity() {
return this.mEngine.getVelocity();
}
public boolean isStopped() {
return this.mEngine.isStopped();
}
}

View File

@ -0,0 +1,218 @@
package androidx.constraintlayout.motion.utils;
import android.util.Log;
import android.view.View;
import androidx.constraintlayout.core.motion.utils.KeyCycleOscillator;
import androidx.constraintlayout.motion.widget.MotionLayout;
import androidx.constraintlayout.widget.ConstraintAttribute;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
/* loaded from: classes.dex */
public abstract class ViewOscillator extends KeyCycleOscillator {
private static final String TAG = "ViewOscillator";
public abstract void setProperty(View view, float t);
public static ViewOscillator makeSpline(String str) {
if (str.startsWith("CUSTOM")) {
return new CustomSet();
}
str.hashCode();
switch (str) {
case "rotationX":
return new RotationXset();
case "rotationY":
return new RotationYset();
case "translationX":
return new TranslationXset();
case "translationY":
return new TranslationYset();
case "translationZ":
return new TranslationZset();
case "progress":
return new ProgressSet();
case "scaleX":
return new ScaleXset();
case "scaleY":
return new ScaleYset();
case "waveVariesBy":
return new AlphaSet();
case "rotation":
return new RotationSet();
case "elevation":
return new ElevationSet();
case "transitionPathRotate":
return new PathRotateSet();
case "alpha":
return new AlphaSet();
case "waveOffset":
return new AlphaSet();
default:
return null;
}
}
static class ElevationSet extends ViewOscillator {
ElevationSet() {
}
@Override // androidx.constraintlayout.motion.utils.ViewOscillator
public void setProperty(View view, float t) {
view.setElevation(get(t));
}
}
static class AlphaSet extends ViewOscillator {
AlphaSet() {
}
@Override // androidx.constraintlayout.motion.utils.ViewOscillator
public void setProperty(View view, float t) {
view.setAlpha(get(t));
}
}
static class RotationSet extends ViewOscillator {
RotationSet() {
}
@Override // androidx.constraintlayout.motion.utils.ViewOscillator
public void setProperty(View view, float t) {
view.setRotation(get(t));
}
}
static class RotationXset extends ViewOscillator {
RotationXset() {
}
@Override // androidx.constraintlayout.motion.utils.ViewOscillator
public void setProperty(View view, float t) {
view.setRotationX(get(t));
}
}
static class RotationYset extends ViewOscillator {
RotationYset() {
}
@Override // androidx.constraintlayout.motion.utils.ViewOscillator
public void setProperty(View view, float t) {
view.setRotationY(get(t));
}
}
public static class PathRotateSet extends ViewOscillator {
@Override // androidx.constraintlayout.motion.utils.ViewOscillator
public void setProperty(View view, float t) {
}
public void setPathRotate(View view, float t, double dx, double dy) {
view.setRotation(get(t) + ((float) Math.toDegrees(Math.atan2(dy, dx))));
}
}
static class ScaleXset extends ViewOscillator {
ScaleXset() {
}
@Override // androidx.constraintlayout.motion.utils.ViewOscillator
public void setProperty(View view, float t) {
view.setScaleX(get(t));
}
}
static class ScaleYset extends ViewOscillator {
ScaleYset() {
}
@Override // androidx.constraintlayout.motion.utils.ViewOscillator
public void setProperty(View view, float t) {
view.setScaleY(get(t));
}
}
static class TranslationXset extends ViewOscillator {
TranslationXset() {
}
@Override // androidx.constraintlayout.motion.utils.ViewOscillator
public void setProperty(View view, float t) {
view.setTranslationX(get(t));
}
}
static class TranslationYset extends ViewOscillator {
TranslationYset() {
}
@Override // androidx.constraintlayout.motion.utils.ViewOscillator
public void setProperty(View view, float t) {
view.setTranslationY(get(t));
}
}
static class TranslationZset extends ViewOscillator {
TranslationZset() {
}
@Override // androidx.constraintlayout.motion.utils.ViewOscillator
public void setProperty(View view, float t) {
view.setTranslationZ(get(t));
}
}
static class CustomSet extends ViewOscillator {
protected ConstraintAttribute mCustom;
float[] value = new float[1];
CustomSet() {
}
@Override // androidx.constraintlayout.core.motion.utils.KeyCycleOscillator
protected void setCustom(Object custom) {
this.mCustom = (ConstraintAttribute) custom;
}
@Override // androidx.constraintlayout.motion.utils.ViewOscillator
public void setProperty(View view, float t) {
this.value[0] = get(t);
CustomSupport.setInterpolatedValue(this.mCustom, view, this.value);
}
}
static class ProgressSet extends ViewOscillator {
boolean mNoMethod = false;
ProgressSet() {
}
@Override // androidx.constraintlayout.motion.utils.ViewOscillator
public void setProperty(View view, float t) {
Method method;
if (view instanceof MotionLayout) {
((MotionLayout) view).setProgress(get(t));
return;
}
if (this.mNoMethod) {
return;
}
try {
method = view.getClass().getMethod("setProgress", Float.TYPE);
} catch (NoSuchMethodException unused) {
this.mNoMethod = true;
method = null;
}
if (method != null) {
try {
method.invoke(view, Float.valueOf(get(t)));
} catch (IllegalAccessException e) {
Log.e(ViewOscillator.TAG, "unable to setProgress", e);
} catch (InvocationTargetException e2) {
Log.e(ViewOscillator.TAG, "unable to setProgress", e2);
}
}
}
}
}

View File

@ -0,0 +1,243 @@
package androidx.constraintlayout.motion.utils;
import android.util.Log;
import android.util.SparseArray;
import android.view.View;
import androidx.constraintlayout.core.motion.utils.CurveFit;
import androidx.constraintlayout.core.motion.utils.SplineSet;
import androidx.constraintlayout.motion.widget.MotionLayout;
import androidx.constraintlayout.widget.ConstraintAttribute;
import java.lang.reflect.Array;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
/* loaded from: classes.dex */
public abstract class ViewSpline extends SplineSet {
private static final String TAG = "ViewSpline";
public abstract void setProperty(View view, float t);
public static ViewSpline makeCustomSpline(String str, SparseArray<ConstraintAttribute> attrList) {
return new CustomSet(str, attrList);
}
public static ViewSpline makeSpline(String str) {
str.hashCode();
switch (str) {
}
return new AlphaSet();
}
static class ElevationSet extends ViewSpline {
ElevationSet() {
}
@Override // androidx.constraintlayout.motion.utils.ViewSpline
public void setProperty(View view, float t) {
view.setElevation(get(t));
}
}
static class AlphaSet extends ViewSpline {
AlphaSet() {
}
@Override // androidx.constraintlayout.motion.utils.ViewSpline
public void setProperty(View view, float t) {
view.setAlpha(get(t));
}
}
static class RotationSet extends ViewSpline {
RotationSet() {
}
@Override // androidx.constraintlayout.motion.utils.ViewSpline
public void setProperty(View view, float t) {
view.setRotation(get(t));
}
}
static class RotationXset extends ViewSpline {
RotationXset() {
}
@Override // androidx.constraintlayout.motion.utils.ViewSpline
public void setProperty(View view, float t) {
view.setRotationX(get(t));
}
}
static class RotationYset extends ViewSpline {
RotationYset() {
}
@Override // androidx.constraintlayout.motion.utils.ViewSpline
public void setProperty(View view, float t) {
view.setRotationY(get(t));
}
}
static class PivotXset extends ViewSpline {
PivotXset() {
}
@Override // androidx.constraintlayout.motion.utils.ViewSpline
public void setProperty(View view, float t) {
view.setPivotX(get(t));
}
}
static class PivotYset extends ViewSpline {
PivotYset() {
}
@Override // androidx.constraintlayout.motion.utils.ViewSpline
public void setProperty(View view, float t) {
view.setPivotY(get(t));
}
}
public static class PathRotate extends ViewSpline {
@Override // androidx.constraintlayout.motion.utils.ViewSpline
public void setProperty(View view, float t) {
}
public void setPathRotate(View view, float t, double dx, double dy) {
view.setRotation(get(t) + ((float) Math.toDegrees(Math.atan2(dy, dx))));
}
}
static class ScaleXset extends ViewSpline {
ScaleXset() {
}
@Override // androidx.constraintlayout.motion.utils.ViewSpline
public void setProperty(View view, float t) {
view.setScaleX(get(t));
}
}
static class ScaleYset extends ViewSpline {
ScaleYset() {
}
@Override // androidx.constraintlayout.motion.utils.ViewSpline
public void setProperty(View view, float t) {
view.setScaleY(get(t));
}
}
static class TranslationXset extends ViewSpline {
TranslationXset() {
}
@Override // androidx.constraintlayout.motion.utils.ViewSpline
public void setProperty(View view, float t) {
view.setTranslationX(get(t));
}
}
static class TranslationYset extends ViewSpline {
TranslationYset() {
}
@Override // androidx.constraintlayout.motion.utils.ViewSpline
public void setProperty(View view, float t) {
view.setTranslationY(get(t));
}
}
static class TranslationZset extends ViewSpline {
TranslationZset() {
}
@Override // androidx.constraintlayout.motion.utils.ViewSpline
public void setProperty(View view, float t) {
view.setTranslationZ(get(t));
}
}
public static class CustomSet extends ViewSpline {
String mAttributeName;
SparseArray<ConstraintAttribute> mConstraintAttributeList;
float[] mTempValues;
public CustomSet(String attribute, SparseArray<ConstraintAttribute> attrList) {
this.mAttributeName = attribute.split(",")[1];
this.mConstraintAttributeList = attrList;
}
@Override // androidx.constraintlayout.core.motion.utils.SplineSet
public void setup(int curveType) {
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 i = 0; i < size; i++) {
int keyAt = this.mConstraintAttributeList.keyAt(i);
ConstraintAttribute valueAt = this.mConstraintAttributeList.valueAt(i);
dArr[i] = keyAt * 0.01d;
valueAt.getValuesToInterpolate(this.mTempValues);
int i2 = 0;
while (true) {
if (i2 < this.mTempValues.length) {
dArr2[i][i2] = r6[i2];
i2++;
}
}
}
this.mCurveFit = CurveFit.get(curveType, dArr, dArr2);
}
@Override // androidx.constraintlayout.core.motion.utils.SplineSet
public void setPoint(int position, float value) {
throw new RuntimeException("don't call for custom attribute call setPoint(pos, ConstraintAttribute)");
}
public void setPoint(int position, ConstraintAttribute value) {
this.mConstraintAttributeList.append(position, value);
}
@Override // androidx.constraintlayout.motion.utils.ViewSpline
public void setProperty(View view, float t) {
this.mCurveFit.getPos(t, this.mTempValues);
CustomSupport.setInterpolatedValue(this.mConstraintAttributeList.valueAt(0), view, this.mTempValues);
}
}
static class ProgressSet extends ViewSpline {
boolean mNoMethod = false;
ProgressSet() {
}
@Override // androidx.constraintlayout.motion.utils.ViewSpline
public void setProperty(View view, float t) {
Method method;
if (view instanceof MotionLayout) {
((MotionLayout) view).setProgress(get(t));
return;
}
if (this.mNoMethod) {
return;
}
try {
method = view.getClass().getMethod("setProgress", Float.TYPE);
} catch (NoSuchMethodException unused) {
this.mNoMethod = true;
method = null;
}
if (method != null) {
try {
method.invoke(view, Float.valueOf(get(t)));
} catch (IllegalAccessException e) {
Log.e(ViewSpline.TAG, "unable to setProgress", e);
} catch (InvocationTargetException e2) {
Log.e(ViewSpline.TAG, "unable to setProgress", e2);
}
}
}
}
}

View File

@ -0,0 +1,28 @@
package androidx.constraintlayout.motion.utils;
import android.view.View;
/* 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(View v) {
this.left = v.getLeft();
this.top = v.getTop();
this.right = v.getRight();
this.bottom = v.getBottom();
this.rotation = v.getRotation();
}
}

View File

@ -0,0 +1,336 @@
package androidx.constraintlayout.motion.utils;
import android.util.Log;
import android.util.SparseArray;
import android.view.View;
import androidx.constraintlayout.core.motion.utils.CurveFit;
import androidx.constraintlayout.core.motion.utils.KeyCache;
import androidx.constraintlayout.core.motion.utils.TimeCycleSplineSet;
import androidx.constraintlayout.motion.widget.MotionLayout;
import androidx.constraintlayout.widget.ConstraintAttribute;
import java.lang.reflect.Array;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
/* loaded from: classes.dex */
public abstract class ViewTimeCycle extends TimeCycleSplineSet {
private static final String TAG = "ViewTimeCycle";
public abstract boolean setProperty(View view, float t, long time, KeyCache cache);
public float get(float pos, long time, View view, KeyCache cache) {
this.mCurveFit.getPos(pos, this.mCache);
boolean z = true;
float f = this.mCache[1];
if (f == 0.0f) {
this.mContinue = false;
return this.mCache[2];
}
if (Float.isNaN(this.last_cycle)) {
this.last_cycle = cache.getFloatValue(view, this.mType, 0);
if (Float.isNaN(this.last_cycle)) {
this.last_cycle = 0.0f;
}
}
this.last_cycle = (float) ((this.last_cycle + (((time - this.last_time) * 1.0E-9d) * f)) % 1.0d);
cache.setFloatValue(view, this.mType, 0, this.last_cycle);
this.last_time = time;
float f2 = this.mCache[0];
float calcWave = (calcWave(this.last_cycle) * f2) + this.mCache[2];
if (f2 == 0.0f && f == 0.0f) {
z = false;
}
this.mContinue = z;
return calcWave;
}
public static ViewTimeCycle makeCustomSpline(String str, SparseArray<ConstraintAttribute> attrList) {
return new CustomSet(str, attrList);
}
public static ViewTimeCycle makeSpline(String str, long currentTime) {
ViewTimeCycle rotationXset;
str.hashCode();
switch (str) {
case "rotationX":
rotationXset = new RotationXset();
break;
case "rotationY":
rotationXset = new RotationYset();
break;
case "translationX":
rotationXset = new TranslationXset();
break;
case "translationY":
rotationXset = new TranslationYset();
break;
case "translationZ":
rotationXset = new TranslationZset();
break;
case "progress":
rotationXset = new ProgressSet();
break;
case "scaleX":
rotationXset = new ScaleXset();
break;
case "scaleY":
rotationXset = new ScaleYset();
break;
case "rotation":
rotationXset = new RotationSet();
break;
case "elevation":
rotationXset = new ElevationSet();
break;
case "transitionPathRotate":
rotationXset = new PathRotate();
break;
case "alpha":
rotationXset = new AlphaSet();
break;
default:
return null;
}
rotationXset.setStartTime(currentTime);
return rotationXset;
}
static class ElevationSet extends ViewTimeCycle {
ElevationSet() {
}
@Override // androidx.constraintlayout.motion.utils.ViewTimeCycle
public boolean setProperty(View view, float t, long time, KeyCache cache) {
view.setElevation(get(t, time, view, cache));
return this.mContinue;
}
}
static class AlphaSet extends ViewTimeCycle {
AlphaSet() {
}
@Override // androidx.constraintlayout.motion.utils.ViewTimeCycle
public boolean setProperty(View view, float t, long time, KeyCache cache) {
view.setAlpha(get(t, time, view, cache));
return this.mContinue;
}
}
static class RotationSet extends ViewTimeCycle {
RotationSet() {
}
@Override // androidx.constraintlayout.motion.utils.ViewTimeCycle
public boolean setProperty(View view, float t, long time, KeyCache cache) {
view.setRotation(get(t, time, view, cache));
return this.mContinue;
}
}
static class RotationXset extends ViewTimeCycle {
RotationXset() {
}
@Override // androidx.constraintlayout.motion.utils.ViewTimeCycle
public boolean setProperty(View view, float t, long time, KeyCache cache) {
view.setRotationX(get(t, time, view, cache));
return this.mContinue;
}
}
static class RotationYset extends ViewTimeCycle {
RotationYset() {
}
@Override // androidx.constraintlayout.motion.utils.ViewTimeCycle
public boolean setProperty(View view, float t, long time, KeyCache cache) {
view.setRotationY(get(t, time, view, cache));
return this.mContinue;
}
}
public static class PathRotate extends ViewTimeCycle {
@Override // androidx.constraintlayout.motion.utils.ViewTimeCycle
public boolean setProperty(View view, float t, long time, KeyCache cache) {
return this.mContinue;
}
public boolean setPathRotate(View view, KeyCache cache, float t, long time, double dx, double dy) {
view.setRotation(get(t, time, view, cache) + ((float) Math.toDegrees(Math.atan2(dy, dx))));
return this.mContinue;
}
}
static class ScaleXset extends ViewTimeCycle {
ScaleXset() {
}
@Override // androidx.constraintlayout.motion.utils.ViewTimeCycle
public boolean setProperty(View view, float t, long time, KeyCache cache) {
view.setScaleX(get(t, time, view, cache));
return this.mContinue;
}
}
static class ScaleYset extends ViewTimeCycle {
ScaleYset() {
}
@Override // androidx.constraintlayout.motion.utils.ViewTimeCycle
public boolean setProperty(View view, float t, long time, KeyCache cache) {
view.setScaleY(get(t, time, view, cache));
return this.mContinue;
}
}
static class TranslationXset extends ViewTimeCycle {
TranslationXset() {
}
@Override // androidx.constraintlayout.motion.utils.ViewTimeCycle
public boolean setProperty(View view, float t, long time, KeyCache cache) {
view.setTranslationX(get(t, time, view, cache));
return this.mContinue;
}
}
static class TranslationYset extends ViewTimeCycle {
TranslationYset() {
}
@Override // androidx.constraintlayout.motion.utils.ViewTimeCycle
public boolean setProperty(View view, float t, long time, KeyCache cache) {
view.setTranslationY(get(t, time, view, cache));
return this.mContinue;
}
}
static class TranslationZset extends ViewTimeCycle {
TranslationZset() {
}
@Override // androidx.constraintlayout.motion.utils.ViewTimeCycle
public boolean setProperty(View view, float t, long time, KeyCache cache) {
view.setTranslationZ(get(t, time, view, cache));
return this.mContinue;
}
}
public static class CustomSet extends ViewTimeCycle {
String mAttributeName;
float[] mCache;
SparseArray<ConstraintAttribute> mConstraintAttributeList;
float[] mTempValues;
SparseArray<float[]> mWaveProperties = new SparseArray<>();
public CustomSet(String attribute, SparseArray<ConstraintAttribute> attrList) {
this.mAttributeName = attribute.split(",")[1];
this.mConstraintAttributeList = attrList;
}
@Override // androidx.constraintlayout.core.motion.utils.TimeCycleSplineSet
public void setup(int curveType) {
int size = this.mConstraintAttributeList.size();
int numberOfInterpolatedValues = this.mConstraintAttributeList.valueAt(0).numberOfInterpolatedValues();
double[] dArr = new double[size];
int i = numberOfInterpolatedValues + 2;
this.mTempValues = new float[i];
this.mCache = new float[numberOfInterpolatedValues];
double[][] dArr2 = (double[][]) Array.newInstance((Class<?>) Double.TYPE, size, i);
for (int i2 = 0; i2 < size; i2++) {
int keyAt = this.mConstraintAttributeList.keyAt(i2);
ConstraintAttribute valueAt = this.mConstraintAttributeList.valueAt(i2);
float[] valueAt2 = this.mWaveProperties.valueAt(i2);
dArr[i2] = keyAt * 0.01d;
valueAt.getValuesToInterpolate(this.mTempValues);
int i3 = 0;
while (true) {
if (i3 < this.mTempValues.length) {
dArr2[i2][i3] = r7[i3];
i3++;
}
}
double[] dArr3 = dArr2[i2];
dArr3[numberOfInterpolatedValues] = valueAt2[0];
dArr3[numberOfInterpolatedValues + 1] = valueAt2[1];
}
this.mCurveFit = CurveFit.get(curveType, dArr, dArr2);
}
@Override // androidx.constraintlayout.core.motion.utils.TimeCycleSplineSet
public void setPoint(int position, float value, float period, int shape, float offset) {
throw new RuntimeException("don't call for custom attribute call setPoint(pos, ConstraintAttribute,...)");
}
public void setPoint(int position, ConstraintAttribute value, float period, int shape, float offset) {
this.mConstraintAttributeList.append(position, value);
this.mWaveProperties.append(position, new float[]{period, offset});
this.mWaveShape = Math.max(this.mWaveShape, shape);
}
@Override // androidx.constraintlayout.motion.utils.ViewTimeCycle
public boolean setProperty(View view, float t, long time, KeyCache cache) {
this.mCurveFit.getPos(t, this.mTempValues);
float[] fArr = this.mTempValues;
float f = fArr[fArr.length - 2];
float f2 = fArr[fArr.length - 1];
long j = time - this.last_time;
if (Float.isNaN(this.last_cycle)) {
this.last_cycle = cache.getFloatValue(view, this.mAttributeName, 0);
if (Float.isNaN(this.last_cycle)) {
this.last_cycle = 0.0f;
}
}
this.last_cycle = (float) ((this.last_cycle + ((j * 1.0E-9d) * f)) % 1.0d);
this.last_time = time;
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) + f2;
}
CustomSupport.setInterpolatedValue(this.mConstraintAttributeList.valueAt(0), view, this.mCache);
if (f != 0.0f) {
this.mContinue = true;
}
return this.mContinue;
}
}
static class ProgressSet extends ViewTimeCycle {
boolean mNoMethod = false;
ProgressSet() {
}
@Override // androidx.constraintlayout.motion.utils.ViewTimeCycle
public boolean setProperty(View view, float t, long time, KeyCache cache) {
Method method;
if (view instanceof MotionLayout) {
((MotionLayout) view).setProgress(get(t, time, view, cache));
} else {
if (this.mNoMethod) {
return false;
}
try {
method = view.getClass().getMethod("setProgress", Float.TYPE);
} catch (NoSuchMethodException unused) {
this.mNoMethod = true;
method = null;
}
Method method2 = method;
if (method2 != null) {
try {
method2.invoke(view, Float.valueOf(get(t, time, view, cache)));
} catch (IllegalAccessException e) {
Log.e(ViewTimeCycle.TAG, "unable to setProgress", e);
} catch (InvocationTargetException e2) {
Log.e(ViewTimeCycle.TAG, "unable to setProgress", e2);
}
}
}
return this.mContinue;
}
}
}