ADD week 5
This commit is contained in:
@ -0,0 +1,8 @@
|
||||
package androidx.constraintlayout.motion.widget;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface Animatable {
|
||||
float getProgress();
|
||||
|
||||
void setProgress(float progress);
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package androidx.constraintlayout.motion.widget;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface CustomFloatAttributes {
|
||||
float get(String attribute);
|
||||
|
||||
String[] getListOfAttributes();
|
||||
|
||||
void set(String attribute, float value);
|
||||
}
|
@ -0,0 +1,191 @@
|
||||
package androidx.constraintlayout.motion.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.nio.CharBuffer;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class Debug {
|
||||
public static void logStack(String tag, String msg, int n) {
|
||||
StackTraceElement[] stackTrace = new Throwable().getStackTrace();
|
||||
int min = Math.min(n, stackTrace.length - 1);
|
||||
String str = " ";
|
||||
for (int i = 1; i <= min; i++) {
|
||||
StackTraceElement stackTraceElement = stackTrace[i];
|
||||
str = str + " ";
|
||||
Log.v(tag, msg + str + (".(" + stackTrace[i].getFileName() + ":" + stackTrace[i].getLineNumber() + ") " + stackTrace[i].getMethodName()) + str);
|
||||
}
|
||||
}
|
||||
|
||||
public static void printStack(String msg, int n) {
|
||||
StackTraceElement[] stackTrace = new Throwable().getStackTrace();
|
||||
int min = Math.min(n, stackTrace.length - 1);
|
||||
String str = " ";
|
||||
for (int i = 1; i <= min; i++) {
|
||||
StackTraceElement stackTraceElement = stackTrace[i];
|
||||
String str2 = ".(" + stackTrace[i].getFileName() + ":" + stackTrace[i].getLineNumber() + ") ";
|
||||
str = str + " ";
|
||||
System.out.println(msg + str + str2 + str);
|
||||
}
|
||||
}
|
||||
|
||||
public static String getName(View view) {
|
||||
try {
|
||||
return view.getContext().getResources().getResourceEntryName(view.getId());
|
||||
} catch (Exception unused) {
|
||||
return "UNKNOWN";
|
||||
}
|
||||
}
|
||||
|
||||
public static void dumpPoc(Object obj) {
|
||||
StackTraceElement stackTraceElement = new Throwable().getStackTrace()[1];
|
||||
String str = ".(" + stackTraceElement.getFileName() + ":" + stackTraceElement.getLineNumber() + ")";
|
||||
Class<?> cls = obj.getClass();
|
||||
System.out.println(str + "------------- " + cls.getName() + " --------------------");
|
||||
for (Field field : cls.getFields()) {
|
||||
try {
|
||||
Object obj2 = field.get(obj);
|
||||
if (field.getName().startsWith("layout_constraint") && ((!(obj2 instanceof Integer) || !obj2.toString().equals("-1")) && ((!(obj2 instanceof Integer) || !obj2.toString().equals("0")) && ((!(obj2 instanceof Float) || !obj2.toString().equals("1.0")) && (!(obj2 instanceof Float) || !obj2.toString().equals("0.5")))))) {
|
||||
System.out.println(str + " " + field.getName() + " " + obj2);
|
||||
}
|
||||
} catch (IllegalAccessException unused) {
|
||||
}
|
||||
}
|
||||
System.out.println(str + "------------- " + cls.getSimpleName() + " --------------------");
|
||||
}
|
||||
|
||||
public static String getName(Context context, int id) {
|
||||
if (id == -1) {
|
||||
return "UNKNOWN";
|
||||
}
|
||||
try {
|
||||
return context.getResources().getResourceEntryName(id);
|
||||
} catch (Exception unused) {
|
||||
return "?" + id;
|
||||
}
|
||||
}
|
||||
|
||||
public static String getName(Context context, int[] id) {
|
||||
String str;
|
||||
try {
|
||||
String str2 = id.length + "[";
|
||||
int i = 0;
|
||||
while (i < id.length) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(str2);
|
||||
sb.append(i == 0 ? "" : " ");
|
||||
String sb2 = sb.toString();
|
||||
try {
|
||||
str = context.getResources().getResourceEntryName(id[i]);
|
||||
} catch (Resources.NotFoundException unused) {
|
||||
str = "? " + id[i] + " ";
|
||||
}
|
||||
str2 = sb2 + str;
|
||||
i++;
|
||||
}
|
||||
return str2 + "]";
|
||||
} catch (Exception e) {
|
||||
Log.v("DEBUG", e.toString());
|
||||
return "UNKNOWN";
|
||||
}
|
||||
}
|
||||
|
||||
public static String getState(MotionLayout layout, int stateId) {
|
||||
return getState(layout, stateId, -1);
|
||||
}
|
||||
|
||||
public static String getState(MotionLayout layout, int stateId, int len) {
|
||||
int length;
|
||||
if (stateId == -1) {
|
||||
return "UNDEFINED";
|
||||
}
|
||||
String resourceEntryName = layout.getContext().getResources().getResourceEntryName(stateId);
|
||||
if (len == -1) {
|
||||
return resourceEntryName;
|
||||
}
|
||||
if (resourceEntryName.length() > len) {
|
||||
resourceEntryName = resourceEntryName.replaceAll("([^_])[aeiou]+", "$1");
|
||||
}
|
||||
if (resourceEntryName.length() <= len || (length = resourceEntryName.replaceAll("[^_]", "").length()) <= 0) {
|
||||
return resourceEntryName;
|
||||
}
|
||||
return resourceEntryName.replaceAll(CharBuffer.allocate((resourceEntryName.length() - len) / length).toString().replace((char) 0, '.') + "_", "_");
|
||||
}
|
||||
|
||||
public static String getActionType(MotionEvent event) {
|
||||
int action = event.getAction();
|
||||
for (Field field : MotionEvent.class.getFields()) {
|
||||
try {
|
||||
if (Modifier.isStatic(field.getModifiers()) && field.getType().equals(Integer.TYPE) && field.getInt(null) == action) {
|
||||
return field.getName();
|
||||
}
|
||||
} catch (IllegalAccessException unused) {
|
||||
}
|
||||
}
|
||||
return "---";
|
||||
}
|
||||
|
||||
public static String getLocation() {
|
||||
StackTraceElement stackTraceElement = new Throwable().getStackTrace()[1];
|
||||
return ".(" + stackTraceElement.getFileName() + ":" + stackTraceElement.getLineNumber() + ")";
|
||||
}
|
||||
|
||||
public static String getLoc() {
|
||||
StackTraceElement stackTraceElement = new Throwable().getStackTrace()[1];
|
||||
return ".(" + stackTraceElement.getFileName() + ":" + stackTraceElement.getLineNumber() + ") " + stackTraceElement.getMethodName() + "()";
|
||||
}
|
||||
|
||||
public static String getLocation2() {
|
||||
StackTraceElement stackTraceElement = new Throwable().getStackTrace()[2];
|
||||
return ".(" + stackTraceElement.getFileName() + ":" + stackTraceElement.getLineNumber() + ")";
|
||||
}
|
||||
|
||||
public static String getCallFrom(int n) {
|
||||
StackTraceElement stackTraceElement = new Throwable().getStackTrace()[n + 2];
|
||||
return ".(" + stackTraceElement.getFileName() + ":" + stackTraceElement.getLineNumber() + ")";
|
||||
}
|
||||
|
||||
public static void dumpLayoutParams(ViewGroup layout, String str) {
|
||||
StackTraceElement stackTraceElement = new Throwable().getStackTrace()[1];
|
||||
String str2 = ".(" + stackTraceElement.getFileName() + ":" + stackTraceElement.getLineNumber() + ") " + str + " ";
|
||||
int childCount = layout.getChildCount();
|
||||
System.out.println(str + " children " + childCount);
|
||||
for (int i = 0; i < childCount; i++) {
|
||||
View childAt = layout.getChildAt(i);
|
||||
System.out.println(str2 + " " + getName(childAt));
|
||||
ViewGroup.LayoutParams layoutParams = childAt.getLayoutParams();
|
||||
for (Field field : layoutParams.getClass().getFields()) {
|
||||
try {
|
||||
Object obj = field.get(layoutParams);
|
||||
if (field.getName().contains("To") && !obj.toString().equals("-1")) {
|
||||
System.out.println(str2 + " " + field.getName() + " " + obj);
|
||||
}
|
||||
} catch (IllegalAccessException unused) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void dumpLayoutParams(ViewGroup.LayoutParams param, String str) {
|
||||
StackTraceElement stackTraceElement = new Throwable().getStackTrace()[1];
|
||||
String str2 = ".(" + stackTraceElement.getFileName() + ":" + stackTraceElement.getLineNumber() + ") " + str + " ";
|
||||
System.out.println(" >>>>>>>>>>>>>>>>>>. dump " + str2 + " " + param.getClass().getName());
|
||||
for (Field field : param.getClass().getFields()) {
|
||||
try {
|
||||
Object obj = field.get(param);
|
||||
String name = field.getName();
|
||||
if (name.contains("To") && !obj.toString().equals("-1")) {
|
||||
System.out.println(str2 + " " + name + " " + obj);
|
||||
}
|
||||
} catch (IllegalAccessException unused) {
|
||||
}
|
||||
}
|
||||
System.out.println(" <<<<<<<<<<<<<<<<< dump " + str2);
|
||||
}
|
||||
}
|
@ -0,0 +1,440 @@
|
||||
package androidx.constraintlayout.motion.widget;
|
||||
|
||||
import android.util.Pair;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import androidx.constraintlayout.widget.ConstraintSet;
|
||||
import java.util.HashMap;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DesignTool implements ProxyInterface {
|
||||
private static final boolean DEBUG = false;
|
||||
private static final String TAG = "DesignTool";
|
||||
static final HashMap<Pair<Integer, Integer>, String> allAttributes;
|
||||
static final HashMap<String, String> allMargins;
|
||||
private final MotionLayout mMotionLayout;
|
||||
private MotionScene mSceneCache;
|
||||
private String mLastStartState = null;
|
||||
private String mLastEndState = null;
|
||||
private int mLastStartStateId = -1;
|
||||
private int mLastEndStateId = -1;
|
||||
|
||||
public boolean isInTransition() {
|
||||
return (this.mLastStartState == null || this.mLastEndState == null) ? false : true;
|
||||
}
|
||||
|
||||
public DesignTool(MotionLayout motionLayout) {
|
||||
this.mMotionLayout = motionLayout;
|
||||
}
|
||||
|
||||
static {
|
||||
HashMap<Pair<Integer, Integer>, String> hashMap = new HashMap<>();
|
||||
allAttributes = hashMap;
|
||||
HashMap<String, String> hashMap2 = new HashMap<>();
|
||||
allMargins = hashMap2;
|
||||
hashMap.put(Pair.create(4, 4), "layout_constraintBottom_toBottomOf");
|
||||
hashMap.put(Pair.create(4, 3), "layout_constraintBottom_toTopOf");
|
||||
hashMap.put(Pair.create(3, 4), "layout_constraintTop_toBottomOf");
|
||||
hashMap.put(Pair.create(3, 3), "layout_constraintTop_toTopOf");
|
||||
hashMap.put(Pair.create(6, 6), "layout_constraintStart_toStartOf");
|
||||
hashMap.put(Pair.create(6, 7), "layout_constraintStart_toEndOf");
|
||||
hashMap.put(Pair.create(7, 6), "layout_constraintEnd_toStartOf");
|
||||
hashMap.put(Pair.create(7, 7), "layout_constraintEnd_toEndOf");
|
||||
hashMap.put(Pair.create(1, 1), "layout_constraintLeft_toLeftOf");
|
||||
hashMap.put(Pair.create(1, 2), "layout_constraintLeft_toRightOf");
|
||||
hashMap.put(Pair.create(2, 2), "layout_constraintRight_toRightOf");
|
||||
hashMap.put(Pair.create(2, 1), "layout_constraintRight_toLeftOf");
|
||||
hashMap.put(Pair.create(5, 5), "layout_constraintBaseline_toBaselineOf");
|
||||
hashMap2.put("layout_constraintBottom_toBottomOf", "layout_marginBottom");
|
||||
hashMap2.put("layout_constraintBottom_toTopOf", "layout_marginBottom");
|
||||
hashMap2.put("layout_constraintTop_toBottomOf", "layout_marginTop");
|
||||
hashMap2.put("layout_constraintTop_toTopOf", "layout_marginTop");
|
||||
hashMap2.put("layout_constraintStart_toStartOf", "layout_marginStart");
|
||||
hashMap2.put("layout_constraintStart_toEndOf", "layout_marginStart");
|
||||
hashMap2.put("layout_constraintEnd_toStartOf", "layout_marginEnd");
|
||||
hashMap2.put("layout_constraintEnd_toEndOf", "layout_marginEnd");
|
||||
hashMap2.put("layout_constraintLeft_toLeftOf", "layout_marginLeft");
|
||||
hashMap2.put("layout_constraintLeft_toRightOf", "layout_marginLeft");
|
||||
hashMap2.put("layout_constraintRight_toRightOf", "layout_marginRight");
|
||||
hashMap2.put("layout_constraintRight_toLeftOf", "layout_marginRight");
|
||||
}
|
||||
|
||||
private static int GetPxFromDp(int dpi, String value) {
|
||||
int indexOf;
|
||||
if (value == null || (indexOf = value.indexOf(100)) == -1) {
|
||||
return 0;
|
||||
}
|
||||
return (int) ((Integer.valueOf(value.substring(0, indexOf)).intValue() * dpi) / 160.0f);
|
||||
}
|
||||
|
||||
private static void Connect(int dpi, ConstraintSet set, View view, HashMap<String, String> attributes, int from, int to) {
|
||||
String str = allAttributes.get(Pair.create(Integer.valueOf(from), Integer.valueOf(to)));
|
||||
String str2 = attributes.get(str);
|
||||
if (str2 != null) {
|
||||
String str3 = allMargins.get(str);
|
||||
set.connect(view.getId(), from, Integer.parseInt(str2), to, str3 != null ? GetPxFromDp(dpi, attributes.get(str3)) : 0);
|
||||
}
|
||||
}
|
||||
|
||||
private static void SetBias(ConstraintSet set, View view, HashMap<String, String> attributes, int type) {
|
||||
String str = attributes.get(type == 1 ? "layout_constraintVertical_bias" : "layout_constraintHorizontal_bias");
|
||||
if (str != null) {
|
||||
if (type == 0) {
|
||||
set.setHorizontalBias(view.getId(), Float.parseFloat(str));
|
||||
} else if (type == 1) {
|
||||
set.setVerticalBias(view.getId(), Float.parseFloat(str));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void SetDimensions(int dpi, ConstraintSet set, View view, HashMap<String, String> attributes, int type) {
|
||||
String str = attributes.get(type == 1 ? "layout_height" : "layout_width");
|
||||
if (str != null) {
|
||||
int GetPxFromDp = !str.equalsIgnoreCase("wrap_content") ? GetPxFromDp(dpi, str) : -2;
|
||||
if (type == 0) {
|
||||
set.constrainWidth(view.getId(), GetPxFromDp);
|
||||
} else {
|
||||
set.constrainHeight(view.getId(), GetPxFromDp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void SetAbsolutePositions(int dpi, ConstraintSet set, View view, HashMap<String, String> attributes) {
|
||||
String str = attributes.get("layout_editor_absoluteX");
|
||||
if (str != null) {
|
||||
set.setEditorAbsoluteX(view.getId(), GetPxFromDp(dpi, str));
|
||||
}
|
||||
String str2 = attributes.get("layout_editor_absoluteY");
|
||||
if (str2 != null) {
|
||||
set.setEditorAbsoluteY(view.getId(), GetPxFromDp(dpi, str2));
|
||||
}
|
||||
}
|
||||
|
||||
public int getAnimationPath(Object view, float[] path, int len) {
|
||||
if (this.mMotionLayout.mScene == null) {
|
||||
return -1;
|
||||
}
|
||||
MotionController motionController = this.mMotionLayout.mFrameArrayList.get(view);
|
||||
if (motionController == null) {
|
||||
return 0;
|
||||
}
|
||||
motionController.buildPath(path, len);
|
||||
return len;
|
||||
}
|
||||
|
||||
public void getAnimationRectangles(Object view, float[] path) {
|
||||
if (this.mMotionLayout.mScene == null) {
|
||||
return;
|
||||
}
|
||||
int duration = this.mMotionLayout.mScene.getDuration() / 16;
|
||||
MotionController motionController = this.mMotionLayout.mFrameArrayList.get(view);
|
||||
if (motionController == null) {
|
||||
return;
|
||||
}
|
||||
motionController.buildRectangles(path, duration);
|
||||
}
|
||||
|
||||
public int getAnimationKeyFrames(Object view, float[] key) {
|
||||
if (this.mMotionLayout.mScene == null) {
|
||||
return -1;
|
||||
}
|
||||
int duration = this.mMotionLayout.mScene.getDuration() / 16;
|
||||
MotionController motionController = this.mMotionLayout.mFrameArrayList.get(view);
|
||||
if (motionController == null) {
|
||||
return 0;
|
||||
}
|
||||
motionController.buildKeyFrames(key, null);
|
||||
return duration;
|
||||
}
|
||||
|
||||
@Override // androidx.constraintlayout.motion.widget.ProxyInterface
|
||||
public void setToolPosition(float position) {
|
||||
if (this.mMotionLayout.mScene == null) {
|
||||
this.mMotionLayout.mScene = this.mSceneCache;
|
||||
}
|
||||
this.mMotionLayout.setProgress(position);
|
||||
this.mMotionLayout.evaluate(true);
|
||||
this.mMotionLayout.requestLayout();
|
||||
this.mMotionLayout.invalidate();
|
||||
}
|
||||
|
||||
public void setState(String id) {
|
||||
if (id == null) {
|
||||
id = "motion_base";
|
||||
}
|
||||
if (this.mLastStartState == id) {
|
||||
return;
|
||||
}
|
||||
this.mLastStartState = id;
|
||||
this.mLastEndState = null;
|
||||
if (this.mMotionLayout.mScene == null) {
|
||||
this.mMotionLayout.mScene = this.mSceneCache;
|
||||
}
|
||||
int lookUpConstraintId = this.mMotionLayout.lookUpConstraintId(id);
|
||||
this.mLastStartStateId = lookUpConstraintId;
|
||||
if (lookUpConstraintId != 0) {
|
||||
if (lookUpConstraintId == this.mMotionLayout.getStartState()) {
|
||||
this.mMotionLayout.setProgress(0.0f);
|
||||
} else if (lookUpConstraintId == this.mMotionLayout.getEndState()) {
|
||||
this.mMotionLayout.setProgress(1.0f);
|
||||
} else {
|
||||
this.mMotionLayout.transitionToState(lookUpConstraintId);
|
||||
this.mMotionLayout.setProgress(1.0f);
|
||||
}
|
||||
}
|
||||
this.mMotionLayout.requestLayout();
|
||||
}
|
||||
|
||||
public String getStartState() {
|
||||
int startState = this.mMotionLayout.getStartState();
|
||||
if (this.mLastStartStateId == startState) {
|
||||
return this.mLastStartState;
|
||||
}
|
||||
String constraintSetNames = this.mMotionLayout.getConstraintSetNames(startState);
|
||||
if (constraintSetNames != null) {
|
||||
this.mLastStartState = constraintSetNames;
|
||||
this.mLastStartStateId = startState;
|
||||
}
|
||||
return this.mMotionLayout.getConstraintSetNames(startState);
|
||||
}
|
||||
|
||||
public String getEndState() {
|
||||
int endState = this.mMotionLayout.getEndState();
|
||||
if (this.mLastEndStateId == endState) {
|
||||
return this.mLastEndState;
|
||||
}
|
||||
String constraintSetNames = this.mMotionLayout.getConstraintSetNames(endState);
|
||||
if (constraintSetNames != null) {
|
||||
this.mLastEndState = constraintSetNames;
|
||||
this.mLastEndStateId = endState;
|
||||
}
|
||||
return constraintSetNames;
|
||||
}
|
||||
|
||||
public float getProgress() {
|
||||
return this.mMotionLayout.getProgress();
|
||||
}
|
||||
|
||||
public String getState() {
|
||||
if (this.mLastStartState != null && this.mLastEndState != null) {
|
||||
float progress = getProgress();
|
||||
if (progress <= 0.01f) {
|
||||
return this.mLastStartState;
|
||||
}
|
||||
if (progress >= 0.99f) {
|
||||
return this.mLastEndState;
|
||||
}
|
||||
}
|
||||
return this.mLastStartState;
|
||||
}
|
||||
|
||||
public void setTransition(String start, String end) {
|
||||
if (this.mMotionLayout.mScene == null) {
|
||||
this.mMotionLayout.mScene = this.mSceneCache;
|
||||
}
|
||||
int lookUpConstraintId = this.mMotionLayout.lookUpConstraintId(start);
|
||||
int lookUpConstraintId2 = this.mMotionLayout.lookUpConstraintId(end);
|
||||
this.mMotionLayout.setTransition(lookUpConstraintId, lookUpConstraintId2);
|
||||
this.mLastStartStateId = lookUpConstraintId;
|
||||
this.mLastEndStateId = lookUpConstraintId2;
|
||||
this.mLastStartState = start;
|
||||
this.mLastEndState = end;
|
||||
}
|
||||
|
||||
public void disableAutoTransition(boolean disable) {
|
||||
this.mMotionLayout.disableAutoTransition(disable);
|
||||
}
|
||||
|
||||
@Override // androidx.constraintlayout.motion.widget.ProxyInterface
|
||||
public long getTransitionTimeMs() {
|
||||
return this.mMotionLayout.getTransitionTimeMs();
|
||||
}
|
||||
|
||||
public int getKeyFramePositions(Object view, int[] type, float[] pos) {
|
||||
MotionController motionController = this.mMotionLayout.mFrameArrayList.get((View) view);
|
||||
if (motionController == null) {
|
||||
return 0;
|
||||
}
|
||||
return motionController.getKeyFramePositions(type, pos);
|
||||
}
|
||||
|
||||
public int getKeyFrameInfo(Object view, int type, int[] info) {
|
||||
MotionController motionController = this.mMotionLayout.mFrameArrayList.get((View) view);
|
||||
if (motionController == null) {
|
||||
return 0;
|
||||
}
|
||||
return motionController.getKeyFrameInfo(type, info);
|
||||
}
|
||||
|
||||
@Override // androidx.constraintlayout.motion.widget.ProxyInterface
|
||||
public float getKeyFramePosition(Object view, int type, float x, float y) {
|
||||
MotionController motionController;
|
||||
if ((view instanceof View) && (motionController = this.mMotionLayout.mFrameArrayList.get((View) view)) != null) {
|
||||
return motionController.getKeyFrameParameter(type, x, y);
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
@Override // androidx.constraintlayout.motion.widget.ProxyInterface
|
||||
public void setKeyFrame(Object view, int position, String name, Object value) {
|
||||
if (this.mMotionLayout.mScene != null) {
|
||||
this.mMotionLayout.mScene.setKeyframe((View) view, position, name, value);
|
||||
this.mMotionLayout.mTransitionGoalPosition = position / 100.0f;
|
||||
this.mMotionLayout.mTransitionLastPosition = 0.0f;
|
||||
this.mMotionLayout.rebuildScene();
|
||||
this.mMotionLayout.evaluate(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.constraintlayout.motion.widget.ProxyInterface
|
||||
public boolean setKeyFramePosition(Object view, int position, int type, float x, float y) {
|
||||
if ((view instanceof View) && this.mMotionLayout.mScene != null) {
|
||||
MotionController motionController = this.mMotionLayout.mFrameArrayList.get(view);
|
||||
int i = (int) (this.mMotionLayout.mTransitionPosition * 100.0f);
|
||||
if (motionController != null) {
|
||||
View view2 = (View) view;
|
||||
if (this.mMotionLayout.mScene.hasKeyFramePosition(view2, i)) {
|
||||
float keyFrameParameter = motionController.getKeyFrameParameter(2, x, y);
|
||||
float keyFrameParameter2 = motionController.getKeyFrameParameter(5, x, y);
|
||||
this.mMotionLayout.mScene.setKeyframe(view2, i, "motion:percentX", Float.valueOf(keyFrameParameter));
|
||||
this.mMotionLayout.mScene.setKeyframe(view2, i, "motion:percentY", Float.valueOf(keyFrameParameter2));
|
||||
this.mMotionLayout.rebuildScene();
|
||||
this.mMotionLayout.evaluate(true);
|
||||
this.mMotionLayout.invalidate();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setViewDebug(Object view, int debugMode) {
|
||||
MotionController motionController;
|
||||
if ((view instanceof View) && (motionController = this.mMotionLayout.mFrameArrayList.get(view)) != null) {
|
||||
motionController.setDrawPath(debugMode);
|
||||
this.mMotionLayout.invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.constraintlayout.motion.widget.ProxyInterface
|
||||
public int designAccess(int cmd, String type, Object viewObject, float[] in, int inLength, float[] out, int outLength) {
|
||||
MotionController motionController;
|
||||
View view = (View) viewObject;
|
||||
if (cmd == 0) {
|
||||
motionController = null;
|
||||
} else if (this.mMotionLayout.mScene == null || view == null || (motionController = this.mMotionLayout.mFrameArrayList.get(view)) == null) {
|
||||
return -1;
|
||||
}
|
||||
if (cmd == 0) {
|
||||
return 1;
|
||||
}
|
||||
if (cmd == 1) {
|
||||
int duration = this.mMotionLayout.mScene.getDuration() / 16;
|
||||
motionController.buildPath(out, duration);
|
||||
return duration;
|
||||
}
|
||||
if (cmd == 2) {
|
||||
int duration2 = this.mMotionLayout.mScene.getDuration() / 16;
|
||||
motionController.buildKeyFrames(out, null);
|
||||
return duration2;
|
||||
}
|
||||
if (cmd != 3) {
|
||||
return -1;
|
||||
}
|
||||
int duration3 = this.mMotionLayout.mScene.getDuration() / 16;
|
||||
return motionController.getAttributeValues(type, out, outLength);
|
||||
}
|
||||
|
||||
public Object getKeyframe(int type, int target, int position) {
|
||||
if (this.mMotionLayout.mScene == null) {
|
||||
return null;
|
||||
}
|
||||
return this.mMotionLayout.mScene.getKeyFrame(this.mMotionLayout.getContext(), type, target, position);
|
||||
}
|
||||
|
||||
@Override // androidx.constraintlayout.motion.widget.ProxyInterface
|
||||
public Object getKeyframeAtLocation(Object viewObject, float x, float y) {
|
||||
MotionController motionController;
|
||||
View view = (View) viewObject;
|
||||
if (this.mMotionLayout.mScene == null) {
|
||||
return -1;
|
||||
}
|
||||
if (view == null || (motionController = this.mMotionLayout.mFrameArrayList.get(view)) == null) {
|
||||
return null;
|
||||
}
|
||||
ViewGroup viewGroup = (ViewGroup) view.getParent();
|
||||
return motionController.getPositionKeyframe(viewGroup.getWidth(), viewGroup.getHeight(), x, y);
|
||||
}
|
||||
|
||||
@Override // androidx.constraintlayout.motion.widget.ProxyInterface
|
||||
public Boolean getPositionKeyframe(Object keyFrame, Object view, float x, float y, String[] attribute, float[] value) {
|
||||
if (keyFrame instanceof KeyPositionBase) {
|
||||
View view2 = (View) view;
|
||||
this.mMotionLayout.mFrameArrayList.get(view2).positionKeyframe(view2, (KeyPositionBase) keyFrame, x, y, attribute, value);
|
||||
this.mMotionLayout.rebuildScene();
|
||||
this.mMotionLayout.mInTransition = true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public Object getKeyframe(Object view, int type, int position) {
|
||||
if (this.mMotionLayout.mScene == null) {
|
||||
return null;
|
||||
}
|
||||
return this.mMotionLayout.mScene.getKeyFrame(this.mMotionLayout.getContext(), type, ((View) view).getId(), position);
|
||||
}
|
||||
|
||||
public void setKeyframe(Object keyFrame, String tag, Object value) {
|
||||
if (keyFrame instanceof Key) {
|
||||
((Key) keyFrame).setValue(tag, value);
|
||||
this.mMotionLayout.rebuildScene();
|
||||
this.mMotionLayout.mInTransition = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.constraintlayout.motion.widget.ProxyInterface
|
||||
public void setAttributes(int dpi, String constraintSetId, Object opaqueView, Object opaqueAttributes) {
|
||||
View view = (View) opaqueView;
|
||||
HashMap hashMap = (HashMap) opaqueAttributes;
|
||||
int lookUpConstraintId = this.mMotionLayout.lookUpConstraintId(constraintSetId);
|
||||
ConstraintSet constraintSet = this.mMotionLayout.mScene.getConstraintSet(lookUpConstraintId);
|
||||
if (constraintSet == null) {
|
||||
return;
|
||||
}
|
||||
constraintSet.clear(view.getId());
|
||||
SetDimensions(dpi, constraintSet, view, hashMap, 0);
|
||||
SetDimensions(dpi, constraintSet, view, hashMap, 1);
|
||||
Connect(dpi, constraintSet, view, hashMap, 6, 6);
|
||||
Connect(dpi, constraintSet, view, hashMap, 6, 7);
|
||||
Connect(dpi, constraintSet, view, hashMap, 7, 7);
|
||||
Connect(dpi, constraintSet, view, hashMap, 7, 6);
|
||||
Connect(dpi, constraintSet, view, hashMap, 1, 1);
|
||||
Connect(dpi, constraintSet, view, hashMap, 1, 2);
|
||||
Connect(dpi, constraintSet, view, hashMap, 2, 2);
|
||||
Connect(dpi, constraintSet, view, hashMap, 2, 1);
|
||||
Connect(dpi, constraintSet, view, hashMap, 3, 3);
|
||||
Connect(dpi, constraintSet, view, hashMap, 3, 4);
|
||||
Connect(dpi, constraintSet, view, hashMap, 4, 3);
|
||||
Connect(dpi, constraintSet, view, hashMap, 4, 4);
|
||||
Connect(dpi, constraintSet, view, hashMap, 5, 5);
|
||||
SetBias(constraintSet, view, hashMap, 0);
|
||||
SetBias(constraintSet, view, hashMap, 1);
|
||||
SetAbsolutePositions(dpi, constraintSet, view, hashMap);
|
||||
this.mMotionLayout.updateState(lookUpConstraintId, constraintSet);
|
||||
this.mMotionLayout.requestLayout();
|
||||
}
|
||||
|
||||
public void dumpConstraintSet(String set) {
|
||||
if (this.mMotionLayout.mScene == null) {
|
||||
this.mMotionLayout.mScene = this.mSceneCache;
|
||||
}
|
||||
int lookUpConstraintId = this.mMotionLayout.lookUpConstraintId(set);
|
||||
System.out.println(" dumping " + set + " (" + lookUpConstraintId + ")");
|
||||
try {
|
||||
this.mMotionLayout.mScene.getConstraintSet(lookUpConstraintId).dump(this.mMotionLayout.mScene, new int[0]);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
package androidx.constraintlayout.motion.widget;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface FloatLayout {
|
||||
void layout(float lf, float tf, float rf, float bf);
|
||||
}
|
@ -0,0 +1,105 @@
|
||||
package androidx.constraintlayout.motion.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import androidx.constraintlayout.motion.utils.ViewSpline;
|
||||
import androidx.constraintlayout.widget.ConstraintAttribute;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class Key {
|
||||
public static final String ALPHA = "alpha";
|
||||
public static final String CURVEFIT = "curveFit";
|
||||
public static final String CUSTOM = "CUSTOM";
|
||||
public static final String ELEVATION = "elevation";
|
||||
public static final String MOTIONPROGRESS = "motionProgress";
|
||||
public static final String PIVOT_X = "transformPivotX";
|
||||
public static final String PIVOT_Y = "transformPivotY";
|
||||
public static final String PROGRESS = "progress";
|
||||
public static final String ROTATION = "rotation";
|
||||
public static final String ROTATION_X = "rotationX";
|
||||
public static final String ROTATION_Y = "rotationY";
|
||||
public static final String SCALE_X = "scaleX";
|
||||
public static final String SCALE_Y = "scaleY";
|
||||
public static final String TRANSITIONEASING = "transitionEasing";
|
||||
public static final String TRANSITION_PATH_ROTATE = "transitionPathRotate";
|
||||
public static final String TRANSLATION_X = "translationX";
|
||||
public static final String TRANSLATION_Y = "translationY";
|
||||
public static final String TRANSLATION_Z = "translationZ";
|
||||
public static int UNSET = -1;
|
||||
public static final String VISIBILITY = "visibility";
|
||||
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_VARIES_BY = "waveVariesBy";
|
||||
HashMap<String, ConstraintAttribute> mCustomConstraints;
|
||||
int mFramePosition;
|
||||
int mTargetId;
|
||||
String mTargetString;
|
||||
protected int mType;
|
||||
|
||||
public abstract void addValues(HashMap<String, ViewSpline> splines);
|
||||
|
||||
@Override //
|
||||
/* renamed from: clone, reason: merged with bridge method [inline-methods] */
|
||||
public abstract Key mo49clone();
|
||||
|
||||
abstract void getAttributeNames(HashSet<String> attributes);
|
||||
|
||||
public int getFramePosition() {
|
||||
return this.mFramePosition;
|
||||
}
|
||||
|
||||
abstract void load(Context context, AttributeSet attrs);
|
||||
|
||||
public void setFramePosition(int pos) {
|
||||
this.mFramePosition = pos;
|
||||
}
|
||||
|
||||
public void setInterpolation(HashMap<String, Integer> interpolation) {
|
||||
}
|
||||
|
||||
public abstract void setValue(String tag, Object value);
|
||||
|
||||
public Key setViewId(int id) {
|
||||
this.mTargetId = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Key() {
|
||||
int i = UNSET;
|
||||
this.mFramePosition = i;
|
||||
this.mTargetId = i;
|
||||
this.mTargetString = null;
|
||||
}
|
||||
|
||||
boolean matches(String constraintTag) {
|
||||
String str = this.mTargetString;
|
||||
if (str == null || constraintTag == null) {
|
||||
return false;
|
||||
}
|
||||
return constraintTag.matches(str);
|
||||
}
|
||||
|
||||
float toFloat(Object value) {
|
||||
return value instanceof Float ? ((Float) value).floatValue() : Float.parseFloat(value.toString());
|
||||
}
|
||||
|
||||
int toInt(Object value) {
|
||||
return value instanceof Integer ? ((Integer) value).intValue() : Integer.parseInt(value.toString());
|
||||
}
|
||||
|
||||
boolean toBoolean(Object value) {
|
||||
return value instanceof Boolean ? ((Boolean) value).booleanValue() : Boolean.parseBoolean(value.toString());
|
||||
}
|
||||
|
||||
public Key copy(Key src) {
|
||||
this.mFramePosition = src.mFramePosition;
|
||||
this.mTargetId = src.mTargetId;
|
||||
this.mTargetString = src.mTargetString;
|
||||
this.mType = src.mType;
|
||||
this.mCustomConstraints = src.mCustomConstraints;
|
||||
return this;
|
||||
}
|
||||
}
|
@ -0,0 +1,391 @@
|
||||
package androidx.constraintlayout.motion.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.util.SparseIntArray;
|
||||
import androidx.constraintlayout.widget.R;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class KeyAttributes extends Key {
|
||||
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 boolean mVisibility = false;
|
||||
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;
|
||||
|
||||
int getCurveFit() {
|
||||
return this.mCurveFit;
|
||||
}
|
||||
|
||||
public KeyAttributes() {
|
||||
this.mType = 1;
|
||||
this.mCustomConstraints = new HashMap<>();
|
||||
}
|
||||
|
||||
@Override // androidx.constraintlayout.motion.widget.Key
|
||||
public void load(Context context, AttributeSet attrs) {
|
||||
Loader.read(this, context.obtainStyledAttributes(attrs, R.styleable.KeyAttribute));
|
||||
}
|
||||
|
||||
@Override // androidx.constraintlayout.motion.widget.Key
|
||||
public void getAttributeNames(HashSet<String> attributes) {
|
||||
if (!Float.isNaN(this.mAlpha)) {
|
||||
attributes.add("alpha");
|
||||
}
|
||||
if (!Float.isNaN(this.mElevation)) {
|
||||
attributes.add("elevation");
|
||||
}
|
||||
if (!Float.isNaN(this.mRotation)) {
|
||||
attributes.add(Key.ROTATION);
|
||||
}
|
||||
if (!Float.isNaN(this.mRotationX)) {
|
||||
attributes.add("rotationX");
|
||||
}
|
||||
if (!Float.isNaN(this.mRotationY)) {
|
||||
attributes.add("rotationY");
|
||||
}
|
||||
if (!Float.isNaN(this.mPivotX)) {
|
||||
attributes.add(Key.PIVOT_X);
|
||||
}
|
||||
if (!Float.isNaN(this.mPivotY)) {
|
||||
attributes.add(Key.PIVOT_Y);
|
||||
}
|
||||
if (!Float.isNaN(this.mTranslationX)) {
|
||||
attributes.add("translationX");
|
||||
}
|
||||
if (!Float.isNaN(this.mTranslationY)) {
|
||||
attributes.add("translationY");
|
||||
}
|
||||
if (!Float.isNaN(this.mTranslationZ)) {
|
||||
attributes.add("translationZ");
|
||||
}
|
||||
if (!Float.isNaN(this.mTransitionPathRotate)) {
|
||||
attributes.add("transitionPathRotate");
|
||||
}
|
||||
if (!Float.isNaN(this.mScaleX)) {
|
||||
attributes.add("scaleX");
|
||||
}
|
||||
if (!Float.isNaN(this.mScaleY)) {
|
||||
attributes.add("scaleY");
|
||||
}
|
||||
if (!Float.isNaN(this.mProgress)) {
|
||||
attributes.add("progress");
|
||||
}
|
||||
if (this.mCustomConstraints.size() > 0) {
|
||||
Iterator<String> it = this.mCustomConstraints.keySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
attributes.add("CUSTOM," + it.next());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.constraintlayout.motion.widget.Key
|
||||
public void setInterpolation(HashMap<String, Integer> interpolation) {
|
||||
if (this.mCurveFit == -1) {
|
||||
return;
|
||||
}
|
||||
if (!Float.isNaN(this.mAlpha)) {
|
||||
interpolation.put("alpha", Integer.valueOf(this.mCurveFit));
|
||||
}
|
||||
if (!Float.isNaN(this.mElevation)) {
|
||||
interpolation.put("elevation", Integer.valueOf(this.mCurveFit));
|
||||
}
|
||||
if (!Float.isNaN(this.mRotation)) {
|
||||
interpolation.put(Key.ROTATION, Integer.valueOf(this.mCurveFit));
|
||||
}
|
||||
if (!Float.isNaN(this.mRotationX)) {
|
||||
interpolation.put("rotationX", Integer.valueOf(this.mCurveFit));
|
||||
}
|
||||
if (!Float.isNaN(this.mRotationY)) {
|
||||
interpolation.put("rotationY", Integer.valueOf(this.mCurveFit));
|
||||
}
|
||||
if (!Float.isNaN(this.mPivotX)) {
|
||||
interpolation.put(Key.PIVOT_X, Integer.valueOf(this.mCurveFit));
|
||||
}
|
||||
if (!Float.isNaN(this.mPivotY)) {
|
||||
interpolation.put(Key.PIVOT_Y, Integer.valueOf(this.mCurveFit));
|
||||
}
|
||||
if (!Float.isNaN(this.mTranslationX)) {
|
||||
interpolation.put("translationX", Integer.valueOf(this.mCurveFit));
|
||||
}
|
||||
if (!Float.isNaN(this.mTranslationY)) {
|
||||
interpolation.put("translationY", Integer.valueOf(this.mCurveFit));
|
||||
}
|
||||
if (!Float.isNaN(this.mTranslationZ)) {
|
||||
interpolation.put("translationZ", Integer.valueOf(this.mCurveFit));
|
||||
}
|
||||
if (!Float.isNaN(this.mTransitionPathRotate)) {
|
||||
interpolation.put("transitionPathRotate", Integer.valueOf(this.mCurveFit));
|
||||
}
|
||||
if (!Float.isNaN(this.mScaleX)) {
|
||||
interpolation.put("scaleX", Integer.valueOf(this.mCurveFit));
|
||||
}
|
||||
if (!Float.isNaN(this.mScaleY)) {
|
||||
interpolation.put("scaleY", Integer.valueOf(this.mCurveFit));
|
||||
}
|
||||
if (!Float.isNaN(this.mProgress)) {
|
||||
interpolation.put("progress", Integer.valueOf(this.mCurveFit));
|
||||
}
|
||||
if (this.mCustomConstraints.size() > 0) {
|
||||
Iterator<String> it = this.mCustomConstraints.keySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
interpolation.put("CUSTOM," + it.next(), Integer.valueOf(this.mCurveFit));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */
|
||||
/* JADX WARN: Code restructure failed: missing block: B:133:0x009d, code lost:
|
||||
|
||||
if (r1.equals("scaleY") == false) goto L15;
|
||||
*/
|
||||
@Override // androidx.constraintlayout.motion.widget.Key
|
||||
/*
|
||||
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.motion.utils.ViewSpline> r7) {
|
||||
/*
|
||||
Method dump skipped, instructions count: 574
|
||||
To view this dump add '--comments-level debug' option
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: androidx.constraintlayout.motion.widget.KeyAttributes.addValues(java.util.HashMap):void");
|
||||
}
|
||||
|
||||
@Override // androidx.constraintlayout.motion.widget.Key
|
||||
public void setValue(String tag, Object value) {
|
||||
tag.hashCode();
|
||||
switch (tag) {
|
||||
case "motionProgress":
|
||||
this.mProgress = toFloat(value);
|
||||
break;
|
||||
case "transitionEasing":
|
||||
this.mTransitionEasing = value.toString();
|
||||
break;
|
||||
case "rotationX":
|
||||
this.mRotationX = toFloat(value);
|
||||
break;
|
||||
case "rotationY":
|
||||
this.mRotationY = toFloat(value);
|
||||
break;
|
||||
case "translationX":
|
||||
this.mTranslationX = toFloat(value);
|
||||
break;
|
||||
case "translationY":
|
||||
this.mTranslationY = toFloat(value);
|
||||
break;
|
||||
case "translationZ":
|
||||
this.mTranslationZ = toFloat(value);
|
||||
break;
|
||||
case "scaleX":
|
||||
this.mScaleX = toFloat(value);
|
||||
break;
|
||||
case "scaleY":
|
||||
this.mScaleY = toFloat(value);
|
||||
break;
|
||||
case "transformPivotX":
|
||||
this.mPivotX = toFloat(value);
|
||||
break;
|
||||
case "transformPivotY":
|
||||
this.mPivotY = toFloat(value);
|
||||
break;
|
||||
case "rotation":
|
||||
this.mRotation = toFloat(value);
|
||||
break;
|
||||
case "elevation":
|
||||
this.mElevation = toFloat(value);
|
||||
break;
|
||||
case "transitionPathRotate":
|
||||
this.mTransitionPathRotate = toFloat(value);
|
||||
break;
|
||||
case "alpha":
|
||||
this.mAlpha = toFloat(value);
|
||||
break;
|
||||
case "curveFit":
|
||||
this.mCurveFit = toInt(value);
|
||||
break;
|
||||
case "visibility":
|
||||
this.mVisibility = toBoolean(value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private static class Loader {
|
||||
private static final int ANDROID_ALPHA = 1;
|
||||
private static final int ANDROID_ELEVATION = 2;
|
||||
private static final int ANDROID_PIVOT_X = 19;
|
||||
private static final int ANDROID_PIVOT_Y = 20;
|
||||
private static final int ANDROID_ROTATION = 4;
|
||||
private static final int ANDROID_ROTATION_X = 5;
|
||||
private static final int ANDROID_ROTATION_Y = 6;
|
||||
private static final int ANDROID_SCALE_X = 7;
|
||||
private static final int ANDROID_SCALE_Y = 14;
|
||||
private static final int ANDROID_TRANSLATION_X = 15;
|
||||
private static final int ANDROID_TRANSLATION_Y = 16;
|
||||
private static final int ANDROID_TRANSLATION_Z = 17;
|
||||
private static final int CURVE_FIT = 13;
|
||||
private static final int FRAME_POSITION = 12;
|
||||
private static final int PROGRESS = 18;
|
||||
private static final int TARGET_ID = 10;
|
||||
private static final int TRANSITION_EASING = 9;
|
||||
private static final int TRANSITION_PATH_ROTATE = 8;
|
||||
private static SparseIntArray mAttrMap;
|
||||
|
||||
private Loader() {
|
||||
}
|
||||
|
||||
static {
|
||||
SparseIntArray sparseIntArray = new SparseIntArray();
|
||||
mAttrMap = sparseIntArray;
|
||||
sparseIntArray.append(R.styleable.KeyAttribute_android_alpha, 1);
|
||||
mAttrMap.append(R.styleable.KeyAttribute_android_elevation, 2);
|
||||
mAttrMap.append(R.styleable.KeyAttribute_android_rotation, 4);
|
||||
mAttrMap.append(R.styleable.KeyAttribute_android_rotationX, 5);
|
||||
mAttrMap.append(R.styleable.KeyAttribute_android_rotationY, 6);
|
||||
mAttrMap.append(R.styleable.KeyAttribute_android_transformPivotX, 19);
|
||||
mAttrMap.append(R.styleable.KeyAttribute_android_transformPivotY, 20);
|
||||
mAttrMap.append(R.styleable.KeyAttribute_android_scaleX, 7);
|
||||
mAttrMap.append(R.styleable.KeyAttribute_transitionPathRotate, 8);
|
||||
mAttrMap.append(R.styleable.KeyAttribute_transitionEasing, 9);
|
||||
mAttrMap.append(R.styleable.KeyAttribute_motionTarget, 10);
|
||||
mAttrMap.append(R.styleable.KeyAttribute_framePosition, 12);
|
||||
mAttrMap.append(R.styleable.KeyAttribute_curveFit, 13);
|
||||
mAttrMap.append(R.styleable.KeyAttribute_android_scaleY, 14);
|
||||
mAttrMap.append(R.styleable.KeyAttribute_android_translationX, 15);
|
||||
mAttrMap.append(R.styleable.KeyAttribute_android_translationY, 16);
|
||||
mAttrMap.append(R.styleable.KeyAttribute_android_translationZ, 17);
|
||||
mAttrMap.append(R.styleable.KeyAttribute_motionProgress, 18);
|
||||
}
|
||||
|
||||
public static void read(KeyAttributes c, TypedArray a) {
|
||||
int indexCount = a.getIndexCount();
|
||||
for (int i = 0; i < indexCount; i++) {
|
||||
int index = a.getIndex(i);
|
||||
switch (mAttrMap.get(index)) {
|
||||
case 1:
|
||||
c.mAlpha = a.getFloat(index, c.mAlpha);
|
||||
break;
|
||||
case 2:
|
||||
c.mElevation = a.getDimension(index, c.mElevation);
|
||||
break;
|
||||
case 3:
|
||||
case 11:
|
||||
default:
|
||||
Log.e(KeyAttributes.NAME, "unused attribute 0x" + Integer.toHexString(index) + " " + mAttrMap.get(index));
|
||||
break;
|
||||
case 4:
|
||||
c.mRotation = a.getFloat(index, c.mRotation);
|
||||
break;
|
||||
case 5:
|
||||
c.mRotationX = a.getFloat(index, c.mRotationX);
|
||||
break;
|
||||
case 6:
|
||||
c.mRotationY = a.getFloat(index, c.mRotationY);
|
||||
break;
|
||||
case 7:
|
||||
c.mScaleX = a.getFloat(index, c.mScaleX);
|
||||
break;
|
||||
case 8:
|
||||
c.mTransitionPathRotate = a.getFloat(index, c.mTransitionPathRotate);
|
||||
break;
|
||||
case 9:
|
||||
c.mTransitionEasing = a.getString(index);
|
||||
break;
|
||||
case 10:
|
||||
if (MotionLayout.IS_IN_EDIT_MODE) {
|
||||
c.mTargetId = a.getResourceId(index, c.mTargetId);
|
||||
if (c.mTargetId == -1) {
|
||||
c.mTargetString = a.getString(index);
|
||||
break;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
} else if (a.peekValue(index).type == 3) {
|
||||
c.mTargetString = a.getString(index);
|
||||
break;
|
||||
} else {
|
||||
c.mTargetId = a.getResourceId(index, c.mTargetId);
|
||||
break;
|
||||
}
|
||||
case 12:
|
||||
c.mFramePosition = a.getInt(index, c.mFramePosition);
|
||||
break;
|
||||
case 13:
|
||||
c.mCurveFit = a.getInteger(index, c.mCurveFit);
|
||||
break;
|
||||
case 14:
|
||||
c.mScaleY = a.getFloat(index, c.mScaleY);
|
||||
break;
|
||||
case 15:
|
||||
c.mTranslationX = a.getDimension(index, c.mTranslationX);
|
||||
break;
|
||||
case 16:
|
||||
c.mTranslationY = a.getDimension(index, c.mTranslationY);
|
||||
break;
|
||||
case 17:
|
||||
c.mTranslationZ = a.getDimension(index, c.mTranslationZ);
|
||||
break;
|
||||
case 18:
|
||||
c.mProgress = a.getFloat(index, c.mProgress);
|
||||
break;
|
||||
case 19:
|
||||
c.mPivotX = a.getDimension(index, c.mPivotX);
|
||||
break;
|
||||
case 20:
|
||||
c.mPivotY = a.getDimension(index, c.mPivotY);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.constraintlayout.motion.widget.Key
|
||||
public Key copy(Key src) {
|
||||
super.copy(src);
|
||||
KeyAttributes keyAttributes = (KeyAttributes) src;
|
||||
this.mCurveFit = keyAttributes.mCurveFit;
|
||||
this.mVisibility = keyAttributes.mVisibility;
|
||||
this.mAlpha = keyAttributes.mAlpha;
|
||||
this.mElevation = keyAttributes.mElevation;
|
||||
this.mRotation = keyAttributes.mRotation;
|
||||
this.mRotationX = keyAttributes.mRotationX;
|
||||
this.mRotationY = keyAttributes.mRotationY;
|
||||
this.mPivotX = keyAttributes.mPivotX;
|
||||
this.mPivotY = keyAttributes.mPivotY;
|
||||
this.mTransitionPathRotate = keyAttributes.mTransitionPathRotate;
|
||||
this.mScaleX = keyAttributes.mScaleX;
|
||||
this.mScaleY = keyAttributes.mScaleY;
|
||||
this.mTranslationX = keyAttributes.mTranslationX;
|
||||
this.mTranslationY = keyAttributes.mTranslationY;
|
||||
this.mTranslationZ = keyAttributes.mTranslationZ;
|
||||
this.mProgress = keyAttributes.mProgress;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // androidx.constraintlayout.motion.widget.Key
|
||||
/* renamed from: clone */
|
||||
public Key mo49clone() {
|
||||
return new KeyAttributes().copy(this);
|
||||
}
|
||||
}
|
@ -0,0 +1,480 @@
|
||||
package androidx.constraintlayout.motion.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.util.SparseIntArray;
|
||||
import androidx.constraintlayout.core.motion.utils.TypedValues;
|
||||
import androidx.constraintlayout.motion.utils.ViewOscillator;
|
||||
import androidx.constraintlayout.motion.utils.ViewSpline;
|
||||
import androidx.constraintlayout.widget.ConstraintAttribute;
|
||||
import androidx.constraintlayout.widget.R;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class KeyCycle extends Key {
|
||||
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 int mWaveVariesBy = -1;
|
||||
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;
|
||||
|
||||
public KeyCycle() {
|
||||
this.mType = 4;
|
||||
this.mCustomConstraints = new HashMap<>();
|
||||
}
|
||||
|
||||
@Override // androidx.constraintlayout.motion.widget.Key
|
||||
public void load(Context context, AttributeSet attrs) {
|
||||
Loader.read(this, context.obtainStyledAttributes(attrs, R.styleable.KeyCycle));
|
||||
}
|
||||
|
||||
@Override // androidx.constraintlayout.motion.widget.Key
|
||||
public void getAttributeNames(HashSet<String> attributes) {
|
||||
if (!Float.isNaN(this.mAlpha)) {
|
||||
attributes.add("alpha");
|
||||
}
|
||||
if (!Float.isNaN(this.mElevation)) {
|
||||
attributes.add("elevation");
|
||||
}
|
||||
if (!Float.isNaN(this.mRotation)) {
|
||||
attributes.add(Key.ROTATION);
|
||||
}
|
||||
if (!Float.isNaN(this.mRotationX)) {
|
||||
attributes.add("rotationX");
|
||||
}
|
||||
if (!Float.isNaN(this.mRotationY)) {
|
||||
attributes.add("rotationY");
|
||||
}
|
||||
if (!Float.isNaN(this.mScaleX)) {
|
||||
attributes.add("scaleX");
|
||||
}
|
||||
if (!Float.isNaN(this.mScaleY)) {
|
||||
attributes.add("scaleY");
|
||||
}
|
||||
if (!Float.isNaN(this.mTransitionPathRotate)) {
|
||||
attributes.add("transitionPathRotate");
|
||||
}
|
||||
if (!Float.isNaN(this.mTranslationX)) {
|
||||
attributes.add("translationX");
|
||||
}
|
||||
if (!Float.isNaN(this.mTranslationY)) {
|
||||
attributes.add("translationY");
|
||||
}
|
||||
if (!Float.isNaN(this.mTranslationZ)) {
|
||||
attributes.add("translationZ");
|
||||
}
|
||||
if (this.mCustomConstraints.size() > 0) {
|
||||
Iterator<String> it = this.mCustomConstraints.keySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
attributes.add("CUSTOM," + it.next());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addCycleValues(HashMap<String, ViewOscillator> oscSet) {
|
||||
ViewOscillator viewOscillator;
|
||||
ViewOscillator viewOscillator2;
|
||||
for (String str : oscSet.keySet()) {
|
||||
if (str.startsWith("CUSTOM")) {
|
||||
ConstraintAttribute constraintAttribute = this.mCustomConstraints.get(str.substring(7));
|
||||
if (constraintAttribute != null && constraintAttribute.getType() == ConstraintAttribute.AttributeType.FLOAT_TYPE && (viewOscillator = oscSet.get(str)) != null) {
|
||||
viewOscillator.setPoint(this.mFramePosition, this.mWaveShape, this.mCustomWaveShape, this.mWaveVariesBy, this.mWavePeriod, this.mWaveOffset, this.mWavePhase, constraintAttribute.getValueToInterpolate(), constraintAttribute);
|
||||
}
|
||||
} else {
|
||||
float value = getValue(str);
|
||||
if (!Float.isNaN(value) && (viewOscillator2 = oscSet.get(str)) != null) {
|
||||
viewOscillator2.setPoint(this.mFramePosition, this.mWaveShape, this.mCustomWaveShape, this.mWaveVariesBy, this.mWavePeriod, this.mWaveOffset, this.mWavePhase, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public float getValue(String key) {
|
||||
key.hashCode();
|
||||
switch (key) {
|
||||
case "rotationX":
|
||||
return this.mRotationX;
|
||||
case "rotationY":
|
||||
return this.mRotationY;
|
||||
case "translationX":
|
||||
return this.mTranslationX;
|
||||
case "translationY":
|
||||
return this.mTranslationY;
|
||||
case "translationZ":
|
||||
return this.mTranslationZ;
|
||||
case "progress":
|
||||
return this.mProgress;
|
||||
case "scaleX":
|
||||
return this.mScaleX;
|
||||
case "scaleY":
|
||||
return this.mScaleY;
|
||||
case "rotation":
|
||||
return this.mRotation;
|
||||
case "elevation":
|
||||
return this.mElevation;
|
||||
case "transitionPathRotate":
|
||||
return this.mTransitionPathRotate;
|
||||
case "alpha":
|
||||
return this.mAlpha;
|
||||
case "waveOffset":
|
||||
return this.mWaveOffset;
|
||||
case "wavePhase":
|
||||
return this.mWavePhase;
|
||||
default:
|
||||
if (key.startsWith("CUSTOM")) {
|
||||
return Float.NaN;
|
||||
}
|
||||
Log.v("WARNING! KeyCycle", " UNKNOWN " + key);
|
||||
return Float.NaN;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.constraintlayout.motion.widget.Key
|
||||
public void addValues(HashMap<String, ViewSpline> splines) {
|
||||
Debug.logStack(TypedValues.CycleType.NAME, "add " + splines.size() + " values", 2);
|
||||
for (String str : splines.keySet()) {
|
||||
ViewSpline viewSpline = splines.get(str);
|
||||
if (viewSpline != null) {
|
||||
str.hashCode();
|
||||
switch (str) {
|
||||
case "rotationX":
|
||||
viewSpline.setPoint(this.mFramePosition, this.mRotationX);
|
||||
break;
|
||||
case "rotationY":
|
||||
viewSpline.setPoint(this.mFramePosition, this.mRotationY);
|
||||
break;
|
||||
case "translationX":
|
||||
viewSpline.setPoint(this.mFramePosition, this.mTranslationX);
|
||||
break;
|
||||
case "translationY":
|
||||
viewSpline.setPoint(this.mFramePosition, this.mTranslationY);
|
||||
break;
|
||||
case "translationZ":
|
||||
viewSpline.setPoint(this.mFramePosition, this.mTranslationZ);
|
||||
break;
|
||||
case "progress":
|
||||
viewSpline.setPoint(this.mFramePosition, this.mProgress);
|
||||
break;
|
||||
case "scaleX":
|
||||
viewSpline.setPoint(this.mFramePosition, this.mScaleX);
|
||||
break;
|
||||
case "scaleY":
|
||||
viewSpline.setPoint(this.mFramePosition, this.mScaleY);
|
||||
break;
|
||||
case "rotation":
|
||||
viewSpline.setPoint(this.mFramePosition, this.mRotation);
|
||||
break;
|
||||
case "elevation":
|
||||
viewSpline.setPoint(this.mFramePosition, this.mElevation);
|
||||
break;
|
||||
case "transitionPathRotate":
|
||||
viewSpline.setPoint(this.mFramePosition, this.mTransitionPathRotate);
|
||||
break;
|
||||
case "alpha":
|
||||
viewSpline.setPoint(this.mFramePosition, this.mAlpha);
|
||||
break;
|
||||
case "waveOffset":
|
||||
viewSpline.setPoint(this.mFramePosition, this.mWaveOffset);
|
||||
break;
|
||||
case "wavePhase":
|
||||
viewSpline.setPoint(this.mFramePosition, this.mWavePhase);
|
||||
break;
|
||||
default:
|
||||
if (str.startsWith("CUSTOM")) {
|
||||
break;
|
||||
} else {
|
||||
Log.v("WARNING KeyCycle", " UNKNOWN " + str);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class Loader {
|
||||
private static final int ANDROID_ALPHA = 9;
|
||||
private static final int ANDROID_ELEVATION = 10;
|
||||
private static final int ANDROID_ROTATION = 11;
|
||||
private static final int ANDROID_ROTATION_X = 12;
|
||||
private static final int ANDROID_ROTATION_Y = 13;
|
||||
private static final int ANDROID_SCALE_X = 15;
|
||||
private static final int ANDROID_SCALE_Y = 16;
|
||||
private static final int ANDROID_TRANSLATION_X = 17;
|
||||
private static final int ANDROID_TRANSLATION_Y = 18;
|
||||
private static final int ANDROID_TRANSLATION_Z = 19;
|
||||
private static final int CURVE_FIT = 4;
|
||||
private static final int FRAME_POSITION = 2;
|
||||
private static final int PROGRESS = 20;
|
||||
private static final int TARGET_ID = 1;
|
||||
private static final int TRANSITION_EASING = 3;
|
||||
private static final int TRANSITION_PATH_ROTATE = 14;
|
||||
private static final int WAVE_OFFSET = 7;
|
||||
private static final int WAVE_PERIOD = 6;
|
||||
private static final int WAVE_PHASE = 21;
|
||||
private static final int WAVE_SHAPE = 5;
|
||||
private static final int WAVE_VARIES_BY = 8;
|
||||
private static SparseIntArray mAttrMap;
|
||||
|
||||
private Loader() {
|
||||
}
|
||||
|
||||
static {
|
||||
SparseIntArray sparseIntArray = new SparseIntArray();
|
||||
mAttrMap = sparseIntArray;
|
||||
sparseIntArray.append(R.styleable.KeyCycle_motionTarget, 1);
|
||||
mAttrMap.append(R.styleable.KeyCycle_framePosition, 2);
|
||||
mAttrMap.append(R.styleable.KeyCycle_transitionEasing, 3);
|
||||
mAttrMap.append(R.styleable.KeyCycle_curveFit, 4);
|
||||
mAttrMap.append(R.styleable.KeyCycle_waveShape, 5);
|
||||
mAttrMap.append(R.styleable.KeyCycle_wavePeriod, 6);
|
||||
mAttrMap.append(R.styleable.KeyCycle_waveOffset, 7);
|
||||
mAttrMap.append(R.styleable.KeyCycle_waveVariesBy, 8);
|
||||
mAttrMap.append(R.styleable.KeyCycle_android_alpha, 9);
|
||||
mAttrMap.append(R.styleable.KeyCycle_android_elevation, 10);
|
||||
mAttrMap.append(R.styleable.KeyCycle_android_rotation, 11);
|
||||
mAttrMap.append(R.styleable.KeyCycle_android_rotationX, 12);
|
||||
mAttrMap.append(R.styleable.KeyCycle_android_rotationY, 13);
|
||||
mAttrMap.append(R.styleable.KeyCycle_transitionPathRotate, 14);
|
||||
mAttrMap.append(R.styleable.KeyCycle_android_scaleX, 15);
|
||||
mAttrMap.append(R.styleable.KeyCycle_android_scaleY, 16);
|
||||
mAttrMap.append(R.styleable.KeyCycle_android_translationX, 17);
|
||||
mAttrMap.append(R.styleable.KeyCycle_android_translationY, 18);
|
||||
mAttrMap.append(R.styleable.KeyCycle_android_translationZ, 19);
|
||||
mAttrMap.append(R.styleable.KeyCycle_motionProgress, 20);
|
||||
mAttrMap.append(R.styleable.KeyCycle_wavePhase, 21);
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public static void read(KeyCycle c, TypedArray a) {
|
||||
int indexCount = a.getIndexCount();
|
||||
for (int i = 0; i < indexCount; i++) {
|
||||
int index = a.getIndex(i);
|
||||
switch (mAttrMap.get(index)) {
|
||||
case 1:
|
||||
if (MotionLayout.IS_IN_EDIT_MODE) {
|
||||
c.mTargetId = a.getResourceId(index, c.mTargetId);
|
||||
if (c.mTargetId == -1) {
|
||||
c.mTargetString = a.getString(index);
|
||||
break;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
} else if (a.peekValue(index).type == 3) {
|
||||
c.mTargetString = a.getString(index);
|
||||
break;
|
||||
} else {
|
||||
c.mTargetId = a.getResourceId(index, c.mTargetId);
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
c.mFramePosition = a.getInt(index, c.mFramePosition);
|
||||
break;
|
||||
case 3:
|
||||
c.mTransitionEasing = a.getString(index);
|
||||
break;
|
||||
case 4:
|
||||
c.mCurveFit = a.getInteger(index, c.mCurveFit);
|
||||
break;
|
||||
case 5:
|
||||
if (a.peekValue(index).type == 3) {
|
||||
c.mCustomWaveShape = a.getString(index);
|
||||
c.mWaveShape = 7;
|
||||
break;
|
||||
} else {
|
||||
c.mWaveShape = a.getInt(index, c.mWaveShape);
|
||||
break;
|
||||
}
|
||||
case 6:
|
||||
c.mWavePeriod = a.getFloat(index, c.mWavePeriod);
|
||||
break;
|
||||
case 7:
|
||||
if (a.peekValue(index).type == 5) {
|
||||
c.mWaveOffset = a.getDimension(index, c.mWaveOffset);
|
||||
break;
|
||||
} else {
|
||||
c.mWaveOffset = a.getFloat(index, c.mWaveOffset);
|
||||
break;
|
||||
}
|
||||
case 8:
|
||||
c.mWaveVariesBy = a.getInt(index, c.mWaveVariesBy);
|
||||
break;
|
||||
case 9:
|
||||
c.mAlpha = a.getFloat(index, c.mAlpha);
|
||||
break;
|
||||
case 10:
|
||||
c.mElevation = a.getDimension(index, c.mElevation);
|
||||
break;
|
||||
case 11:
|
||||
c.mRotation = a.getFloat(index, c.mRotation);
|
||||
break;
|
||||
case 12:
|
||||
c.mRotationX = a.getFloat(index, c.mRotationX);
|
||||
break;
|
||||
case 13:
|
||||
c.mRotationY = a.getFloat(index, c.mRotationY);
|
||||
break;
|
||||
case 14:
|
||||
c.mTransitionPathRotate = a.getFloat(index, c.mTransitionPathRotate);
|
||||
break;
|
||||
case 15:
|
||||
c.mScaleX = a.getFloat(index, c.mScaleX);
|
||||
break;
|
||||
case 16:
|
||||
c.mScaleY = a.getFloat(index, c.mScaleY);
|
||||
break;
|
||||
case 17:
|
||||
c.mTranslationX = a.getDimension(index, c.mTranslationX);
|
||||
break;
|
||||
case 18:
|
||||
c.mTranslationY = a.getDimension(index, c.mTranslationY);
|
||||
break;
|
||||
case 19:
|
||||
c.mTranslationZ = a.getDimension(index, c.mTranslationZ);
|
||||
break;
|
||||
case 20:
|
||||
c.mProgress = a.getFloat(index, c.mProgress);
|
||||
break;
|
||||
case 21:
|
||||
c.mWavePhase = a.getFloat(index, c.mWavePhase) / 360.0f;
|
||||
break;
|
||||
default:
|
||||
Log.e(TypedValues.CycleType.NAME, "unused attribute 0x" + Integer.toHexString(index) + " " + mAttrMap.get(index));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.constraintlayout.motion.widget.Key
|
||||
public void setValue(String tag, Object value) {
|
||||
tag.hashCode();
|
||||
switch (tag) {
|
||||
case "motionProgress":
|
||||
this.mProgress = toFloat(value);
|
||||
break;
|
||||
case "transitionEasing":
|
||||
this.mTransitionEasing = value.toString();
|
||||
break;
|
||||
case "rotationX":
|
||||
this.mRotationX = toFloat(value);
|
||||
break;
|
||||
case "rotationY":
|
||||
this.mRotationY = toFloat(value);
|
||||
break;
|
||||
case "translationX":
|
||||
this.mTranslationX = toFloat(value);
|
||||
break;
|
||||
case "translationY":
|
||||
this.mTranslationY = toFloat(value);
|
||||
break;
|
||||
case "translationZ":
|
||||
this.mTranslationZ = toFloat(value);
|
||||
break;
|
||||
case "scaleX":
|
||||
this.mScaleX = toFloat(value);
|
||||
break;
|
||||
case "scaleY":
|
||||
this.mScaleY = toFloat(value);
|
||||
break;
|
||||
case "rotation":
|
||||
this.mRotation = toFloat(value);
|
||||
break;
|
||||
case "elevation":
|
||||
this.mElevation = toFloat(value);
|
||||
break;
|
||||
case "transitionPathRotate":
|
||||
this.mTransitionPathRotate = toFloat(value);
|
||||
break;
|
||||
case "alpha":
|
||||
this.mAlpha = toFloat(value);
|
||||
break;
|
||||
case "waveOffset":
|
||||
this.mWaveOffset = toFloat(value);
|
||||
break;
|
||||
case "wavePeriod":
|
||||
this.mWavePeriod = toFloat(value);
|
||||
break;
|
||||
case "curveFit":
|
||||
this.mCurveFit = toInt(value);
|
||||
break;
|
||||
case "wavePhase":
|
||||
this.mWavePhase = toFloat(value);
|
||||
break;
|
||||
case "waveShape":
|
||||
if (value instanceof Integer) {
|
||||
this.mWaveShape = toInt(value);
|
||||
break;
|
||||
} else {
|
||||
this.mWaveShape = 7;
|
||||
this.mCustomWaveShape = value.toString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.constraintlayout.motion.widget.Key
|
||||
public Key copy(Key src) {
|
||||
super.copy(src);
|
||||
KeyCycle keyCycle = (KeyCycle) src;
|
||||
this.mTransitionEasing = keyCycle.mTransitionEasing;
|
||||
this.mCurveFit = keyCycle.mCurveFit;
|
||||
this.mWaveShape = keyCycle.mWaveShape;
|
||||
this.mCustomWaveShape = keyCycle.mCustomWaveShape;
|
||||
this.mWavePeriod = keyCycle.mWavePeriod;
|
||||
this.mWaveOffset = keyCycle.mWaveOffset;
|
||||
this.mWavePhase = keyCycle.mWavePhase;
|
||||
this.mProgress = keyCycle.mProgress;
|
||||
this.mWaveVariesBy = keyCycle.mWaveVariesBy;
|
||||
this.mAlpha = keyCycle.mAlpha;
|
||||
this.mElevation = keyCycle.mElevation;
|
||||
this.mRotation = keyCycle.mRotation;
|
||||
this.mTransitionPathRotate = keyCycle.mTransitionPathRotate;
|
||||
this.mRotationX = keyCycle.mRotationX;
|
||||
this.mRotationY = keyCycle.mRotationY;
|
||||
this.mScaleX = keyCycle.mScaleX;
|
||||
this.mScaleY = keyCycle.mScaleY;
|
||||
this.mTranslationX = keyCycle.mTranslationX;
|
||||
this.mTranslationY = keyCycle.mTranslationY;
|
||||
this.mTranslationZ = keyCycle.mTranslationZ;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // androidx.constraintlayout.motion.widget.Key
|
||||
/* renamed from: clone */
|
||||
public Key mo49clone() {
|
||||
return new KeyCycle().copy(this);
|
||||
}
|
||||
}
|
@ -0,0 +1,141 @@
|
||||
package androidx.constraintlayout.motion.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import android.util.Xml;
|
||||
import androidx.constraintlayout.core.motion.utils.TypedValues;
|
||||
import androidx.constraintlayout.widget.ConstraintAttribute;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class KeyFrames {
|
||||
private static final String CUSTOM_ATTRIBUTE = "CustomAttribute";
|
||||
private static final String CUSTOM_METHOD = "CustomMethod";
|
||||
private static final String TAG = "KeyFrames";
|
||||
public static final int UNSET = -1;
|
||||
static HashMap<String, Constructor<? extends Key>> sKeyMakers;
|
||||
private HashMap<Integer, ArrayList<Key>> mFramesMap = new HashMap<>();
|
||||
|
||||
static {
|
||||
HashMap<String, Constructor<? extends Key>> hashMap = new HashMap<>();
|
||||
sKeyMakers = hashMap;
|
||||
try {
|
||||
hashMap.put("KeyAttribute", KeyAttributes.class.getConstructor(new Class[0]));
|
||||
sKeyMakers.put(TypedValues.PositionType.NAME, KeyPosition.class.getConstructor(new Class[0]));
|
||||
sKeyMakers.put(TypedValues.CycleType.NAME, KeyCycle.class.getConstructor(new Class[0]));
|
||||
sKeyMakers.put("KeyTimeCycle", KeyTimeCycle.class.getConstructor(new Class[0]));
|
||||
sKeyMakers.put(TypedValues.TriggerType.NAME, KeyTrigger.class.getConstructor(new Class[0]));
|
||||
} catch (NoSuchMethodException e) {
|
||||
Log.e(TAG, "unable to load", e);
|
||||
}
|
||||
}
|
||||
|
||||
public void addKey(Key key) {
|
||||
if (!this.mFramesMap.containsKey(Integer.valueOf(key.mTargetId))) {
|
||||
this.mFramesMap.put(Integer.valueOf(key.mTargetId), new ArrayList<>());
|
||||
}
|
||||
ArrayList<Key> arrayList = this.mFramesMap.get(Integer.valueOf(key.mTargetId));
|
||||
if (arrayList != null) {
|
||||
arrayList.add(key);
|
||||
}
|
||||
}
|
||||
|
||||
public KeyFrames() {
|
||||
}
|
||||
|
||||
public KeyFrames(Context context, XmlPullParser parser) {
|
||||
Exception e;
|
||||
Key key;
|
||||
Constructor<? extends Key> constructor;
|
||||
try {
|
||||
int eventType = parser.getEventType();
|
||||
Key key2 = null;
|
||||
while (eventType != 1) {
|
||||
if (eventType == 2) {
|
||||
String name = parser.getName();
|
||||
if (sKeyMakers.containsKey(name)) {
|
||||
try {
|
||||
constructor = sKeyMakers.get(name);
|
||||
} catch (Exception e2) {
|
||||
Key key3 = key2;
|
||||
e = e2;
|
||||
key = key3;
|
||||
}
|
||||
if (constructor != null) {
|
||||
key = constructor.newInstance(new Object[0]);
|
||||
try {
|
||||
key.load(context, Xml.asAttributeSet(parser));
|
||||
addKey(key);
|
||||
} catch (Exception e3) {
|
||||
e = e3;
|
||||
Log.e(TAG, "unable to create ", e);
|
||||
key2 = key;
|
||||
eventType = parser.next();
|
||||
}
|
||||
key2 = key;
|
||||
} else {
|
||||
throw new NullPointerException("Keymaker for " + name + " not found");
|
||||
}
|
||||
} else if (name.equalsIgnoreCase("CustomAttribute")) {
|
||||
if (key2 != null && key2.mCustomConstraints != null) {
|
||||
ConstraintAttribute.parse(context, parser, key2.mCustomConstraints);
|
||||
}
|
||||
} else if (name.equalsIgnoreCase("CustomMethod") && key2 != null && key2.mCustomConstraints != null) {
|
||||
ConstraintAttribute.parse(context, parser, key2.mCustomConstraints);
|
||||
}
|
||||
} else if (eventType == 3 && ViewTransition.KEY_FRAME_SET_TAG.equals(parser.getName())) {
|
||||
return;
|
||||
}
|
||||
eventType = parser.next();
|
||||
}
|
||||
} catch (IOException e4) {
|
||||
e4.printStackTrace();
|
||||
} catch (XmlPullParserException e5) {
|
||||
e5.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void addAllFrames(MotionController motionController) {
|
||||
ArrayList<Key> arrayList = this.mFramesMap.get(-1);
|
||||
if (arrayList != null) {
|
||||
motionController.addKeys(arrayList);
|
||||
}
|
||||
}
|
||||
|
||||
public void addFrames(MotionController motionController) {
|
||||
ArrayList<Key> arrayList = this.mFramesMap.get(Integer.valueOf(motionController.mId));
|
||||
if (arrayList != null) {
|
||||
motionController.addKeys(arrayList);
|
||||
}
|
||||
ArrayList<Key> arrayList2 = this.mFramesMap.get(-1);
|
||||
if (arrayList2 != null) {
|
||||
Iterator<Key> it = arrayList2.iterator();
|
||||
while (it.hasNext()) {
|
||||
Key next = it.next();
|
||||
if (next.matches(((ConstraintLayout.LayoutParams) motionController.mView.getLayoutParams()).constraintTag)) {
|
||||
motionController.addKey(next);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static String name(int viewId, Context context) {
|
||||
return context.getResources().getResourceEntryName(viewId);
|
||||
}
|
||||
|
||||
public Set<Integer> getKeys() {
|
||||
return this.mFramesMap.keySet();
|
||||
}
|
||||
|
||||
public ArrayList<Key> getKeyFramesForView(int id) {
|
||||
return this.mFramesMap.get(Integer.valueOf(id));
|
||||
}
|
||||
}
|
@ -0,0 +1,371 @@
|
||||
package androidx.constraintlayout.motion.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.RectF;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.util.SparseIntArray;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import androidx.constraintlayout.core.motion.utils.Easing;
|
||||
import androidx.constraintlayout.core.motion.utils.TypedValues;
|
||||
import androidx.constraintlayout.motion.utils.ViewSpline;
|
||||
import androidx.constraintlayout.widget.R;
|
||||
import java.util.HashMap;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class KeyPosition extends KeyPositionBase {
|
||||
public static final String DRAWPATH = "drawPath";
|
||||
static final int KEY_TYPE = 2;
|
||||
static final String NAME = "KeyPosition";
|
||||
public static final String PERCENT_HEIGHT = "percentHeight";
|
||||
public static final String PERCENT_WIDTH = "percentWidth";
|
||||
public static final String PERCENT_X = "percentX";
|
||||
public static final String PERCENT_Y = "percentY";
|
||||
public static final String SIZE_PERCENT = "sizePercent";
|
||||
private static final String TAG = "KeyPosition";
|
||||
public static final String TRANSITION_EASING = "transitionEasing";
|
||||
public static final int TYPE_CARTESIAN = 0;
|
||||
public static final int TYPE_PATH = 1;
|
||||
public static final int TYPE_SCREEN = 2;
|
||||
String mTransitionEasing = null;
|
||||
int mPathMotionArc = UNSET;
|
||||
int mDrawPath = 0;
|
||||
float mPercentWidth = Float.NaN;
|
||||
float mPercentHeight = Float.NaN;
|
||||
float mPercentX = Float.NaN;
|
||||
float mPercentY = Float.NaN;
|
||||
float mAltPercentX = Float.NaN;
|
||||
float mAltPercentY = Float.NaN;
|
||||
int mPositionType = 0;
|
||||
private float mCalculatedPositionX = Float.NaN;
|
||||
private float mCalculatedPositionY = Float.NaN;
|
||||
|
||||
private void calcPathPosition(float start_x, float start_y, float end_x, float end_y) {
|
||||
float f = end_x - start_x;
|
||||
float f2 = end_y - start_y;
|
||||
float f3 = this.mPercentX;
|
||||
float f4 = this.mPercentY;
|
||||
this.mCalculatedPositionX = start_x + (f * f3) + ((-f2) * f4);
|
||||
this.mCalculatedPositionY = start_y + (f2 * f3) + (f * f4);
|
||||
}
|
||||
|
||||
private void calcScreenPosition(int layoutWidth, int layoutHeight) {
|
||||
float f = this.mPercentX;
|
||||
float f2 = 0;
|
||||
this.mCalculatedPositionX = (layoutWidth * f) + f2;
|
||||
this.mCalculatedPositionY = (layoutHeight * f) + f2;
|
||||
}
|
||||
|
||||
@Override // androidx.constraintlayout.motion.widget.Key
|
||||
public void addValues(HashMap<String, ViewSpline> splines) {
|
||||
}
|
||||
|
||||
@Override // androidx.constraintlayout.motion.widget.KeyPositionBase
|
||||
float getPositionX() {
|
||||
return this.mCalculatedPositionX;
|
||||
}
|
||||
|
||||
@Override // androidx.constraintlayout.motion.widget.KeyPositionBase
|
||||
float getPositionY() {
|
||||
return this.mCalculatedPositionY;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.mPositionType = type;
|
||||
}
|
||||
|
||||
public KeyPosition() {
|
||||
this.mType = 2;
|
||||
}
|
||||
|
||||
@Override // androidx.constraintlayout.motion.widget.Key
|
||||
public void load(Context context, AttributeSet attrs) {
|
||||
Loader.read(this, context.obtainStyledAttributes(attrs, R.styleable.KeyPosition));
|
||||
}
|
||||
|
||||
@Override // androidx.constraintlayout.motion.widget.KeyPositionBase
|
||||
void calcPosition(int layoutWidth, int layoutHeight, float start_x, float start_y, float end_x, float end_y) {
|
||||
int i = this.mPositionType;
|
||||
if (i == 1) {
|
||||
calcPathPosition(start_x, start_y, end_x, end_y);
|
||||
} else if (i == 2) {
|
||||
calcScreenPosition(layoutWidth, layoutHeight);
|
||||
} else {
|
||||
calcCartesianPosition(start_x, start_y, end_x, end_y);
|
||||
}
|
||||
}
|
||||
|
||||
private void calcCartesianPosition(float start_x, float start_y, float end_x, float end_y) {
|
||||
float f = end_x - start_x;
|
||||
float f2 = end_y - start_y;
|
||||
float f3 = Float.isNaN(this.mPercentX) ? 0.0f : this.mPercentX;
|
||||
float f4 = Float.isNaN(this.mAltPercentY) ? 0.0f : this.mAltPercentY;
|
||||
float f5 = Float.isNaN(this.mPercentY) ? 0.0f : this.mPercentY;
|
||||
this.mCalculatedPositionX = (int) (start_x + (f3 * f) + ((Float.isNaN(this.mAltPercentX) ? 0.0f : this.mAltPercentX) * f2));
|
||||
this.mCalculatedPositionY = (int) (start_y + (f * f4) + (f2 * f5));
|
||||
}
|
||||
|
||||
@Override // androidx.constraintlayout.motion.widget.KeyPositionBase
|
||||
public void positionAttributes(View view, RectF start, RectF end, float x, float y, String[] attribute, float[] value) {
|
||||
int i = this.mPositionType;
|
||||
if (i == 1) {
|
||||
positionPathAttributes(start, end, x, y, attribute, value);
|
||||
} else if (i == 2) {
|
||||
positionScreenAttributes(view, start, end, x, y, attribute, value);
|
||||
} else {
|
||||
positionCartAttributes(start, end, x, y, attribute, value);
|
||||
}
|
||||
}
|
||||
|
||||
void positionPathAttributes(RectF start, RectF end, float x, float y, String[] attribute, float[] value) {
|
||||
float centerX = start.centerX();
|
||||
float centerY = start.centerY();
|
||||
float centerX2 = end.centerX() - centerX;
|
||||
float centerY2 = end.centerY() - centerY;
|
||||
float hypot = (float) Math.hypot(centerX2, centerY2);
|
||||
if (hypot < 1.0E-4d) {
|
||||
System.out.println("distance ~ 0");
|
||||
value[0] = 0.0f;
|
||||
value[1] = 0.0f;
|
||||
return;
|
||||
}
|
||||
float f = centerX2 / hypot;
|
||||
float f2 = centerY2 / hypot;
|
||||
float f3 = y - centerY;
|
||||
float f4 = x - centerX;
|
||||
float f5 = ((f * f3) - (f4 * f2)) / hypot;
|
||||
float f6 = ((f * f4) + (f2 * f3)) / hypot;
|
||||
String str = attribute[0];
|
||||
if (str != null) {
|
||||
if ("percentX".equals(str)) {
|
||||
value[0] = f6;
|
||||
value[1] = f5;
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
attribute[0] = "percentX";
|
||||
attribute[1] = "percentY";
|
||||
value[0] = f6;
|
||||
value[1] = f5;
|
||||
}
|
||||
|
||||
void positionScreenAttributes(View view, RectF start, RectF end, float x, float y, String[] attribute, float[] value) {
|
||||
start.centerX();
|
||||
start.centerY();
|
||||
end.centerX();
|
||||
end.centerY();
|
||||
ViewGroup viewGroup = (ViewGroup) view.getParent();
|
||||
int width = viewGroup.getWidth();
|
||||
int height = viewGroup.getHeight();
|
||||
String str = attribute[0];
|
||||
if (str != null) {
|
||||
if ("percentX".equals(str)) {
|
||||
value[0] = x / width;
|
||||
value[1] = y / height;
|
||||
return;
|
||||
} else {
|
||||
value[1] = x / width;
|
||||
value[0] = y / height;
|
||||
return;
|
||||
}
|
||||
}
|
||||
attribute[0] = "percentX";
|
||||
value[0] = x / width;
|
||||
attribute[1] = "percentY";
|
||||
value[1] = y / height;
|
||||
}
|
||||
|
||||
void positionCartAttributes(RectF start, RectF end, float x, float y, String[] attribute, float[] value) {
|
||||
float centerX = start.centerX();
|
||||
float centerY = start.centerY();
|
||||
float centerX2 = end.centerX() - centerX;
|
||||
float centerY2 = end.centerY() - centerY;
|
||||
String str = attribute[0];
|
||||
if (str != null) {
|
||||
if ("percentX".equals(str)) {
|
||||
value[0] = (x - centerX) / centerX2;
|
||||
value[1] = (y - centerY) / centerY2;
|
||||
return;
|
||||
} else {
|
||||
value[1] = (x - centerX) / centerX2;
|
||||
value[0] = (y - centerY) / centerY2;
|
||||
return;
|
||||
}
|
||||
}
|
||||
attribute[0] = "percentX";
|
||||
value[0] = (x - centerX) / centerX2;
|
||||
attribute[1] = "percentY";
|
||||
value[1] = (y - centerY) / centerY2;
|
||||
}
|
||||
|
||||
@Override // androidx.constraintlayout.motion.widget.KeyPositionBase
|
||||
public boolean intersects(int layoutWidth, int layoutHeight, RectF start, RectF end, float x, float y) {
|
||||
calcPosition(layoutWidth, layoutHeight, start.centerX(), start.centerY(), end.centerX(), end.centerY());
|
||||
return Math.abs(x - this.mCalculatedPositionX) < 20.0f && Math.abs(y - this.mCalculatedPositionY) < 20.0f;
|
||||
}
|
||||
|
||||
private static class Loader {
|
||||
private static final int CURVE_FIT = 4;
|
||||
private static final int DRAW_PATH = 5;
|
||||
private static final int FRAME_POSITION = 2;
|
||||
private static final int PATH_MOTION_ARC = 10;
|
||||
private static final int PERCENT_HEIGHT = 12;
|
||||
private static final int PERCENT_WIDTH = 11;
|
||||
private static final int PERCENT_X = 6;
|
||||
private static final int PERCENT_Y = 7;
|
||||
private static final int SIZE_PERCENT = 8;
|
||||
private static final int TARGET_ID = 1;
|
||||
private static final int TRANSITION_EASING = 3;
|
||||
private static final int TYPE = 9;
|
||||
private static SparseIntArray mAttrMap;
|
||||
|
||||
private Loader() {
|
||||
}
|
||||
|
||||
static {
|
||||
SparseIntArray sparseIntArray = new SparseIntArray();
|
||||
mAttrMap = sparseIntArray;
|
||||
sparseIntArray.append(R.styleable.KeyPosition_motionTarget, 1);
|
||||
mAttrMap.append(R.styleable.KeyPosition_framePosition, 2);
|
||||
mAttrMap.append(R.styleable.KeyPosition_transitionEasing, 3);
|
||||
mAttrMap.append(R.styleable.KeyPosition_curveFit, 4);
|
||||
mAttrMap.append(R.styleable.KeyPosition_drawPath, 5);
|
||||
mAttrMap.append(R.styleable.KeyPosition_percentX, 6);
|
||||
mAttrMap.append(R.styleable.KeyPosition_percentY, 7);
|
||||
mAttrMap.append(R.styleable.KeyPosition_keyPositionType, 9);
|
||||
mAttrMap.append(R.styleable.KeyPosition_sizePercent, 8);
|
||||
mAttrMap.append(R.styleable.KeyPosition_percentWidth, 11);
|
||||
mAttrMap.append(R.styleable.KeyPosition_percentHeight, 12);
|
||||
mAttrMap.append(R.styleable.KeyPosition_pathMotionArc, 10);
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public static void read(KeyPosition c, TypedArray a) {
|
||||
int indexCount = a.getIndexCount();
|
||||
for (int i = 0; i < indexCount; i++) {
|
||||
int index = a.getIndex(i);
|
||||
switch (mAttrMap.get(index)) {
|
||||
case 1:
|
||||
if (MotionLayout.IS_IN_EDIT_MODE) {
|
||||
c.mTargetId = a.getResourceId(index, c.mTargetId);
|
||||
if (c.mTargetId == -1) {
|
||||
c.mTargetString = a.getString(index);
|
||||
break;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
} else if (a.peekValue(index).type == 3) {
|
||||
c.mTargetString = a.getString(index);
|
||||
break;
|
||||
} else {
|
||||
c.mTargetId = a.getResourceId(index, c.mTargetId);
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
c.mFramePosition = a.getInt(index, c.mFramePosition);
|
||||
break;
|
||||
case 3:
|
||||
if (a.peekValue(index).type == 3) {
|
||||
c.mTransitionEasing = a.getString(index);
|
||||
break;
|
||||
} else {
|
||||
c.mTransitionEasing = Easing.NAMED_EASING[a.getInteger(index, 0)];
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
c.mCurveFit = a.getInteger(index, c.mCurveFit);
|
||||
break;
|
||||
case 5:
|
||||
c.mDrawPath = a.getInt(index, c.mDrawPath);
|
||||
break;
|
||||
case 6:
|
||||
c.mPercentX = a.getFloat(index, c.mPercentX);
|
||||
break;
|
||||
case 7:
|
||||
c.mPercentY = a.getFloat(index, c.mPercentY);
|
||||
break;
|
||||
case 8:
|
||||
float f = a.getFloat(index, c.mPercentHeight);
|
||||
c.mPercentWidth = f;
|
||||
c.mPercentHeight = f;
|
||||
break;
|
||||
case 9:
|
||||
c.mPositionType = a.getInt(index, c.mPositionType);
|
||||
break;
|
||||
case 10:
|
||||
c.mPathMotionArc = a.getInt(index, c.mPathMotionArc);
|
||||
break;
|
||||
case 11:
|
||||
c.mPercentWidth = a.getFloat(index, c.mPercentWidth);
|
||||
break;
|
||||
case 12:
|
||||
c.mPercentHeight = a.getFloat(index, c.mPercentHeight);
|
||||
break;
|
||||
default:
|
||||
Log.e(TypedValues.PositionType.NAME, "unused attribute 0x" + Integer.toHexString(index) + " " + mAttrMap.get(index));
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (c.mFramePosition == -1) {
|
||||
Log.e(TypedValues.PositionType.NAME, "no frame position");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.constraintlayout.motion.widget.Key
|
||||
public void setValue(String tag, Object value) {
|
||||
tag.hashCode();
|
||||
switch (tag) {
|
||||
case "transitionEasing":
|
||||
this.mTransitionEasing = value.toString();
|
||||
break;
|
||||
case "percentWidth":
|
||||
this.mPercentWidth = toFloat(value);
|
||||
break;
|
||||
case "percentHeight":
|
||||
this.mPercentHeight = toFloat(value);
|
||||
break;
|
||||
case "drawPath":
|
||||
this.mDrawPath = toInt(value);
|
||||
break;
|
||||
case "sizePercent":
|
||||
float f = toFloat(value);
|
||||
this.mPercentWidth = f;
|
||||
this.mPercentHeight = f;
|
||||
break;
|
||||
case "percentX":
|
||||
this.mPercentX = toFloat(value);
|
||||
break;
|
||||
case "percentY":
|
||||
this.mPercentY = toFloat(value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.constraintlayout.motion.widget.Key
|
||||
public Key copy(Key src) {
|
||||
super.copy(src);
|
||||
KeyPosition keyPosition = (KeyPosition) src;
|
||||
this.mTransitionEasing = keyPosition.mTransitionEasing;
|
||||
this.mPathMotionArc = keyPosition.mPathMotionArc;
|
||||
this.mDrawPath = keyPosition.mDrawPath;
|
||||
this.mPercentWidth = keyPosition.mPercentWidth;
|
||||
this.mPercentHeight = Float.NaN;
|
||||
this.mPercentX = keyPosition.mPercentX;
|
||||
this.mPercentY = keyPosition.mPercentY;
|
||||
this.mAltPercentX = keyPosition.mAltPercentX;
|
||||
this.mAltPercentY = keyPosition.mAltPercentY;
|
||||
this.mCalculatedPositionX = keyPosition.mCalculatedPositionX;
|
||||
this.mCalculatedPositionY = keyPosition.mCalculatedPositionY;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // androidx.constraintlayout.motion.widget.Key
|
||||
/* renamed from: clone */
|
||||
public Key mo49clone() {
|
||||
return new KeyPosition().copy(this);
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package androidx.constraintlayout.motion.widget;
|
||||
|
||||
import android.graphics.RectF;
|
||||
import android.view.View;
|
||||
import java.util.HashSet;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
abstract class KeyPositionBase extends Key {
|
||||
protected static final float SELECTION_SLOPE = 20.0f;
|
||||
int mCurveFit = UNSET;
|
||||
|
||||
abstract void calcPosition(int layoutWidth, int layoutHeight, float start_x, float start_y, float end_x, float end_y);
|
||||
|
||||
@Override // androidx.constraintlayout.motion.widget.Key
|
||||
void getAttributeNames(HashSet<String> attributes) {
|
||||
}
|
||||
|
||||
abstract float getPositionX();
|
||||
|
||||
abstract float getPositionY();
|
||||
|
||||
public abstract boolean intersects(int layoutWidth, int layoutHeight, RectF start, RectF end, float x, float y);
|
||||
|
||||
abstract void positionAttributes(View view, RectF start, RectF end, float x, float y, String[] attribute, float[] value);
|
||||
|
||||
KeyPositionBase() {
|
||||
}
|
||||
}
|
@ -0,0 +1,413 @@
|
||||
package androidx.constraintlayout.motion.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.util.SparseIntArray;
|
||||
import androidx.constraintlayout.motion.utils.ViewSpline;
|
||||
import androidx.constraintlayout.widget.R;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class KeyTimeCycle extends Key {
|
||||
public static final int KEY_TYPE = 3;
|
||||
static final String NAME = "KeyTimeCycle";
|
||||
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 = "KeyTimeCycle";
|
||||
public static final String WAVE_OFFSET = "waveOffset";
|
||||
public static final String WAVE_PERIOD = "wavePeriod";
|
||||
public static final String WAVE_SHAPE = "waveShape";
|
||||
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;
|
||||
|
||||
public KeyTimeCycle() {
|
||||
this.mType = 3;
|
||||
this.mCustomConstraints = new HashMap<>();
|
||||
}
|
||||
|
||||
@Override // androidx.constraintlayout.motion.widget.Key
|
||||
public void load(Context context, AttributeSet attrs) {
|
||||
Loader.read(this, context.obtainStyledAttributes(attrs, R.styleable.KeyTimeCycle));
|
||||
}
|
||||
|
||||
@Override // androidx.constraintlayout.motion.widget.Key
|
||||
public void getAttributeNames(HashSet<String> attributes) {
|
||||
if (!Float.isNaN(this.mAlpha)) {
|
||||
attributes.add("alpha");
|
||||
}
|
||||
if (!Float.isNaN(this.mElevation)) {
|
||||
attributes.add("elevation");
|
||||
}
|
||||
if (!Float.isNaN(this.mRotation)) {
|
||||
attributes.add(Key.ROTATION);
|
||||
}
|
||||
if (!Float.isNaN(this.mRotationX)) {
|
||||
attributes.add("rotationX");
|
||||
}
|
||||
if (!Float.isNaN(this.mRotationY)) {
|
||||
attributes.add("rotationY");
|
||||
}
|
||||
if (!Float.isNaN(this.mTranslationX)) {
|
||||
attributes.add("translationX");
|
||||
}
|
||||
if (!Float.isNaN(this.mTranslationY)) {
|
||||
attributes.add("translationY");
|
||||
}
|
||||
if (!Float.isNaN(this.mTranslationZ)) {
|
||||
attributes.add("translationZ");
|
||||
}
|
||||
if (!Float.isNaN(this.mTransitionPathRotate)) {
|
||||
attributes.add("transitionPathRotate");
|
||||
}
|
||||
if (!Float.isNaN(this.mScaleX)) {
|
||||
attributes.add("scaleX");
|
||||
}
|
||||
if (!Float.isNaN(this.mScaleY)) {
|
||||
attributes.add("scaleY");
|
||||
}
|
||||
if (!Float.isNaN(this.mProgress)) {
|
||||
attributes.add("progress");
|
||||
}
|
||||
if (this.mCustomConstraints.size() > 0) {
|
||||
Iterator<String> it = this.mCustomConstraints.keySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
attributes.add("CUSTOM," + it.next());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.constraintlayout.motion.widget.Key
|
||||
public void setInterpolation(HashMap<String, Integer> interpolation) {
|
||||
if (this.mCurveFit == -1) {
|
||||
return;
|
||||
}
|
||||
if (!Float.isNaN(this.mAlpha)) {
|
||||
interpolation.put("alpha", Integer.valueOf(this.mCurveFit));
|
||||
}
|
||||
if (!Float.isNaN(this.mElevation)) {
|
||||
interpolation.put("elevation", Integer.valueOf(this.mCurveFit));
|
||||
}
|
||||
if (!Float.isNaN(this.mRotation)) {
|
||||
interpolation.put(Key.ROTATION, Integer.valueOf(this.mCurveFit));
|
||||
}
|
||||
if (!Float.isNaN(this.mRotationX)) {
|
||||
interpolation.put("rotationX", Integer.valueOf(this.mCurveFit));
|
||||
}
|
||||
if (!Float.isNaN(this.mRotationY)) {
|
||||
interpolation.put("rotationY", Integer.valueOf(this.mCurveFit));
|
||||
}
|
||||
if (!Float.isNaN(this.mTranslationX)) {
|
||||
interpolation.put("translationX", Integer.valueOf(this.mCurveFit));
|
||||
}
|
||||
if (!Float.isNaN(this.mTranslationY)) {
|
||||
interpolation.put("translationY", Integer.valueOf(this.mCurveFit));
|
||||
}
|
||||
if (!Float.isNaN(this.mTranslationZ)) {
|
||||
interpolation.put("translationZ", Integer.valueOf(this.mCurveFit));
|
||||
}
|
||||
if (!Float.isNaN(this.mTransitionPathRotate)) {
|
||||
interpolation.put("transitionPathRotate", Integer.valueOf(this.mCurveFit));
|
||||
}
|
||||
if (!Float.isNaN(this.mScaleX)) {
|
||||
interpolation.put("scaleX", Integer.valueOf(this.mCurveFit));
|
||||
}
|
||||
if (!Float.isNaN(this.mScaleX)) {
|
||||
interpolation.put("scaleY", Integer.valueOf(this.mCurveFit));
|
||||
}
|
||||
if (!Float.isNaN(this.mProgress)) {
|
||||
interpolation.put("progress", Integer.valueOf(this.mCurveFit));
|
||||
}
|
||||
if (this.mCustomConstraints.size() > 0) {
|
||||
Iterator<String> it = this.mCustomConstraints.keySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
interpolation.put("CUSTOM," + it.next(), Integer.valueOf(this.mCurveFit));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.constraintlayout.motion.widget.Key
|
||||
public void addValues(HashMap<String, ViewSpline> splines) {
|
||||
throw new IllegalArgumentException(" KeyTimeCycles do not support SplineSet");
|
||||
}
|
||||
|
||||
/* 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("scaleY") == 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.motion.utils.ViewTimeCycle> r11) {
|
||||
/*
|
||||
Method dump skipped, instructions count: 604
|
||||
To view this dump add '--comments-level debug' option
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: androidx.constraintlayout.motion.widget.KeyTimeCycle.addTimeValues(java.util.HashMap):void");
|
||||
}
|
||||
|
||||
@Override // androidx.constraintlayout.motion.widget.Key
|
||||
public void setValue(String tag, Object value) {
|
||||
tag.hashCode();
|
||||
switch (tag) {
|
||||
case "motionProgress":
|
||||
this.mProgress = toFloat(value);
|
||||
break;
|
||||
case "transitionEasing":
|
||||
this.mTransitionEasing = value.toString();
|
||||
break;
|
||||
case "rotationX":
|
||||
this.mRotationX = toFloat(value);
|
||||
break;
|
||||
case "rotationY":
|
||||
this.mRotationY = toFloat(value);
|
||||
break;
|
||||
case "translationX":
|
||||
this.mTranslationX = toFloat(value);
|
||||
break;
|
||||
case "translationY":
|
||||
this.mTranslationY = toFloat(value);
|
||||
break;
|
||||
case "translationZ":
|
||||
this.mTranslationZ = toFloat(value);
|
||||
break;
|
||||
case "scaleX":
|
||||
this.mScaleX = toFloat(value);
|
||||
break;
|
||||
case "scaleY":
|
||||
this.mScaleY = toFloat(value);
|
||||
break;
|
||||
case "rotation":
|
||||
this.mRotation = toFloat(value);
|
||||
break;
|
||||
case "elevation":
|
||||
this.mElevation = toFloat(value);
|
||||
break;
|
||||
case "transitionPathRotate":
|
||||
this.mTransitionPathRotate = toFloat(value);
|
||||
break;
|
||||
case "alpha":
|
||||
this.mAlpha = toFloat(value);
|
||||
break;
|
||||
case "waveOffset":
|
||||
this.mWaveOffset = toFloat(value);
|
||||
break;
|
||||
case "wavePeriod":
|
||||
this.mWavePeriod = toFloat(value);
|
||||
break;
|
||||
case "curveFit":
|
||||
this.mCurveFit = toInt(value);
|
||||
break;
|
||||
case "waveShape":
|
||||
if (value instanceof Integer) {
|
||||
this.mWaveShape = toInt(value);
|
||||
break;
|
||||
} else {
|
||||
this.mWaveShape = 7;
|
||||
this.mCustomWaveShape = value.toString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class Loader {
|
||||
private static final int ANDROID_ALPHA = 1;
|
||||
private static final int ANDROID_ELEVATION = 2;
|
||||
private static final int ANDROID_ROTATION = 4;
|
||||
private static final int ANDROID_ROTATION_X = 5;
|
||||
private static final int ANDROID_ROTATION_Y = 6;
|
||||
private static final int ANDROID_SCALE_X = 7;
|
||||
private static final int ANDROID_SCALE_Y = 14;
|
||||
private static final int ANDROID_TRANSLATION_X = 15;
|
||||
private static final int ANDROID_TRANSLATION_Y = 16;
|
||||
private static final int ANDROID_TRANSLATION_Z = 17;
|
||||
private static final int CURVE_FIT = 13;
|
||||
private static final int FRAME_POSITION = 12;
|
||||
private static final int PROGRESS = 18;
|
||||
private static final int TARGET_ID = 10;
|
||||
private static final int TRANSITION_EASING = 9;
|
||||
private static final int TRANSITION_PATH_ROTATE = 8;
|
||||
private static final int WAVE_OFFSET = 21;
|
||||
private static final int WAVE_PERIOD = 20;
|
||||
private static final int WAVE_SHAPE = 19;
|
||||
private static SparseIntArray mAttrMap;
|
||||
|
||||
private Loader() {
|
||||
}
|
||||
|
||||
static {
|
||||
SparseIntArray sparseIntArray = new SparseIntArray();
|
||||
mAttrMap = sparseIntArray;
|
||||
sparseIntArray.append(R.styleable.KeyTimeCycle_android_alpha, 1);
|
||||
mAttrMap.append(R.styleable.KeyTimeCycle_android_elevation, 2);
|
||||
mAttrMap.append(R.styleable.KeyTimeCycle_android_rotation, 4);
|
||||
mAttrMap.append(R.styleable.KeyTimeCycle_android_rotationX, 5);
|
||||
mAttrMap.append(R.styleable.KeyTimeCycle_android_rotationY, 6);
|
||||
mAttrMap.append(R.styleable.KeyTimeCycle_android_scaleX, 7);
|
||||
mAttrMap.append(R.styleable.KeyTimeCycle_transitionPathRotate, 8);
|
||||
mAttrMap.append(R.styleable.KeyTimeCycle_transitionEasing, 9);
|
||||
mAttrMap.append(R.styleable.KeyTimeCycle_motionTarget, 10);
|
||||
mAttrMap.append(R.styleable.KeyTimeCycle_framePosition, 12);
|
||||
mAttrMap.append(R.styleable.KeyTimeCycle_curveFit, 13);
|
||||
mAttrMap.append(R.styleable.KeyTimeCycle_android_scaleY, 14);
|
||||
mAttrMap.append(R.styleable.KeyTimeCycle_android_translationX, 15);
|
||||
mAttrMap.append(R.styleable.KeyTimeCycle_android_translationY, 16);
|
||||
mAttrMap.append(R.styleable.KeyTimeCycle_android_translationZ, 17);
|
||||
mAttrMap.append(R.styleable.KeyTimeCycle_motionProgress, 18);
|
||||
mAttrMap.append(R.styleable.KeyTimeCycle_wavePeriod, 20);
|
||||
mAttrMap.append(R.styleable.KeyTimeCycle_waveOffset, 21);
|
||||
mAttrMap.append(R.styleable.KeyTimeCycle_waveShape, 19);
|
||||
}
|
||||
|
||||
public static void read(KeyTimeCycle c, TypedArray a) {
|
||||
int indexCount = a.getIndexCount();
|
||||
for (int i = 0; i < indexCount; i++) {
|
||||
int index = a.getIndex(i);
|
||||
switch (mAttrMap.get(index)) {
|
||||
case 1:
|
||||
c.mAlpha = a.getFloat(index, c.mAlpha);
|
||||
break;
|
||||
case 2:
|
||||
c.mElevation = a.getDimension(index, c.mElevation);
|
||||
break;
|
||||
case 3:
|
||||
case 11:
|
||||
default:
|
||||
Log.e("KeyTimeCycle", "unused attribute 0x" + Integer.toHexString(index) + " " + mAttrMap.get(index));
|
||||
break;
|
||||
case 4:
|
||||
c.mRotation = a.getFloat(index, c.mRotation);
|
||||
break;
|
||||
case 5:
|
||||
c.mRotationX = a.getFloat(index, c.mRotationX);
|
||||
break;
|
||||
case 6:
|
||||
c.mRotationY = a.getFloat(index, c.mRotationY);
|
||||
break;
|
||||
case 7:
|
||||
c.mScaleX = a.getFloat(index, c.mScaleX);
|
||||
break;
|
||||
case 8:
|
||||
c.mTransitionPathRotate = a.getFloat(index, c.mTransitionPathRotate);
|
||||
break;
|
||||
case 9:
|
||||
c.mTransitionEasing = a.getString(index);
|
||||
break;
|
||||
case 10:
|
||||
if (MotionLayout.IS_IN_EDIT_MODE) {
|
||||
c.mTargetId = a.getResourceId(index, c.mTargetId);
|
||||
if (c.mTargetId == -1) {
|
||||
c.mTargetString = a.getString(index);
|
||||
break;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
} else if (a.peekValue(index).type == 3) {
|
||||
c.mTargetString = a.getString(index);
|
||||
break;
|
||||
} else {
|
||||
c.mTargetId = a.getResourceId(index, c.mTargetId);
|
||||
break;
|
||||
}
|
||||
case 12:
|
||||
c.mFramePosition = a.getInt(index, c.mFramePosition);
|
||||
break;
|
||||
case 13:
|
||||
c.mCurveFit = a.getInteger(index, c.mCurveFit);
|
||||
break;
|
||||
case 14:
|
||||
c.mScaleY = a.getFloat(index, c.mScaleY);
|
||||
break;
|
||||
case 15:
|
||||
c.mTranslationX = a.getDimension(index, c.mTranslationX);
|
||||
break;
|
||||
case 16:
|
||||
c.mTranslationY = a.getDimension(index, c.mTranslationY);
|
||||
break;
|
||||
case 17:
|
||||
c.mTranslationZ = a.getDimension(index, c.mTranslationZ);
|
||||
break;
|
||||
case 18:
|
||||
c.mProgress = a.getFloat(index, c.mProgress);
|
||||
break;
|
||||
case 19:
|
||||
if (a.peekValue(index).type == 3) {
|
||||
c.mCustomWaveShape = a.getString(index);
|
||||
c.mWaveShape = 7;
|
||||
break;
|
||||
} else {
|
||||
c.mWaveShape = a.getInt(index, c.mWaveShape);
|
||||
break;
|
||||
}
|
||||
case 20:
|
||||
c.mWavePeriod = a.getFloat(index, c.mWavePeriod);
|
||||
break;
|
||||
case 21:
|
||||
if (a.peekValue(index).type == 5) {
|
||||
c.mWaveOffset = a.getDimension(index, c.mWaveOffset);
|
||||
break;
|
||||
} else {
|
||||
c.mWaveOffset = a.getFloat(index, c.mWaveOffset);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.constraintlayout.motion.widget.Key
|
||||
public Key copy(Key src) {
|
||||
super.copy(src);
|
||||
KeyTimeCycle keyTimeCycle = (KeyTimeCycle) src;
|
||||
this.mTransitionEasing = keyTimeCycle.mTransitionEasing;
|
||||
this.mCurveFit = keyTimeCycle.mCurveFit;
|
||||
this.mWaveShape = keyTimeCycle.mWaveShape;
|
||||
this.mWavePeriod = keyTimeCycle.mWavePeriod;
|
||||
this.mWaveOffset = keyTimeCycle.mWaveOffset;
|
||||
this.mProgress = keyTimeCycle.mProgress;
|
||||
this.mAlpha = keyTimeCycle.mAlpha;
|
||||
this.mElevation = keyTimeCycle.mElevation;
|
||||
this.mRotation = keyTimeCycle.mRotation;
|
||||
this.mTransitionPathRotate = keyTimeCycle.mTransitionPathRotate;
|
||||
this.mRotationX = keyTimeCycle.mRotationX;
|
||||
this.mRotationY = keyTimeCycle.mRotationY;
|
||||
this.mScaleX = keyTimeCycle.mScaleX;
|
||||
this.mScaleY = keyTimeCycle.mScaleY;
|
||||
this.mTranslationX = keyTimeCycle.mTranslationX;
|
||||
this.mTranslationY = keyTimeCycle.mTranslationY;
|
||||
this.mTranslationZ = keyTimeCycle.mTranslationZ;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // androidx.constraintlayout.motion.widget.Key
|
||||
/* renamed from: clone */
|
||||
public Key mo49clone() {
|
||||
return new KeyTimeCycle().copy(this);
|
||||
}
|
||||
}
|
@ -0,0 +1,333 @@
|
||||
package androidx.constraintlayout.motion.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.RectF;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.util.SparseIntArray;
|
||||
import android.view.View;
|
||||
import androidx.constraintlayout.core.motion.utils.TypedValues;
|
||||
import androidx.constraintlayout.motion.utils.ViewSpline;
|
||||
import androidx.constraintlayout.widget.ConstraintAttribute;
|
||||
import androidx.constraintlayout.widget.R;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class KeyTrigger extends Key {
|
||||
public static final String CROSS = "CROSS";
|
||||
public static final int KEY_TYPE = 5;
|
||||
static final String NAME = "KeyTrigger";
|
||||
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 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;
|
||||
private View mTriggerCollisionView = null;
|
||||
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;
|
||||
RectF mCollisionRect = new RectF();
|
||||
RectF mTargetRect = new RectF();
|
||||
HashMap<String, Method> mMethodHashMap = new HashMap<>();
|
||||
|
||||
@Override // androidx.constraintlayout.motion.widget.Key
|
||||
public void addValues(HashMap<String, ViewSpline> splines) {
|
||||
}
|
||||
|
||||
@Override // androidx.constraintlayout.motion.widget.Key
|
||||
public void getAttributeNames(HashSet<String> attributes) {
|
||||
}
|
||||
|
||||
int getCurveFit() {
|
||||
return this.mCurveFit;
|
||||
}
|
||||
|
||||
public KeyTrigger() {
|
||||
this.mType = 5;
|
||||
this.mCustomConstraints = new HashMap<>();
|
||||
}
|
||||
|
||||
@Override // androidx.constraintlayout.motion.widget.Key
|
||||
public void load(Context context, AttributeSet attrs) {
|
||||
Loader.read(this, context.obtainStyledAttributes(attrs, R.styleable.KeyTrigger), context);
|
||||
}
|
||||
|
||||
@Override // androidx.constraintlayout.motion.widget.Key
|
||||
public void setValue(String tag, Object value) {
|
||||
tag.hashCode();
|
||||
switch (tag) {
|
||||
case "positiveCross":
|
||||
this.mPositiveCross = value.toString();
|
||||
break;
|
||||
case "viewTransitionOnPositiveCross":
|
||||
this.mViewTransitionOnPositiveCross = toInt(value);
|
||||
break;
|
||||
case "triggerCollisionId":
|
||||
this.mTriggerCollisionId = toInt(value);
|
||||
break;
|
||||
case "triggerID":
|
||||
this.mTriggerID = toInt(value);
|
||||
break;
|
||||
case "negativeCross":
|
||||
this.mNegativeCross = value.toString();
|
||||
break;
|
||||
case "triggerCollisionView":
|
||||
this.mTriggerCollisionView = (View) value;
|
||||
break;
|
||||
case "viewTransitionOnNegativeCross":
|
||||
this.mViewTransitionOnNegativeCross = toInt(value);
|
||||
break;
|
||||
case "CROSS":
|
||||
this.mCross = value.toString();
|
||||
break;
|
||||
case "triggerSlack":
|
||||
this.mTriggerSlack = toFloat(value);
|
||||
break;
|
||||
case "viewTransitionOnCross":
|
||||
this.mViewTransitionOnCross = toInt(value);
|
||||
break;
|
||||
case "postLayout":
|
||||
this.mPostLayout = toBoolean(value);
|
||||
break;
|
||||
case "triggerReceiver":
|
||||
this.mTriggerReceiver = toInt(value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void setUpRect(RectF rect, View child, boolean postLayout) {
|
||||
rect.top = child.getTop();
|
||||
rect.bottom = child.getBottom();
|
||||
rect.left = child.getLeft();
|
||||
rect.right = child.getRight();
|
||||
if (postLayout) {
|
||||
child.getMatrix().mapRect(rect);
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX WARN: Removed duplicated region for block: B:68:0x008d */
|
||||
/* JADX WARN: Removed duplicated region for block: B:75:0x00b7 */
|
||||
/* JADX WARN: Removed duplicated region for block: B:82:0x00d1 */
|
||||
/* JADX WARN: Removed duplicated region for block: B:87:0x00a2 */
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct add '--show-bad-code' argument
|
||||
*/
|
||||
public void conditionallyFire(float r10, android.view.View r11) {
|
||||
/*
|
||||
Method dump skipped, instructions count: 357
|
||||
To view this dump add '--comments-level debug' option
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: androidx.constraintlayout.motion.widget.KeyTrigger.conditionallyFire(float, android.view.View):void");
|
||||
}
|
||||
|
||||
private void fire(String str, View call) {
|
||||
Method method;
|
||||
if (str == null) {
|
||||
return;
|
||||
}
|
||||
if (str.startsWith(".")) {
|
||||
fireCustom(str, call);
|
||||
return;
|
||||
}
|
||||
if (this.mMethodHashMap.containsKey(str)) {
|
||||
method = this.mMethodHashMap.get(str);
|
||||
if (method == null) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
method = null;
|
||||
}
|
||||
if (method == null) {
|
||||
try {
|
||||
method = call.getClass().getMethod(str, new Class[0]);
|
||||
this.mMethodHashMap.put(str, method);
|
||||
} catch (NoSuchMethodException unused) {
|
||||
this.mMethodHashMap.put(str, null);
|
||||
Log.e(TypedValues.TriggerType.NAME, "Could not find method \"" + str + "\"on class " + call.getClass().getSimpleName() + " " + Debug.getName(call));
|
||||
return;
|
||||
}
|
||||
}
|
||||
try {
|
||||
method.invoke(call, new Object[0]);
|
||||
} catch (Exception unused2) {
|
||||
Log.e(TypedValues.TriggerType.NAME, "Exception in call \"" + this.mCross + "\"on class " + call.getClass().getSimpleName() + " " + Debug.getName(call));
|
||||
}
|
||||
}
|
||||
|
||||
private void fireCustom(String str, View view) {
|
||||
boolean z = str.length() == 1;
|
||||
if (!z) {
|
||||
str = str.substring(1).toLowerCase(Locale.ROOT);
|
||||
}
|
||||
for (String str2 : this.mCustomConstraints.keySet()) {
|
||||
String lowerCase = str2.toLowerCase(Locale.ROOT);
|
||||
if (z || lowerCase.matches(str)) {
|
||||
ConstraintAttribute constraintAttribute = this.mCustomConstraints.get(str2);
|
||||
if (constraintAttribute != null) {
|
||||
constraintAttribute.applyCustom(view);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class Loader {
|
||||
private static final int COLLISION = 9;
|
||||
private static final int CROSS = 4;
|
||||
private static final int FRAME_POS = 8;
|
||||
private static final int NEGATIVE_CROSS = 1;
|
||||
private static final int POSITIVE_CROSS = 2;
|
||||
private static final int POST_LAYOUT = 10;
|
||||
private static final int TARGET_ID = 7;
|
||||
private static final int TRIGGER_ID = 6;
|
||||
private static final int TRIGGER_RECEIVER = 11;
|
||||
private static final int TRIGGER_SLACK = 5;
|
||||
private static final int VT_CROSS = 12;
|
||||
private static final int VT_NEGATIVE_CROSS = 13;
|
||||
private static final int VT_POSITIVE_CROSS = 14;
|
||||
private static SparseIntArray mAttrMap;
|
||||
|
||||
private Loader() {
|
||||
}
|
||||
|
||||
static {
|
||||
SparseIntArray sparseIntArray = new SparseIntArray();
|
||||
mAttrMap = sparseIntArray;
|
||||
sparseIntArray.append(R.styleable.KeyTrigger_framePosition, 8);
|
||||
mAttrMap.append(R.styleable.KeyTrigger_onCross, 4);
|
||||
mAttrMap.append(R.styleable.KeyTrigger_onNegativeCross, 1);
|
||||
mAttrMap.append(R.styleable.KeyTrigger_onPositiveCross, 2);
|
||||
mAttrMap.append(R.styleable.KeyTrigger_motionTarget, 7);
|
||||
mAttrMap.append(R.styleable.KeyTrigger_triggerId, 6);
|
||||
mAttrMap.append(R.styleable.KeyTrigger_triggerSlack, 5);
|
||||
mAttrMap.append(R.styleable.KeyTrigger_motion_triggerOnCollision, 9);
|
||||
mAttrMap.append(R.styleable.KeyTrigger_motion_postLayoutCollision, 10);
|
||||
mAttrMap.append(R.styleable.KeyTrigger_triggerReceiver, 11);
|
||||
mAttrMap.append(R.styleable.KeyTrigger_viewTransitionOnCross, 12);
|
||||
mAttrMap.append(R.styleable.KeyTrigger_viewTransitionOnNegativeCross, 13);
|
||||
mAttrMap.append(R.styleable.KeyTrigger_viewTransitionOnPositiveCross, 14);
|
||||
}
|
||||
|
||||
public static void read(KeyTrigger c, TypedArray a, Context context) {
|
||||
int indexCount = a.getIndexCount();
|
||||
for (int i = 0; i < indexCount; i++) {
|
||||
int index = a.getIndex(i);
|
||||
switch (mAttrMap.get(index)) {
|
||||
case 1:
|
||||
c.mNegativeCross = a.getString(index);
|
||||
break;
|
||||
case 2:
|
||||
c.mPositiveCross = a.getString(index);
|
||||
break;
|
||||
case 3:
|
||||
default:
|
||||
Log.e(TypedValues.TriggerType.NAME, "unused attribute 0x" + Integer.toHexString(index) + " " + mAttrMap.get(index));
|
||||
break;
|
||||
case 4:
|
||||
c.mCross = a.getString(index);
|
||||
break;
|
||||
case 5:
|
||||
c.mTriggerSlack = a.getFloat(index, c.mTriggerSlack);
|
||||
break;
|
||||
case 6:
|
||||
c.mTriggerID = a.getResourceId(index, c.mTriggerID);
|
||||
break;
|
||||
case 7:
|
||||
if (MotionLayout.IS_IN_EDIT_MODE) {
|
||||
c.mTargetId = a.getResourceId(index, c.mTargetId);
|
||||
if (c.mTargetId == -1) {
|
||||
c.mTargetString = a.getString(index);
|
||||
break;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
} else if (a.peekValue(index).type == 3) {
|
||||
c.mTargetString = a.getString(index);
|
||||
break;
|
||||
} else {
|
||||
c.mTargetId = a.getResourceId(index, c.mTargetId);
|
||||
break;
|
||||
}
|
||||
case 8:
|
||||
c.mFramePosition = a.getInteger(index, c.mFramePosition);
|
||||
c.mFireThreshold = (c.mFramePosition + 0.5f) / 100.0f;
|
||||
break;
|
||||
case 9:
|
||||
c.mTriggerCollisionId = a.getResourceId(index, c.mTriggerCollisionId);
|
||||
break;
|
||||
case 10:
|
||||
c.mPostLayout = a.getBoolean(index, c.mPostLayout);
|
||||
break;
|
||||
case 11:
|
||||
c.mTriggerReceiver = a.getResourceId(index, c.mTriggerReceiver);
|
||||
break;
|
||||
case 12:
|
||||
c.mViewTransitionOnCross = a.getResourceId(index, c.mViewTransitionOnCross);
|
||||
break;
|
||||
case 13:
|
||||
c.mViewTransitionOnNegativeCross = a.getResourceId(index, c.mViewTransitionOnNegativeCross);
|
||||
break;
|
||||
case 14:
|
||||
c.mViewTransitionOnPositiveCross = a.getResourceId(index, c.mViewTransitionOnPositiveCross);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.constraintlayout.motion.widget.Key
|
||||
public Key copy(Key src) {
|
||||
super.copy(src);
|
||||
KeyTrigger keyTrigger = (KeyTrigger) src;
|
||||
this.mCurveFit = keyTrigger.mCurveFit;
|
||||
this.mCross = keyTrigger.mCross;
|
||||
this.mTriggerReceiver = keyTrigger.mTriggerReceiver;
|
||||
this.mNegativeCross = keyTrigger.mNegativeCross;
|
||||
this.mPositiveCross = keyTrigger.mPositiveCross;
|
||||
this.mTriggerID = keyTrigger.mTriggerID;
|
||||
this.mTriggerCollisionId = keyTrigger.mTriggerCollisionId;
|
||||
this.mTriggerCollisionView = keyTrigger.mTriggerCollisionView;
|
||||
this.mTriggerSlack = keyTrigger.mTriggerSlack;
|
||||
this.mFireCrossReset = keyTrigger.mFireCrossReset;
|
||||
this.mFireNegativeReset = keyTrigger.mFireNegativeReset;
|
||||
this.mFirePositiveReset = keyTrigger.mFirePositiveReset;
|
||||
this.mFireThreshold = keyTrigger.mFireThreshold;
|
||||
this.mFireLastPos = keyTrigger.mFireLastPos;
|
||||
this.mPostLayout = keyTrigger.mPostLayout;
|
||||
this.mCollisionRect = keyTrigger.mCollisionRect;
|
||||
this.mTargetRect = keyTrigger.mTargetRect;
|
||||
this.mMethodHashMap = keyTrigger.mMethodHashMap;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // androidx.constraintlayout.motion.widget.Key
|
||||
/* renamed from: clone */
|
||||
public Key mo49clone() {
|
||||
return new KeyTrigger().copy(this);
|
||||
}
|
||||
}
|
@ -0,0 +1,406 @@
|
||||
package androidx.constraintlayout.motion.widget;
|
||||
|
||||
import android.graphics.Rect;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import androidx.constraintlayout.core.motion.utils.Easing;
|
||||
import androidx.constraintlayout.motion.utils.ViewSpline;
|
||||
import androidx.constraintlayout.widget.ConstraintAttribute;
|
||||
import androidx.constraintlayout.widget.ConstraintSet;
|
||||
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, ConstraintAttribute> attributes = new LinkedHashMap<>();
|
||||
int mMode = 0;
|
||||
double[] mTempValue = new double[18];
|
||||
double[] mTempDelta = new double[18];
|
||||
|
||||
void setBounds(float x, float y, float w, float h) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.width = w;
|
||||
this.height = h;
|
||||
}
|
||||
|
||||
private boolean diff(float a, float b) {
|
||||
return (Float.isNaN(a) || Float.isNaN(b)) ? Float.isNaN(a) != Float.isNaN(b) : Math.abs(a - b) > 1.0E-6f;
|
||||
}
|
||||
|
||||
void different(MotionConstrainedPoint points, HashSet<String> keySet) {
|
||||
if (diff(this.alpha, points.alpha)) {
|
||||
keySet.add("alpha");
|
||||
}
|
||||
if (diff(this.elevation, points.elevation)) {
|
||||
keySet.add("elevation");
|
||||
}
|
||||
int i = this.visibility;
|
||||
int i2 = points.visibility;
|
||||
if (i != i2 && this.mVisibilityMode == 0 && (i == 0 || i2 == 0)) {
|
||||
keySet.add("alpha");
|
||||
}
|
||||
if (diff(this.rotation, points.rotation)) {
|
||||
keySet.add(Key.ROTATION);
|
||||
}
|
||||
if (!Float.isNaN(this.mPathRotate) || !Float.isNaN(points.mPathRotate)) {
|
||||
keySet.add("transitionPathRotate");
|
||||
}
|
||||
if (!Float.isNaN(this.mProgress) || !Float.isNaN(points.mProgress)) {
|
||||
keySet.add("progress");
|
||||
}
|
||||
if (diff(this.rotationX, points.rotationX)) {
|
||||
keySet.add("rotationX");
|
||||
}
|
||||
if (diff(this.rotationY, points.rotationY)) {
|
||||
keySet.add("rotationY");
|
||||
}
|
||||
if (diff(this.mPivotX, points.mPivotX)) {
|
||||
keySet.add(Key.PIVOT_X);
|
||||
}
|
||||
if (diff(this.mPivotY, points.mPivotY)) {
|
||||
keySet.add(Key.PIVOT_Y);
|
||||
}
|
||||
if (diff(this.scaleX, points.scaleX)) {
|
||||
keySet.add("scaleX");
|
||||
}
|
||||
if (diff(this.scaleY, points.scaleY)) {
|
||||
keySet.add("scaleY");
|
||||
}
|
||||
if (diff(this.translationX, points.translationX)) {
|
||||
keySet.add("translationX");
|
||||
}
|
||||
if (diff(this.translationY, points.translationY)) {
|
||||
keySet.add("translationY");
|
||||
}
|
||||
if (diff(this.translationZ, points.translationZ)) {
|
||||
keySet.add("translationZ");
|
||||
}
|
||||
}
|
||||
|
||||
void different(MotionConstrainedPoint points, boolean[] mask, String[] custom) {
|
||||
mask[0] = mask[0] | diff(this.position, points.position);
|
||||
mask[1] = mask[1] | diff(this.x, points.x);
|
||||
mask[2] = mask[2] | diff(this.y, points.y);
|
||||
mask[3] = mask[3] | diff(this.width, points.width);
|
||||
mask[4] = diff(this.height, points.height) | mask[4];
|
||||
}
|
||||
|
||||
void fillStandard(double[] data, int[] toUse) {
|
||||
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 : toUse) {
|
||||
if (i2 < 18) {
|
||||
data[i] = fArr[r4];
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
boolean hasCustomData(String name) {
|
||||
return this.attributes.containsKey(name);
|
||||
}
|
||||
|
||||
int getCustomDataCount(String name) {
|
||||
return this.attributes.get(name).numberOfInterpolatedValues();
|
||||
}
|
||||
|
||||
int getCustomData(String name, double[] value, int offset) {
|
||||
ConstraintAttribute constraintAttribute = this.attributes.get(name);
|
||||
if (constraintAttribute.numberOfInterpolatedValues() == 1) {
|
||||
value[offset] = constraintAttribute.getValueToInterpolate();
|
||||
return 1;
|
||||
}
|
||||
int numberOfInterpolatedValues = constraintAttribute.numberOfInterpolatedValues();
|
||||
constraintAttribute.getValuesToInterpolate(new float[numberOfInterpolatedValues]);
|
||||
int i = 0;
|
||||
while (i < numberOfInterpolatedValues) {
|
||||
value[offset] = r1[i];
|
||||
i++;
|
||||
offset++;
|
||||
}
|
||||
return numberOfInterpolatedValues;
|
||||
}
|
||||
|
||||
@Override // java.lang.Comparable
|
||||
public int compareTo(MotionConstrainedPoint o) {
|
||||
return Float.compare(this.position, o.position);
|
||||
}
|
||||
|
||||
public void applyParameters(View view) {
|
||||
this.visibility = view.getVisibility();
|
||||
this.alpha = view.getVisibility() != 0 ? 0.0f : view.getAlpha();
|
||||
this.applyElevation = false;
|
||||
this.elevation = view.getElevation();
|
||||
this.rotation = view.getRotation();
|
||||
this.rotationX = view.getRotationX();
|
||||
this.rotationY = view.getRotationY();
|
||||
this.scaleX = view.getScaleX();
|
||||
this.scaleY = view.getScaleY();
|
||||
this.mPivotX = view.getPivotX();
|
||||
this.mPivotY = view.getPivotY();
|
||||
this.translationX = view.getTranslationX();
|
||||
this.translationY = view.getTranslationY();
|
||||
this.translationZ = view.getTranslationZ();
|
||||
}
|
||||
|
||||
public void applyParameters(ConstraintSet.Constraint c) {
|
||||
this.mVisibilityMode = c.propertySet.mVisibilityMode;
|
||||
this.visibility = c.propertySet.visibility;
|
||||
this.alpha = (c.propertySet.visibility == 0 || this.mVisibilityMode != 0) ? c.propertySet.alpha : 0.0f;
|
||||
this.applyElevation = c.transform.applyElevation;
|
||||
this.elevation = c.transform.elevation;
|
||||
this.rotation = c.transform.rotation;
|
||||
this.rotationX = c.transform.rotationX;
|
||||
this.rotationY = c.transform.rotationY;
|
||||
this.scaleX = c.transform.scaleX;
|
||||
this.scaleY = c.transform.scaleY;
|
||||
this.mPivotX = c.transform.transformPivotX;
|
||||
this.mPivotY = c.transform.transformPivotY;
|
||||
this.translationX = c.transform.translationX;
|
||||
this.translationY = c.transform.translationY;
|
||||
this.translationZ = c.transform.translationZ;
|
||||
this.mKeyFrameEasing = Easing.getInterpolator(c.motion.mTransitionEasing);
|
||||
this.mPathRotate = c.motion.mPathRotate;
|
||||
this.mDrawPath = c.motion.mDrawPath;
|
||||
this.mAnimateRelativeTo = c.motion.mAnimateRelativeTo;
|
||||
this.mProgress = c.propertySet.mProgress;
|
||||
for (String str : c.mCustomConstraints.keySet()) {
|
||||
ConstraintAttribute constraintAttribute = c.mCustomConstraints.get(str);
|
||||
if (constraintAttribute.isContinuous()) {
|
||||
this.attributes.put(str, constraintAttribute);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX WARN: Failed to restore switch over string. Please report as a decompilation issue */
|
||||
public void addValues(HashMap<String, ViewSpline> splines, int mFramePosition) {
|
||||
for (String str : splines.keySet()) {
|
||||
ViewSpline viewSpline = splines.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 -1225497657:
|
||||
if (str.equals("translationX")) {
|
||||
c = 2;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case -1225497656:
|
||||
if (str.equals("translationY")) {
|
||||
c = 3;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case -1225497655:
|
||||
if (str.equals("translationZ")) {
|
||||
c = 4;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case -1001078227:
|
||||
if (str.equals("progress")) {
|
||||
c = 5;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case -908189618:
|
||||
if (str.equals("scaleX")) {
|
||||
c = 6;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case -908189617:
|
||||
if (str.equals("scaleY")) {
|
||||
c = 7;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case -760884510:
|
||||
if (str.equals(Key.PIVOT_X)) {
|
||||
c = '\b';
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case -760884509:
|
||||
if (str.equals(Key.PIVOT_Y)) {
|
||||
c = '\t';
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case -40300674:
|
||||
if (str.equals(Key.ROTATION)) {
|
||||
c = '\n';
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case -4379043:
|
||||
if (str.equals("elevation")) {
|
||||
c = 11;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 37232917:
|
||||
if (str.equals("transitionPathRotate")) {
|
||||
c = '\f';
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 92909918:
|
||||
if (str.equals("alpha")) {
|
||||
c = '\r';
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
switch (c) {
|
||||
case 0:
|
||||
viewSpline.setPoint(mFramePosition, Float.isNaN(this.rotationX) ? 0.0f : this.rotationX);
|
||||
break;
|
||||
case 1:
|
||||
viewSpline.setPoint(mFramePosition, Float.isNaN(this.rotationY) ? 0.0f : this.rotationY);
|
||||
break;
|
||||
case 2:
|
||||
viewSpline.setPoint(mFramePosition, Float.isNaN(this.translationX) ? 0.0f : this.translationX);
|
||||
break;
|
||||
case 3:
|
||||
viewSpline.setPoint(mFramePosition, Float.isNaN(this.translationY) ? 0.0f : this.translationY);
|
||||
break;
|
||||
case 4:
|
||||
viewSpline.setPoint(mFramePosition, Float.isNaN(this.translationZ) ? 0.0f : this.translationZ);
|
||||
break;
|
||||
case 5:
|
||||
viewSpline.setPoint(mFramePosition, Float.isNaN(this.mProgress) ? 0.0f : this.mProgress);
|
||||
break;
|
||||
case 6:
|
||||
viewSpline.setPoint(mFramePosition, Float.isNaN(this.scaleX) ? 1.0f : this.scaleX);
|
||||
break;
|
||||
case 7:
|
||||
viewSpline.setPoint(mFramePosition, Float.isNaN(this.scaleY) ? 1.0f : this.scaleY);
|
||||
break;
|
||||
case '\b':
|
||||
viewSpline.setPoint(mFramePosition, Float.isNaN(this.mPivotX) ? 0.0f : this.mPivotX);
|
||||
break;
|
||||
case '\t':
|
||||
viewSpline.setPoint(mFramePosition, Float.isNaN(this.mPivotY) ? 0.0f : this.mPivotY);
|
||||
break;
|
||||
case '\n':
|
||||
viewSpline.setPoint(mFramePosition, Float.isNaN(this.rotation) ? 0.0f : this.rotation);
|
||||
break;
|
||||
case 11:
|
||||
viewSpline.setPoint(mFramePosition, Float.isNaN(this.elevation) ? 0.0f : this.elevation);
|
||||
break;
|
||||
case '\f':
|
||||
viewSpline.setPoint(mFramePosition, Float.isNaN(this.mPathRotate) ? 0.0f : this.mPathRotate);
|
||||
break;
|
||||
case '\r':
|
||||
viewSpline.setPoint(mFramePosition, Float.isNaN(this.alpha) ? 1.0f : this.alpha);
|
||||
break;
|
||||
default:
|
||||
if (!str.startsWith("CUSTOM")) {
|
||||
Log.e("MotionPaths", "UNKNOWN spline " + str);
|
||||
break;
|
||||
} else {
|
||||
String str2 = str.split(",")[1];
|
||||
if (this.attributes.containsKey(str2)) {
|
||||
ConstraintAttribute constraintAttribute = this.attributes.get(str2);
|
||||
if (viewSpline instanceof ViewSpline.CustomSet) {
|
||||
((ViewSpline.CustomSet) viewSpline).setPoint(mFramePosition, constraintAttribute);
|
||||
break;
|
||||
} else {
|
||||
Log.e("MotionPaths", str + " ViewSpline not a CustomSet frame = " + mFramePosition + ", value" + constraintAttribute.getValueToInterpolate() + viewSpline);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setState(View view) {
|
||||
setBounds(view.getX(), view.getY(), view.getWidth(), view.getHeight());
|
||||
applyParameters(view);
|
||||
}
|
||||
|
||||
public void setState(Rect rect, View view, int rotation, float prevous) {
|
||||
setBounds(rect.left, rect.top, rect.width(), rect.height());
|
||||
applyParameters(view);
|
||||
this.mPivotX = Float.NaN;
|
||||
this.mPivotY = Float.NaN;
|
||||
if (rotation == 1) {
|
||||
this.rotation = prevous - 90.0f;
|
||||
} else {
|
||||
if (rotation != 2) {
|
||||
return;
|
||||
}
|
||||
this.rotation = prevous + 90.0f;
|
||||
}
|
||||
}
|
||||
|
||||
public void setState(Rect cw, ConstraintSet constraintSet, int rotation, int viewId) {
|
||||
setBounds(cw.left, cw.top, cw.width(), cw.height());
|
||||
applyParameters(constraintSet.getParameters(viewId));
|
||||
if (rotation != 1) {
|
||||
if (rotation != 2) {
|
||||
if (rotation != 3) {
|
||||
if (rotation != 4) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
float f = this.rotation + 90.0f;
|
||||
this.rotation = f;
|
||||
if (f > 180.0f) {
|
||||
this.rotation = f - 360.0f;
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
this.rotation -= 90.0f;
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,132 @@
|
||||
package androidx.constraintlayout.motion.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Canvas;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import androidx.constraintlayout.widget.ConstraintHelper;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.constraintlayout.widget.R;
|
||||
import java.util.HashMap;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class MotionHelper extends ConstraintHelper implements MotionHelperInterface {
|
||||
private float mProgress;
|
||||
private boolean mUseOnHide;
|
||||
private boolean mUseOnShow;
|
||||
protected View[] views;
|
||||
|
||||
@Override // androidx.constraintlayout.motion.widget.Animatable
|
||||
public float getProgress() {
|
||||
return this.mProgress;
|
||||
}
|
||||
|
||||
public boolean isDecorator() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // androidx.constraintlayout.motion.widget.MotionHelperInterface
|
||||
public boolean isUseOnHide() {
|
||||
return this.mUseOnHide;
|
||||
}
|
||||
|
||||
@Override // androidx.constraintlayout.motion.widget.MotionHelperInterface
|
||||
public boolean isUsedOnShow() {
|
||||
return this.mUseOnShow;
|
||||
}
|
||||
|
||||
@Override // androidx.constraintlayout.motion.widget.MotionHelperInterface
|
||||
public void onFinishedMotionScene(MotionLayout motionLayout) {
|
||||
}
|
||||
|
||||
@Override // androidx.constraintlayout.motion.widget.MotionHelperInterface
|
||||
public void onPostDraw(Canvas canvas) {
|
||||
}
|
||||
|
||||
@Override // androidx.constraintlayout.motion.widget.MotionHelperInterface
|
||||
public void onPreDraw(Canvas canvas) {
|
||||
}
|
||||
|
||||
public void onPreSetup(MotionLayout motionLayout, HashMap<View, MotionController> controllerMap) {
|
||||
}
|
||||
|
||||
public void onTransitionChange(MotionLayout motionLayout, int startId, int endId, float progress) {
|
||||
}
|
||||
|
||||
public void onTransitionCompleted(MotionLayout motionLayout, int currentId) {
|
||||
}
|
||||
|
||||
@Override // androidx.constraintlayout.motion.widget.MotionLayout.TransitionListener
|
||||
public void onTransitionStarted(MotionLayout motionLayout, int startId, int endId) {
|
||||
}
|
||||
|
||||
@Override // androidx.constraintlayout.motion.widget.MotionLayout.TransitionListener
|
||||
public void onTransitionTrigger(MotionLayout motionLayout, int triggerId, boolean positive, float progress) {
|
||||
}
|
||||
|
||||
public void setProgress(View view, float progress) {
|
||||
}
|
||||
|
||||
public MotionHelper(Context context) {
|
||||
super(context);
|
||||
this.mUseOnShow = false;
|
||||
this.mUseOnHide = false;
|
||||
}
|
||||
|
||||
public MotionHelper(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
this.mUseOnShow = false;
|
||||
this.mUseOnHide = false;
|
||||
init(attrs);
|
||||
}
|
||||
|
||||
public MotionHelper(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
this.mUseOnShow = false;
|
||||
this.mUseOnHide = false;
|
||||
init(attrs);
|
||||
}
|
||||
|
||||
@Override // androidx.constraintlayout.widget.ConstraintHelper
|
||||
protected void init(AttributeSet attrs) {
|
||||
super.init(attrs);
|
||||
if (attrs != null) {
|
||||
TypedArray obtainStyledAttributes = getContext().obtainStyledAttributes(attrs, R.styleable.MotionHelper);
|
||||
int indexCount = obtainStyledAttributes.getIndexCount();
|
||||
for (int i = 0; i < indexCount; i++) {
|
||||
int index = obtainStyledAttributes.getIndex(i);
|
||||
if (index == R.styleable.MotionHelper_onShow) {
|
||||
this.mUseOnShow = obtainStyledAttributes.getBoolean(index, this.mUseOnShow);
|
||||
} else if (index == R.styleable.MotionHelper_onHide) {
|
||||
this.mUseOnHide = obtainStyledAttributes.getBoolean(index, this.mUseOnHide);
|
||||
}
|
||||
}
|
||||
obtainStyledAttributes.recycle();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.constraintlayout.motion.widget.Animatable
|
||||
public void setProgress(float progress) {
|
||||
this.mProgress = progress;
|
||||
int i = 0;
|
||||
if (this.mCount > 0) {
|
||||
this.views = getViews((ConstraintLayout) getParent());
|
||||
while (i < this.mCount) {
|
||||
setProgress(this.views[i], progress);
|
||||
i++;
|
||||
}
|
||||
return;
|
||||
}
|
||||
ViewGroup viewGroup = (ViewGroup) getParent();
|
||||
int childCount = viewGroup.getChildCount();
|
||||
while (i < childCount) {
|
||||
View childAt = viewGroup.getChildAt(i);
|
||||
if (!(childAt instanceof MotionHelper)) {
|
||||
setProgress(childAt, progress);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package androidx.constraintlayout.motion.widget;
|
||||
|
||||
import android.graphics.Canvas;
|
||||
import android.view.View;
|
||||
import androidx.constraintlayout.motion.widget.MotionLayout;
|
||||
import java.util.HashMap;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface MotionHelperInterface extends Animatable, MotionLayout.TransitionListener {
|
||||
boolean isDecorator();
|
||||
|
||||
boolean isUseOnHide();
|
||||
|
||||
boolean isUsedOnShow();
|
||||
|
||||
void onFinishedMotionScene(MotionLayout motionLayout);
|
||||
|
||||
void onPostDraw(Canvas canvas);
|
||||
|
||||
void onPreDraw(Canvas canvas);
|
||||
|
||||
void onPreSetup(MotionLayout motionLayout, HashMap<View, MotionController> controllerMap);
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package androidx.constraintlayout.motion.widget;
|
||||
|
||||
import android.view.animation.Interpolator;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class MotionInterpolator implements Interpolator {
|
||||
@Override // android.animation.TimeInterpolator
|
||||
public abstract float getInterpolation(float v);
|
||||
|
||||
public abstract float getVelocity();
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,693 @@
|
||||
package androidx.constraintlayout.motion.widget;
|
||||
|
||||
import android.view.View;
|
||||
import androidx.constraintlayout.core.motion.utils.Easing;
|
||||
import androidx.constraintlayout.core.widgets.analyzer.BasicMeasure;
|
||||
import androidx.constraintlayout.widget.ConstraintAttribute;
|
||||
import androidx.constraintlayout.widget.ConstraintSet;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class MotionPaths implements Comparable<MotionPaths> {
|
||||
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;
|
||||
static final int PERPENDICULAR = 1;
|
||||
static final int SCREEN = 2;
|
||||
public static final String TAG = "MotionPaths";
|
||||
static String[] names = {"position", "x", "y", "width", "height", "pathRotate"};
|
||||
LinkedHashMap<String, ConstraintAttribute> attributes;
|
||||
float height;
|
||||
int mAnimateCircleAngleTo;
|
||||
int mAnimateRelativeTo;
|
||||
int mDrawPath;
|
||||
Easing mKeyFrameEasing;
|
||||
int mMode;
|
||||
int mPathMotionArc;
|
||||
float mPathRotate;
|
||||
float mProgress;
|
||||
float mRelativeAngle;
|
||||
MotionController mRelativeToController;
|
||||
double[] mTempDelta;
|
||||
double[] mTempValue;
|
||||
float position;
|
||||
float time;
|
||||
float width;
|
||||
float x;
|
||||
float y;
|
||||
|
||||
private static final float xRotate(float sin, float cos, float cx, float cy, float x, float y) {
|
||||
return (((x - cx) * cos) - ((y - cy) * sin)) + cx;
|
||||
}
|
||||
|
||||
private static final float yRotate(float sin, float cos, float cx, float cy, float x, float y) {
|
||||
return ((x - cx) * sin) + ((y - cy) * cos) + cy;
|
||||
}
|
||||
|
||||
void setBounds(float x, float y, float w, float h) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.width = w;
|
||||
this.height = h;
|
||||
}
|
||||
|
||||
public MotionPaths() {
|
||||
this.mDrawPath = 0;
|
||||
this.mPathRotate = Float.NaN;
|
||||
this.mProgress = Float.NaN;
|
||||
this.mPathMotionArc = Key.UNSET;
|
||||
this.mAnimateRelativeTo = Key.UNSET;
|
||||
this.mRelativeAngle = Float.NaN;
|
||||
this.mRelativeToController = null;
|
||||
this.attributes = new LinkedHashMap<>();
|
||||
this.mMode = 0;
|
||||
this.mTempValue = new double[18];
|
||||
this.mTempDelta = new double[18];
|
||||
}
|
||||
|
||||
void initCartesian(KeyPosition c, MotionPaths startTimePoint, MotionPaths endTimePoint) {
|
||||
float f = c.mFramePosition / 100.0f;
|
||||
this.time = f;
|
||||
this.mDrawPath = c.mDrawPath;
|
||||
float f2 = Float.isNaN(c.mPercentWidth) ? f : c.mPercentWidth;
|
||||
float f3 = Float.isNaN(c.mPercentHeight) ? f : c.mPercentHeight;
|
||||
float f4 = endTimePoint.width;
|
||||
float f5 = startTimePoint.width;
|
||||
float f6 = endTimePoint.height;
|
||||
float f7 = startTimePoint.height;
|
||||
this.position = this.time;
|
||||
float f8 = startTimePoint.x;
|
||||
float f9 = startTimePoint.y;
|
||||
float f10 = (endTimePoint.x + (f4 / 2.0f)) - ((f5 / 2.0f) + f8);
|
||||
float f11 = (endTimePoint.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(c.mPercentX) ? f : c.mPercentX;
|
||||
float f15 = Float.isNaN(c.mAltPercentY) ? 0.0f : c.mAltPercentY;
|
||||
if (!Float.isNaN(c.mPercentY)) {
|
||||
f = c.mPercentY;
|
||||
}
|
||||
float f16 = Float.isNaN(c.mAltPercentX) ? 0.0f : c.mAltPercentX;
|
||||
this.mMode = 0;
|
||||
this.x = (int) (((startTimePoint.x + (f14 * f10)) + (f16 * f11)) - f12);
|
||||
this.y = (int) (((startTimePoint.y + (f10 * f15)) + (f11 * f)) - f13);
|
||||
this.mKeyFrameEasing = Easing.getInterpolator(c.mTransitionEasing);
|
||||
this.mPathMotionArc = c.mPathMotionArc;
|
||||
}
|
||||
|
||||
public MotionPaths(int parentWidth, int parentHeight, KeyPosition c, MotionPaths startTimePoint, MotionPaths endTimePoint) {
|
||||
this.mDrawPath = 0;
|
||||
this.mPathRotate = Float.NaN;
|
||||
this.mProgress = Float.NaN;
|
||||
this.mPathMotionArc = Key.UNSET;
|
||||
this.mAnimateRelativeTo = Key.UNSET;
|
||||
this.mRelativeAngle = Float.NaN;
|
||||
this.mRelativeToController = null;
|
||||
this.attributes = new LinkedHashMap<>();
|
||||
this.mMode = 0;
|
||||
this.mTempValue = new double[18];
|
||||
this.mTempDelta = new double[18];
|
||||
if (startTimePoint.mAnimateRelativeTo != Key.UNSET) {
|
||||
initPolar(parentWidth, parentHeight, c, startTimePoint, endTimePoint);
|
||||
return;
|
||||
}
|
||||
int i = c.mPositionType;
|
||||
if (i == 1) {
|
||||
initPath(c, startTimePoint, endTimePoint);
|
||||
} else if (i == 2) {
|
||||
initScreen(parentWidth, parentHeight, c, startTimePoint, endTimePoint);
|
||||
} else {
|
||||
initCartesian(c, startTimePoint, endTimePoint);
|
||||
}
|
||||
}
|
||||
|
||||
void initPolar(int parentWidth, int parentHeight, KeyPosition c, MotionPaths s, MotionPaths e) {
|
||||
float min;
|
||||
float f;
|
||||
float f2 = c.mFramePosition / 100.0f;
|
||||
this.time = f2;
|
||||
this.mDrawPath = c.mDrawPath;
|
||||
this.mMode = c.mPositionType;
|
||||
float f3 = Float.isNaN(c.mPercentWidth) ? f2 : c.mPercentWidth;
|
||||
float f4 = Float.isNaN(c.mPercentHeight) ? f2 : c.mPercentHeight;
|
||||
float f5 = e.width;
|
||||
float f6 = s.width;
|
||||
float f7 = e.height;
|
||||
float f8 = s.height;
|
||||
this.position = this.time;
|
||||
this.width = (int) (f6 + ((f5 - f6) * f3));
|
||||
this.height = (int) (f8 + ((f7 - f8) * f4));
|
||||
int i = c.mPositionType;
|
||||
if (i == 1) {
|
||||
float f9 = Float.isNaN(c.mPercentX) ? f2 : c.mPercentX;
|
||||
float f10 = e.x;
|
||||
float f11 = s.x;
|
||||
this.x = (f9 * (f10 - f11)) + f11;
|
||||
if (!Float.isNaN(c.mPercentY)) {
|
||||
f2 = c.mPercentY;
|
||||
}
|
||||
float f12 = e.y;
|
||||
float f13 = s.y;
|
||||
this.y = (f2 * (f12 - f13)) + f13;
|
||||
} else if (i == 2) {
|
||||
if (Float.isNaN(c.mPercentX)) {
|
||||
float f14 = e.x;
|
||||
float f15 = s.x;
|
||||
min = ((f14 - f15) * f2) + f15;
|
||||
} else {
|
||||
min = Math.min(f4, f3) * c.mPercentX;
|
||||
}
|
||||
this.x = min;
|
||||
if (Float.isNaN(c.mPercentY)) {
|
||||
float f16 = e.y;
|
||||
float f17 = s.y;
|
||||
f = (f2 * (f16 - f17)) + f17;
|
||||
} else {
|
||||
f = c.mPercentY;
|
||||
}
|
||||
this.y = f;
|
||||
} else {
|
||||
float f18 = Float.isNaN(c.mPercentX) ? f2 : c.mPercentX;
|
||||
float f19 = e.x;
|
||||
float f20 = s.x;
|
||||
this.x = (f18 * (f19 - f20)) + f20;
|
||||
if (!Float.isNaN(c.mPercentY)) {
|
||||
f2 = c.mPercentY;
|
||||
}
|
||||
float f21 = e.y;
|
||||
float f22 = s.y;
|
||||
this.y = (f2 * (f21 - f22)) + f22;
|
||||
}
|
||||
this.mAnimateRelativeTo = s.mAnimateRelativeTo;
|
||||
this.mKeyFrameEasing = Easing.getInterpolator(c.mTransitionEasing);
|
||||
this.mPathMotionArc = c.mPathMotionArc;
|
||||
}
|
||||
|
||||
public void setupRelative(MotionController mc, MotionPaths relative) {
|
||||
double d = ((this.x + (this.width / 2.0f)) - relative.x) - (relative.width / 2.0f);
|
||||
double d2 = ((this.y + (this.height / 2.0f)) - relative.y) - (relative.height / 2.0f);
|
||||
this.mRelativeToController = mc;
|
||||
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 parentWidth, int parentHeight, KeyPosition c, MotionPaths startTimePoint, MotionPaths endTimePoint) {
|
||||
float f = c.mFramePosition / 100.0f;
|
||||
this.time = f;
|
||||
this.mDrawPath = c.mDrawPath;
|
||||
float f2 = Float.isNaN(c.mPercentWidth) ? f : c.mPercentWidth;
|
||||
float f3 = Float.isNaN(c.mPercentHeight) ? f : c.mPercentHeight;
|
||||
float f4 = endTimePoint.width;
|
||||
float f5 = startTimePoint.width;
|
||||
float f6 = endTimePoint.height;
|
||||
float f7 = startTimePoint.height;
|
||||
this.position = this.time;
|
||||
float f8 = startTimePoint.x;
|
||||
float f9 = startTimePoint.y;
|
||||
float f10 = endTimePoint.x + (f4 / 2.0f);
|
||||
float f11 = endTimePoint.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(c.mPercentX)) {
|
||||
this.x = (int) (c.mPercentX * ((int) (parentWidth - this.width)));
|
||||
}
|
||||
if (!Float.isNaN(c.mPercentY)) {
|
||||
this.y = (int) (c.mPercentY * ((int) (parentHeight - this.height)));
|
||||
}
|
||||
this.mAnimateRelativeTo = this.mAnimateRelativeTo;
|
||||
this.mKeyFrameEasing = Easing.getInterpolator(c.mTransitionEasing);
|
||||
this.mPathMotionArc = c.mPathMotionArc;
|
||||
}
|
||||
|
||||
void initPath(KeyPosition c, MotionPaths startTimePoint, MotionPaths endTimePoint) {
|
||||
float f = c.mFramePosition / 100.0f;
|
||||
this.time = f;
|
||||
this.mDrawPath = c.mDrawPath;
|
||||
float f2 = Float.isNaN(c.mPercentWidth) ? f : c.mPercentWidth;
|
||||
float f3 = Float.isNaN(c.mPercentHeight) ? f : c.mPercentHeight;
|
||||
float f4 = endTimePoint.width - startTimePoint.width;
|
||||
float f5 = endTimePoint.height - startTimePoint.height;
|
||||
this.position = this.time;
|
||||
if (!Float.isNaN(c.mPercentX)) {
|
||||
f = c.mPercentX;
|
||||
}
|
||||
float f6 = startTimePoint.x;
|
||||
float f7 = startTimePoint.width;
|
||||
float f8 = startTimePoint.y;
|
||||
float f9 = startTimePoint.height;
|
||||
float f10 = (endTimePoint.x + (endTimePoint.width / 2.0f)) - ((f7 / 2.0f) + f6);
|
||||
float f11 = (endTimePoint.y + (endTimePoint.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(c.mPercentY) ? 0.0f : c.mPercentY;
|
||||
this.mMode = 1;
|
||||
float f17 = (int) ((startTimePoint.x + f12) - f13);
|
||||
this.x = f17;
|
||||
float f18 = (int) ((startTimePoint.y + f14) - f15);
|
||||
this.x = f17 + ((-f11) * f16);
|
||||
this.y = f18 + (f10 * f16);
|
||||
this.mAnimateRelativeTo = this.mAnimateRelativeTo;
|
||||
this.mKeyFrameEasing = Easing.getInterpolator(c.mTransitionEasing);
|
||||
this.mPathMotionArc = c.mPathMotionArc;
|
||||
}
|
||||
|
||||
private boolean diff(float a, float b) {
|
||||
return (Float.isNaN(a) || Float.isNaN(b)) ? Float.isNaN(a) != Float.isNaN(b) : Math.abs(a - b) > 1.0E-6f;
|
||||
}
|
||||
|
||||
void different(MotionPaths points, boolean[] mask, String[] custom, boolean arcMode) {
|
||||
boolean diff = diff(this.x, points.x);
|
||||
boolean diff2 = diff(this.y, points.y);
|
||||
mask[0] = mask[0] | diff(this.position, points.position);
|
||||
boolean z = diff | diff2 | arcMode;
|
||||
mask[1] = mask[1] | z;
|
||||
mask[2] = z | mask[2];
|
||||
mask[3] = mask[3] | diff(this.width, points.width);
|
||||
mask[4] = diff(this.height, points.height) | mask[4];
|
||||
}
|
||||
|
||||
void getCenter(double p, int[] toUse, double[] data, float[] point, int offset) {
|
||||
float f = this.x;
|
||||
float f2 = this.y;
|
||||
float f3 = this.width;
|
||||
float f4 = this.height;
|
||||
for (int i = 0; i < toUse.length; i++) {
|
||||
float f5 = (float) data[i];
|
||||
int i2 = toUse[i];
|
||||
if (i2 == 1) {
|
||||
f = f5;
|
||||
} else if (i2 == 2) {
|
||||
f2 = f5;
|
||||
} else if (i2 == 3) {
|
||||
f3 = f5;
|
||||
} else if (i2 == 4) {
|
||||
f4 = f5;
|
||||
}
|
||||
}
|
||||
MotionController motionController = this.mRelativeToController;
|
||||
if (motionController != null) {
|
||||
float[] fArr = new float[2];
|
||||
motionController.getCenter(p, fArr, new float[2]);
|
||||
float f6 = fArr[0];
|
||||
float f7 = fArr[1];
|
||||
double d = f6;
|
||||
double d2 = f;
|
||||
double d3 = f2;
|
||||
f = (float) ((d + (Math.sin(d3) * d2)) - (f3 / 2.0f));
|
||||
f2 = (float) ((f7 - (d2 * Math.cos(d3))) - (f4 / 2.0f));
|
||||
}
|
||||
point[offset] = f + (f3 / 2.0f) + 0.0f;
|
||||
point[offset + 1] = f2 + (f4 / 2.0f) + 0.0f;
|
||||
}
|
||||
|
||||
void getCenter(double p, int[] toUse, double[] data, float[] point, double[] vdata, float[] velocity) {
|
||||
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 < toUse.length; i++) {
|
||||
float f10 = (float) data[i];
|
||||
float f11 = (float) vdata[i];
|
||||
int i2 = toUse[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;
|
||||
MotionController motionController = this.mRelativeToController;
|
||||
if (motionController != null) {
|
||||
float[] fArr = new float[2];
|
||||
float[] fArr2 = new float[2];
|
||||
motionController.getCenter(p, fArr, fArr2);
|
||||
float f15 = fArr[0];
|
||||
float f16 = fArr[1];
|
||||
float f17 = fArr2[0];
|
||||
float f18 = fArr2[1];
|
||||
double d = f2;
|
||||
double d2 = f3;
|
||||
f = f4;
|
||||
float sin = (float) ((f15 + (Math.sin(d2) * d)) - (f4 / 2.0f));
|
||||
float cos = (float) ((f16 - (d * Math.cos(d2))) - (f5 / 2.0f));
|
||||
double d3 = f6;
|
||||
double d4 = f8;
|
||||
float sin2 = (float) (f17 + (Math.sin(d2) * d3) + (Math.cos(d2) * d4));
|
||||
f14 = (float) ((f18 - (d3 * Math.cos(d2))) + (Math.sin(d2) * d4));
|
||||
f13 = sin2;
|
||||
f2 = sin;
|
||||
f3 = cos;
|
||||
f12 = 2.0f;
|
||||
} else {
|
||||
f = f4;
|
||||
}
|
||||
point[0] = f2 + (f / f12) + 0.0f;
|
||||
point[1] = f3 + (f5 / f12) + 0.0f;
|
||||
velocity[0] = f13;
|
||||
velocity[1] = f14;
|
||||
}
|
||||
|
||||
void getCenterVelocity(double p, int[] toUse, double[] data, float[] point, int offset) {
|
||||
float f = this.x;
|
||||
float f2 = this.y;
|
||||
float f3 = this.width;
|
||||
float f4 = this.height;
|
||||
for (int i = 0; i < toUse.length; i++) {
|
||||
float f5 = (float) data[i];
|
||||
int i2 = toUse[i];
|
||||
if (i2 == 1) {
|
||||
f = f5;
|
||||
} else if (i2 == 2) {
|
||||
f2 = f5;
|
||||
} else if (i2 == 3) {
|
||||
f3 = f5;
|
||||
} else if (i2 == 4) {
|
||||
f4 = f5;
|
||||
}
|
||||
}
|
||||
MotionController motionController = this.mRelativeToController;
|
||||
if (motionController != null) {
|
||||
float[] fArr = new float[2];
|
||||
motionController.getCenter(p, fArr, new float[2]);
|
||||
float f6 = fArr[0];
|
||||
float f7 = fArr[1];
|
||||
double d = f6;
|
||||
double d2 = f;
|
||||
double d3 = f2;
|
||||
f = (float) ((d + (Math.sin(d3) * d2)) - (f3 / 2.0f));
|
||||
f2 = (float) ((f7 - (d2 * Math.cos(d3))) - (f4 / 2.0f));
|
||||
}
|
||||
point[offset] = f + (f3 / 2.0f) + 0.0f;
|
||||
point[offset + 1] = f2 + (f4 / 2.0f) + 0.0f;
|
||||
}
|
||||
|
||||
void getBounds(int[] toUse, double[] data, float[] point, int offset) {
|
||||
float f = this.width;
|
||||
float f2 = this.height;
|
||||
for (int i = 0; i < toUse.length; i++) {
|
||||
float f3 = (float) data[i];
|
||||
int i2 = toUse[i];
|
||||
if (i2 == 3) {
|
||||
f = f3;
|
||||
} else if (i2 == 4) {
|
||||
f2 = f3;
|
||||
}
|
||||
}
|
||||
point[offset] = f;
|
||||
point[offset + 1] = f2;
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
void setView(float position, View view, int[] toUse, double[] data, double[] slope, double[] cycle, boolean mForceMeasure) {
|
||||
float f;
|
||||
float f2;
|
||||
float f3 = this.x;
|
||||
float f4 = this.y;
|
||||
float f5 = this.width;
|
||||
float f6 = this.height;
|
||||
if (toUse.length != 0 && this.mTempValue.length <= toUse[toUse.length - 1]) {
|
||||
int i = toUse[toUse.length - 1] + 1;
|
||||
this.mTempValue = new double[i];
|
||||
this.mTempDelta = new double[i];
|
||||
}
|
||||
Arrays.fill(this.mTempValue, Double.NaN);
|
||||
for (int i2 = 0; i2 < toUse.length; i2++) {
|
||||
double[] dArr = this.mTempValue;
|
||||
int i3 = toUse[i2];
|
||||
dArr[i3] = data[i2];
|
||||
this.mTempDelta[i3] = slope[i2];
|
||||
}
|
||||
float f7 = Float.NaN;
|
||||
int i4 = 0;
|
||||
float f8 = 0.0f;
|
||||
float f9 = 0.0f;
|
||||
float f10 = 0.0f;
|
||||
float f11 = 0.0f;
|
||||
while (true) {
|
||||
double[] dArr2 = this.mTempValue;
|
||||
if (i4 >= dArr2.length) {
|
||||
break;
|
||||
}
|
||||
if (Double.isNaN(dArr2[i4]) && (cycle == null || cycle[i4] == 0.0d)) {
|
||||
f2 = f7;
|
||||
} else {
|
||||
double d = cycle != null ? cycle[i4] : 0.0d;
|
||||
if (!Double.isNaN(this.mTempValue[i4])) {
|
||||
d = this.mTempValue[i4] + d;
|
||||
}
|
||||
f2 = f7;
|
||||
float f12 = (float) d;
|
||||
float f13 = (float) this.mTempDelta[i4];
|
||||
if (i4 == 1) {
|
||||
f7 = f2;
|
||||
f8 = f13;
|
||||
f3 = f12;
|
||||
} else if (i4 == 2) {
|
||||
f7 = f2;
|
||||
f9 = f13;
|
||||
f4 = f12;
|
||||
} else if (i4 == 3) {
|
||||
f7 = f2;
|
||||
f10 = f13;
|
||||
f5 = f12;
|
||||
} else if (i4 == 4) {
|
||||
f7 = f2;
|
||||
f11 = f13;
|
||||
f6 = f12;
|
||||
} else if (i4 == 5) {
|
||||
f7 = f12;
|
||||
}
|
||||
i4++;
|
||||
}
|
||||
f7 = f2;
|
||||
i4++;
|
||||
}
|
||||
float f14 = f7;
|
||||
MotionController motionController = this.mRelativeToController;
|
||||
if (motionController != null) {
|
||||
float[] fArr = new float[2];
|
||||
float[] fArr2 = new float[2];
|
||||
motionController.getCenter(position, fArr, fArr2);
|
||||
float f15 = fArr[0];
|
||||
float f16 = fArr[1];
|
||||
float f17 = fArr2[0];
|
||||
float f18 = fArr2[1];
|
||||
double d2 = f3;
|
||||
double d3 = f4;
|
||||
float sin = (float) ((f15 + (Math.sin(d3) * d2)) - (f5 / 2.0f));
|
||||
f = f6;
|
||||
float cos = (float) ((f16 - (Math.cos(d3) * d2)) - (f6 / 2.0f));
|
||||
double d4 = f8;
|
||||
double d5 = f9;
|
||||
float sin2 = (float) (f17 + (Math.sin(d3) * d4) + (Math.cos(d3) * d2 * d5));
|
||||
float cos2 = (float) ((f18 - (d4 * Math.cos(d3))) + (d2 * Math.sin(d3) * d5));
|
||||
if (slope.length >= 2) {
|
||||
slope[0] = sin2;
|
||||
slope[1] = cos2;
|
||||
}
|
||||
if (!Float.isNaN(f14)) {
|
||||
view.setRotation((float) (f14 + Math.toDegrees(Math.atan2(cos2, sin2))));
|
||||
}
|
||||
f3 = sin;
|
||||
f4 = cos;
|
||||
} else {
|
||||
f = f6;
|
||||
if (!Float.isNaN(f14)) {
|
||||
view.setRotation((float) (0.0f + f14 + Math.toDegrees(Math.atan2(f9 + (f11 / 2.0f), f8 + (f10 / 2.0f)))));
|
||||
}
|
||||
}
|
||||
if (view instanceof FloatLayout) {
|
||||
((FloatLayout) view).layout(f3, f4, f5 + f3, f4 + f);
|
||||
return;
|
||||
}
|
||||
float f19 = f3 + 0.5f;
|
||||
int i5 = (int) f19;
|
||||
float f20 = f4 + 0.5f;
|
||||
int i6 = (int) f20;
|
||||
int i7 = (int) (f19 + f5);
|
||||
int i8 = (int) (f20 + f);
|
||||
int i9 = i7 - i5;
|
||||
int i10 = i8 - i6;
|
||||
if (i9 != view.getMeasuredWidth() || i10 != view.getMeasuredHeight() || mForceMeasure) {
|
||||
view.measure(View.MeasureSpec.makeMeasureSpec(i9, BasicMeasure.EXACTLY), View.MeasureSpec.makeMeasureSpec(i10, BasicMeasure.EXACTLY));
|
||||
}
|
||||
view.layout(i5, i6, i7, i8);
|
||||
}
|
||||
|
||||
void getRect(int[] toUse, double[] data, float[] path, int offset) {
|
||||
float f = this.x;
|
||||
float f2 = this.y;
|
||||
float f3 = this.width;
|
||||
float f4 = this.height;
|
||||
for (int i = 0; i < toUse.length; i++) {
|
||||
float f5 = (float) data[i];
|
||||
int i2 = toUse[i];
|
||||
if (i2 == 1) {
|
||||
f = f5;
|
||||
} else if (i2 == 2) {
|
||||
f2 = f5;
|
||||
} else if (i2 == 3) {
|
||||
f3 = f5;
|
||||
} else if (i2 == 4) {
|
||||
f4 = f5;
|
||||
}
|
||||
}
|
||||
MotionController motionController = this.mRelativeToController;
|
||||
if (motionController != null) {
|
||||
float centerX = motionController.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);
|
||||
path[offset] = f + 0.0f;
|
||||
path[offset + 1] = f2 + 0.0f;
|
||||
path[offset + 2] = f6 + 0.0f;
|
||||
path[offset + 3] = f2 + 0.0f;
|
||||
path[offset + 4] = f6 + 0.0f;
|
||||
path[offset + 5] = f7 + 0.0f;
|
||||
path[offset + 6] = f + 0.0f;
|
||||
path[offset + 7] = f7 + 0.0f;
|
||||
}
|
||||
|
||||
void setDpDt(float locationX, float locationY, float[] mAnchorDpDt, int[] toUse, double[] deltaData, double[] data) {
|
||||
float f = 0.0f;
|
||||
float f2 = 0.0f;
|
||||
float f3 = 0.0f;
|
||||
float f4 = 0.0f;
|
||||
for (int i = 0; i < toUse.length; i++) {
|
||||
float f5 = (float) deltaData[i];
|
||||
double d = data[i];
|
||||
int i2 = toUse[i];
|
||||
if (i2 == 1) {
|
||||
f = f5;
|
||||
} else if (i2 == 2) {
|
||||
f3 = f5;
|
||||
} else if (i2 == 3) {
|
||||
f2 = f5;
|
||||
} else if (i2 == 4) {
|
||||
f4 = f5;
|
||||
}
|
||||
}
|
||||
float f6 = f - ((0.0f * f2) / 2.0f);
|
||||
float f7 = f3 - ((0.0f * f4) / 2.0f);
|
||||
mAnchorDpDt[0] = (f6 * (1.0f - locationX)) + (((f2 * 1.0f) + f6) * locationX) + 0.0f;
|
||||
mAnchorDpDt[1] = (f7 * (1.0f - locationY)) + (((f4 * 1.0f) + f7) * locationY) + 0.0f;
|
||||
}
|
||||
|
||||
void fillStandard(double[] data, int[] toUse) {
|
||||
float[] fArr = {this.position, this.x, this.y, this.width, this.height, this.mPathRotate};
|
||||
int i = 0;
|
||||
for (int i2 : toUse) {
|
||||
if (i2 < 6) {
|
||||
data[i] = fArr[r4];
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
boolean hasCustomData(String name) {
|
||||
return this.attributes.containsKey(name);
|
||||
}
|
||||
|
||||
int getCustomDataCount(String name) {
|
||||
ConstraintAttribute constraintAttribute = this.attributes.get(name);
|
||||
if (constraintAttribute == null) {
|
||||
return 0;
|
||||
}
|
||||
return constraintAttribute.numberOfInterpolatedValues();
|
||||
}
|
||||
|
||||
int getCustomData(String name, double[] value, int offset) {
|
||||
ConstraintAttribute constraintAttribute = this.attributes.get(name);
|
||||
int i = 0;
|
||||
if (constraintAttribute == null) {
|
||||
return 0;
|
||||
}
|
||||
if (constraintAttribute.numberOfInterpolatedValues() == 1) {
|
||||
value[offset] = constraintAttribute.getValueToInterpolate();
|
||||
return 1;
|
||||
}
|
||||
int numberOfInterpolatedValues = constraintAttribute.numberOfInterpolatedValues();
|
||||
constraintAttribute.getValuesToInterpolate(new float[numberOfInterpolatedValues]);
|
||||
while (i < numberOfInterpolatedValues) {
|
||||
value[offset] = r2[i];
|
||||
i++;
|
||||
offset++;
|
||||
}
|
||||
return numberOfInterpolatedValues;
|
||||
}
|
||||
|
||||
@Override // java.lang.Comparable
|
||||
public int compareTo(MotionPaths o) {
|
||||
return Float.compare(this.position, o.position);
|
||||
}
|
||||
|
||||
public void applyParameters(ConstraintSet.Constraint c) {
|
||||
this.mKeyFrameEasing = Easing.getInterpolator(c.motion.mTransitionEasing);
|
||||
this.mPathMotionArc = c.motion.mPathMotionArc;
|
||||
this.mAnimateRelativeTo = c.motion.mAnimateRelativeTo;
|
||||
this.mPathRotate = c.motion.mPathRotate;
|
||||
this.mDrawPath = c.motion.mDrawPath;
|
||||
this.mAnimateCircleAngleTo = c.motion.mAnimateCircleAngleTo;
|
||||
this.mProgress = c.propertySet.mProgress;
|
||||
this.mRelativeAngle = c.layout.circleAngle;
|
||||
for (String str : c.mCustomConstraints.keySet()) {
|
||||
ConstraintAttribute constraintAttribute = c.mCustomConstraints.get(str);
|
||||
if (constraintAttribute != null && constraintAttribute.isContinuous()) {
|
||||
this.attributes.put(str, constraintAttribute);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void configureRelativeTo(MotionController toOrbit) {
|
||||
toOrbit.getPos(this.mProgress);
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,225 @@
|
||||
package androidx.constraintlayout.motion.widget;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class OnSwipe {
|
||||
public static final int COMPLETE_MODE_CONTINUOUS_VELOCITY = 0;
|
||||
public static final int COMPLETE_MODE_SPRING = 1;
|
||||
public static final int DRAG_ANTICLOCKWISE = 7;
|
||||
public static final int DRAG_CLOCKWISE = 6;
|
||||
public static final int DRAG_DOWN = 1;
|
||||
public static final int DRAG_END = 5;
|
||||
public static final int DRAG_LEFT = 2;
|
||||
public static final int DRAG_RIGHT = 3;
|
||||
public static final int DRAG_START = 4;
|
||||
public static final int DRAG_UP = 0;
|
||||
public static final int FLAG_DISABLE_POST_SCROLL = 1;
|
||||
public static final int FLAG_DISABLE_SCROLL = 2;
|
||||
public static final int ON_UP_AUTOCOMPLETE = 0;
|
||||
public static final int ON_UP_AUTOCOMPLETE_TO_END = 2;
|
||||
public static final int ON_UP_AUTOCOMPLETE_TO_START = 1;
|
||||
public static final int ON_UP_DECELERATE = 4;
|
||||
public static final int ON_UP_DECELERATE_AND_COMPLETE = 5;
|
||||
public static final int ON_UP_NEVER_TO_END = 7;
|
||||
public static final int ON_UP_NEVER_TO_START = 6;
|
||||
public static final int ON_UP_STOP = 3;
|
||||
public static final int SIDE_BOTTOM = 3;
|
||||
public static final int SIDE_END = 6;
|
||||
public static final int SIDE_LEFT = 1;
|
||||
public static final int SIDE_MIDDLE = 4;
|
||||
public static final int SIDE_RIGHT = 2;
|
||||
public static final int SIDE_START = 5;
|
||||
public static final int SIDE_TOP = 0;
|
||||
public static final int SPRING_BOUNDARY_BOUNCEBOTH = 3;
|
||||
public static final int SPRING_BOUNDARY_BOUNCEEND = 2;
|
||||
public static final int SPRING_BOUNDARY_BOUNCESTART = 1;
|
||||
public static final int SPRING_BOUNDARY_OVERSHOOT = 0;
|
||||
private int mDragDirection = 0;
|
||||
private int mTouchAnchorSide = 0;
|
||||
private int mTouchAnchorId = -1;
|
||||
private int mTouchRegionId = -1;
|
||||
private int mLimitBoundsTo = -1;
|
||||
private int mOnTouchUp = 0;
|
||||
private int mRotationCenterId = -1;
|
||||
private float mMaxVelocity = 4.0f;
|
||||
private float mMaxAcceleration = 1.2f;
|
||||
private boolean mMoveWhenScrollAtTop = true;
|
||||
private float mDragScale = 1.0f;
|
||||
private int mFlags = 0;
|
||||
private float mDragThreshold = 10.0f;
|
||||
private float mSpringDamping = Float.NaN;
|
||||
private float mSpringMass = 1.0f;
|
||||
private float mSpringStiffness = Float.NaN;
|
||||
private float mSpringStopThreshold = Float.NaN;
|
||||
private int mSpringBoundary = 0;
|
||||
private int mAutoCompleteMode = 0;
|
||||
|
||||
public int getAutoCompleteMode() {
|
||||
return this.mAutoCompleteMode;
|
||||
}
|
||||
|
||||
public int getDragDirection() {
|
||||
return this.mDragDirection;
|
||||
}
|
||||
|
||||
public float getDragScale() {
|
||||
return this.mDragScale;
|
||||
}
|
||||
|
||||
public float getDragThreshold() {
|
||||
return this.mDragThreshold;
|
||||
}
|
||||
|
||||
public int getLimitBoundsTo() {
|
||||
return this.mLimitBoundsTo;
|
||||
}
|
||||
|
||||
public float getMaxAcceleration() {
|
||||
return this.mMaxAcceleration;
|
||||
}
|
||||
|
||||
public float getMaxVelocity() {
|
||||
return this.mMaxVelocity;
|
||||
}
|
||||
|
||||
public boolean getMoveWhenScrollAtTop() {
|
||||
return this.mMoveWhenScrollAtTop;
|
||||
}
|
||||
|
||||
public int getNestedScrollFlags() {
|
||||
return this.mFlags;
|
||||
}
|
||||
|
||||
public int getOnTouchUp() {
|
||||
return this.mOnTouchUp;
|
||||
}
|
||||
|
||||
public int getRotationCenterId() {
|
||||
return this.mRotationCenterId;
|
||||
}
|
||||
|
||||
public int getSpringBoundary() {
|
||||
return this.mSpringBoundary;
|
||||
}
|
||||
|
||||
public float getSpringDamping() {
|
||||
return this.mSpringDamping;
|
||||
}
|
||||
|
||||
public float getSpringMass() {
|
||||
return this.mSpringMass;
|
||||
}
|
||||
|
||||
public float getSpringStiffness() {
|
||||
return this.mSpringStiffness;
|
||||
}
|
||||
|
||||
public float getSpringStopThreshold() {
|
||||
return this.mSpringStopThreshold;
|
||||
}
|
||||
|
||||
public int getTouchAnchorId() {
|
||||
return this.mTouchAnchorId;
|
||||
}
|
||||
|
||||
public int getTouchAnchorSide() {
|
||||
return this.mTouchAnchorSide;
|
||||
}
|
||||
|
||||
public int getTouchRegionId() {
|
||||
return this.mTouchRegionId;
|
||||
}
|
||||
|
||||
public void setAutoCompleteMode(int autoCompleteMode) {
|
||||
this.mAutoCompleteMode = autoCompleteMode;
|
||||
}
|
||||
|
||||
public OnSwipe setDragDirection(int dragDirection) {
|
||||
this.mDragDirection = dragDirection;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OnSwipe setDragScale(int dragScale) {
|
||||
this.mDragScale = dragScale;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OnSwipe setDragThreshold(int dragThreshold) {
|
||||
this.mDragThreshold = dragThreshold;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OnSwipe setLimitBoundsTo(int id) {
|
||||
this.mLimitBoundsTo = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OnSwipe setMaxAcceleration(int maxAcceleration) {
|
||||
this.mMaxAcceleration = maxAcceleration;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OnSwipe setMaxVelocity(int maxVelocity) {
|
||||
this.mMaxVelocity = maxVelocity;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OnSwipe setMoveWhenScrollAtTop(boolean moveWhenScrollAtTop) {
|
||||
this.mMoveWhenScrollAtTop = moveWhenScrollAtTop;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OnSwipe setNestedScrollFlags(int flags) {
|
||||
this.mFlags = flags;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OnSwipe setOnTouchUp(int mode) {
|
||||
this.mOnTouchUp = mode;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OnSwipe setRotateCenter(int rotationCenterId) {
|
||||
this.mRotationCenterId = rotationCenterId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OnSwipe setSpringBoundary(int springBoundary) {
|
||||
this.mSpringBoundary = springBoundary;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OnSwipe setSpringDamping(float springDamping) {
|
||||
this.mSpringDamping = springDamping;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OnSwipe setSpringMass(float springMass) {
|
||||
this.mSpringMass = springMass;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OnSwipe setSpringStiffness(float springStiffness) {
|
||||
this.mSpringStiffness = springStiffness;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OnSwipe setSpringStopThreshold(float springStopThreshold) {
|
||||
this.mSpringStopThreshold = springStopThreshold;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OnSwipe setTouchAnchorId(int side) {
|
||||
this.mTouchAnchorId = side;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OnSwipe setTouchAnchorSide(int side) {
|
||||
this.mTouchAnchorSide = side;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OnSwipe setTouchRegionId(int side) {
|
||||
this.mTouchRegionId = side;
|
||||
return this;
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package androidx.constraintlayout.motion.widget;
|
||||
|
||||
/* compiled from: DesignTool.java */
|
||||
/* loaded from: classes.dex */
|
||||
interface ProxyInterface {
|
||||
int designAccess(int cmd, String type, Object viewObject, float[] in, int inLength, float[] out, int outLength);
|
||||
|
||||
float getKeyFramePosition(Object view, int type, float x, float y);
|
||||
|
||||
Object getKeyframeAtLocation(Object viewObject, float x, float y);
|
||||
|
||||
Boolean getPositionKeyframe(Object keyFrame, Object view, float x, float y, String[] attribute, float[] value);
|
||||
|
||||
long getTransitionTimeMs();
|
||||
|
||||
void setAttributes(int dpi, String constraintSetId, Object opaqueView, Object opaqueAttributes);
|
||||
|
||||
void setKeyFrame(Object view, int position, String name, Object value);
|
||||
|
||||
boolean setKeyFramePosition(Object view, int position, int type, float x, float y);
|
||||
|
||||
void setToolPosition(float position);
|
||||
}
|
@ -0,0 +1,619 @@
|
||||
package androidx.constraintlayout.motion.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.RectF;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.util.Xml;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import androidx.constraintlayout.motion.widget.MotionLayout;
|
||||
import androidx.constraintlayout.widget.R;
|
||||
import androidx.core.widget.NestedScrollView;
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class TouchResponse {
|
||||
public static final int COMPLETE_MODE_CONTINUOUS_VELOCITY = 0;
|
||||
public static final int COMPLETE_MODE_SPRING = 1;
|
||||
private static final boolean DEBUG = false;
|
||||
private static final float EPSILON = 1.0E-7f;
|
||||
static final int FLAG_DISABLE_POST_SCROLL = 1;
|
||||
static final int FLAG_DISABLE_SCROLL = 2;
|
||||
static final int FLAG_SUPPORT_SCROLL_UP = 4;
|
||||
private static final int SEC_TO_MILLISECONDS = 1000;
|
||||
private static final int SIDE_BOTTOM = 3;
|
||||
private static final int SIDE_END = 6;
|
||||
private static final int SIDE_LEFT = 1;
|
||||
private static final int SIDE_MIDDLE = 4;
|
||||
private static final int SIDE_RIGHT = 2;
|
||||
private static final int SIDE_START = 5;
|
||||
private static final int SIDE_TOP = 0;
|
||||
private static final String TAG = "TouchResponse";
|
||||
private static final int TOUCH_DOWN = 1;
|
||||
private static final int TOUCH_END = 5;
|
||||
private static final int TOUCH_LEFT = 2;
|
||||
private static final int TOUCH_RIGHT = 3;
|
||||
private static final int TOUCH_START = 4;
|
||||
private static final int TOUCH_UP = 0;
|
||||
private float[] mAnchorDpDt;
|
||||
private int mAutoCompleteMode;
|
||||
private float mDragScale;
|
||||
private boolean mDragStarted;
|
||||
private float mDragThreshold;
|
||||
private int mFlags;
|
||||
boolean mIsRotateMode;
|
||||
private float mLastTouchX;
|
||||
private float mLastTouchY;
|
||||
private int mLimitBoundsTo;
|
||||
private float mMaxAcceleration;
|
||||
private float mMaxVelocity;
|
||||
private final MotionLayout mMotionLayout;
|
||||
private boolean mMoveWhenScrollAtTop;
|
||||
private int mOnTouchUp;
|
||||
float mRotateCenterX;
|
||||
float mRotateCenterY;
|
||||
private int mRotationCenterId;
|
||||
private int mSpringBoundary;
|
||||
private float mSpringDamping;
|
||||
private float mSpringMass;
|
||||
private float mSpringStiffness;
|
||||
private float mSpringStopThreshold;
|
||||
private int[] mTempLoc;
|
||||
private int mTouchAnchorId;
|
||||
private int mTouchAnchorSide;
|
||||
private float mTouchAnchorX;
|
||||
private float mTouchAnchorY;
|
||||
private float mTouchDirectionX;
|
||||
private float mTouchDirectionY;
|
||||
private int mTouchRegionId;
|
||||
private int mTouchSide;
|
||||
private static final float[][] TOUCH_SIDES = {new float[]{0.5f, 0.0f}, new float[]{0.0f, 0.5f}, new float[]{1.0f, 0.5f}, new float[]{0.5f, 1.0f}, new float[]{0.5f, 0.5f}, new float[]{0.0f, 0.5f}, new float[]{1.0f, 0.5f}};
|
||||
private static final float[][] TOUCH_DIRECTION = {new float[]{0.0f, -1.0f}, new float[]{0.0f, 1.0f}, new float[]{-1.0f, 0.0f}, new float[]{1.0f, 0.0f}, new float[]{-1.0f, 0.0f}, new float[]{1.0f, 0.0f}};
|
||||
|
||||
float dot(float dx, float dy) {
|
||||
return (dx * this.mTouchDirectionX) + (dy * this.mTouchDirectionY);
|
||||
}
|
||||
|
||||
public int getAnchorId() {
|
||||
return this.mTouchAnchorId;
|
||||
}
|
||||
|
||||
public int getAutoCompleteMode() {
|
||||
return this.mAutoCompleteMode;
|
||||
}
|
||||
|
||||
public int getFlags() {
|
||||
return this.mFlags;
|
||||
}
|
||||
|
||||
int getLimitBoundsToId() {
|
||||
return this.mLimitBoundsTo;
|
||||
}
|
||||
|
||||
float getMaxAcceleration() {
|
||||
return this.mMaxAcceleration;
|
||||
}
|
||||
|
||||
public float getMaxVelocity() {
|
||||
return this.mMaxVelocity;
|
||||
}
|
||||
|
||||
boolean getMoveWhenScrollAtTop() {
|
||||
return this.mMoveWhenScrollAtTop;
|
||||
}
|
||||
|
||||
public int getSpringBoundary() {
|
||||
return this.mSpringBoundary;
|
||||
}
|
||||
|
||||
public float getSpringDamping() {
|
||||
return this.mSpringDamping;
|
||||
}
|
||||
|
||||
public float getSpringMass() {
|
||||
return this.mSpringMass;
|
||||
}
|
||||
|
||||
public float getSpringStiffness() {
|
||||
return this.mSpringStiffness;
|
||||
}
|
||||
|
||||
public float getSpringStopThreshold() {
|
||||
return this.mSpringStopThreshold;
|
||||
}
|
||||
|
||||
int getTouchRegionId() {
|
||||
return this.mTouchRegionId;
|
||||
}
|
||||
|
||||
boolean isDragStarted() {
|
||||
return this.mDragStarted;
|
||||
}
|
||||
|
||||
public void setAnchorId(int id) {
|
||||
this.mTouchAnchorId = id;
|
||||
}
|
||||
|
||||
void setAutoCompleteMode(int autoCompleteMode) {
|
||||
this.mAutoCompleteMode = autoCompleteMode;
|
||||
}
|
||||
|
||||
void setDown(float lastTouchX, float lastTouchY) {
|
||||
this.mLastTouchX = lastTouchX;
|
||||
this.mLastTouchY = lastTouchY;
|
||||
}
|
||||
|
||||
public void setMaxAcceleration(float acceleration) {
|
||||
this.mMaxAcceleration = acceleration;
|
||||
}
|
||||
|
||||
public void setMaxVelocity(float velocity) {
|
||||
this.mMaxVelocity = velocity;
|
||||
}
|
||||
|
||||
public void setTouchAnchorLocation(float x, float y) {
|
||||
this.mTouchAnchorX = x;
|
||||
this.mTouchAnchorY = y;
|
||||
}
|
||||
|
||||
public void setTouchUpMode(int touchUpMode) {
|
||||
this.mOnTouchUp = touchUpMode;
|
||||
}
|
||||
|
||||
void setUpTouchEvent(float lastTouchX, float lastTouchY) {
|
||||
this.mLastTouchX = lastTouchX;
|
||||
this.mLastTouchY = lastTouchY;
|
||||
this.mDragStarted = false;
|
||||
}
|
||||
|
||||
TouchResponse(Context context, MotionLayout layout, XmlPullParser parser) {
|
||||
this.mTouchAnchorSide = 0;
|
||||
this.mTouchSide = 0;
|
||||
this.mOnTouchUp = 0;
|
||||
this.mTouchAnchorId = -1;
|
||||
this.mTouchRegionId = -1;
|
||||
this.mLimitBoundsTo = -1;
|
||||
this.mTouchAnchorY = 0.5f;
|
||||
this.mTouchAnchorX = 0.5f;
|
||||
this.mRotateCenterX = 0.5f;
|
||||
this.mRotateCenterY = 0.5f;
|
||||
this.mRotationCenterId = -1;
|
||||
this.mIsRotateMode = false;
|
||||
this.mTouchDirectionX = 0.0f;
|
||||
this.mTouchDirectionY = 1.0f;
|
||||
this.mDragStarted = false;
|
||||
this.mAnchorDpDt = new float[2];
|
||||
this.mTempLoc = new int[2];
|
||||
this.mMaxVelocity = 4.0f;
|
||||
this.mMaxAcceleration = 1.2f;
|
||||
this.mMoveWhenScrollAtTop = true;
|
||||
this.mDragScale = 1.0f;
|
||||
this.mFlags = 0;
|
||||
this.mDragThreshold = 10.0f;
|
||||
this.mSpringDamping = 10.0f;
|
||||
this.mSpringMass = 1.0f;
|
||||
this.mSpringStiffness = Float.NaN;
|
||||
this.mSpringStopThreshold = Float.NaN;
|
||||
this.mSpringBoundary = 0;
|
||||
this.mAutoCompleteMode = 0;
|
||||
this.mMotionLayout = layout;
|
||||
fillFromAttributeList(context, Xml.asAttributeSet(parser));
|
||||
}
|
||||
|
||||
public TouchResponse(MotionLayout layout, OnSwipe onSwipe) {
|
||||
this.mTouchAnchorSide = 0;
|
||||
this.mTouchSide = 0;
|
||||
this.mOnTouchUp = 0;
|
||||
this.mTouchAnchorId = -1;
|
||||
this.mTouchRegionId = -1;
|
||||
this.mLimitBoundsTo = -1;
|
||||
this.mTouchAnchorY = 0.5f;
|
||||
this.mTouchAnchorX = 0.5f;
|
||||
this.mRotateCenterX = 0.5f;
|
||||
this.mRotateCenterY = 0.5f;
|
||||
this.mRotationCenterId = -1;
|
||||
this.mIsRotateMode = false;
|
||||
this.mTouchDirectionX = 0.0f;
|
||||
this.mTouchDirectionY = 1.0f;
|
||||
this.mDragStarted = false;
|
||||
this.mAnchorDpDt = new float[2];
|
||||
this.mTempLoc = new int[2];
|
||||
this.mMaxVelocity = 4.0f;
|
||||
this.mMaxAcceleration = 1.2f;
|
||||
this.mMoveWhenScrollAtTop = true;
|
||||
this.mDragScale = 1.0f;
|
||||
this.mFlags = 0;
|
||||
this.mDragThreshold = 10.0f;
|
||||
this.mSpringDamping = 10.0f;
|
||||
this.mSpringMass = 1.0f;
|
||||
this.mSpringStiffness = Float.NaN;
|
||||
this.mSpringStopThreshold = Float.NaN;
|
||||
this.mSpringBoundary = 0;
|
||||
this.mAutoCompleteMode = 0;
|
||||
this.mMotionLayout = layout;
|
||||
this.mTouchAnchorId = onSwipe.getTouchAnchorId();
|
||||
int touchAnchorSide = onSwipe.getTouchAnchorSide();
|
||||
this.mTouchAnchorSide = touchAnchorSide;
|
||||
if (touchAnchorSide != -1) {
|
||||
float[] fArr = TOUCH_SIDES[touchAnchorSide];
|
||||
this.mTouchAnchorX = fArr[0];
|
||||
this.mTouchAnchorY = fArr[1];
|
||||
}
|
||||
int dragDirection = onSwipe.getDragDirection();
|
||||
this.mTouchSide = dragDirection;
|
||||
float[][] fArr2 = TOUCH_DIRECTION;
|
||||
if (dragDirection < fArr2.length) {
|
||||
float[] fArr3 = fArr2[dragDirection];
|
||||
this.mTouchDirectionX = fArr3[0];
|
||||
this.mTouchDirectionY = fArr3[1];
|
||||
} else {
|
||||
this.mTouchDirectionY = Float.NaN;
|
||||
this.mTouchDirectionX = Float.NaN;
|
||||
this.mIsRotateMode = true;
|
||||
}
|
||||
this.mMaxVelocity = onSwipe.getMaxVelocity();
|
||||
this.mMaxAcceleration = onSwipe.getMaxAcceleration();
|
||||
this.mMoveWhenScrollAtTop = onSwipe.getMoveWhenScrollAtTop();
|
||||
this.mDragScale = onSwipe.getDragScale();
|
||||
this.mDragThreshold = onSwipe.getDragThreshold();
|
||||
this.mTouchRegionId = onSwipe.getTouchRegionId();
|
||||
this.mOnTouchUp = onSwipe.getOnTouchUp();
|
||||
this.mFlags = onSwipe.getNestedScrollFlags();
|
||||
this.mLimitBoundsTo = onSwipe.getLimitBoundsTo();
|
||||
this.mRotationCenterId = onSwipe.getRotationCenterId();
|
||||
this.mSpringBoundary = onSwipe.getSpringBoundary();
|
||||
this.mSpringDamping = onSwipe.getSpringDamping();
|
||||
this.mSpringMass = onSwipe.getSpringMass();
|
||||
this.mSpringStiffness = onSwipe.getSpringStiffness();
|
||||
this.mSpringStopThreshold = onSwipe.getSpringStopThreshold();
|
||||
this.mAutoCompleteMode = onSwipe.getAutoCompleteMode();
|
||||
}
|
||||
|
||||
public void setRTL(boolean rtl) {
|
||||
if (rtl) {
|
||||
float[][] fArr = TOUCH_DIRECTION;
|
||||
fArr[4] = fArr[3];
|
||||
fArr[5] = fArr[2];
|
||||
float[][] fArr2 = TOUCH_SIDES;
|
||||
fArr2[5] = fArr2[2];
|
||||
fArr2[6] = fArr2[1];
|
||||
} else {
|
||||
float[][] fArr3 = TOUCH_DIRECTION;
|
||||
fArr3[4] = fArr3[2];
|
||||
fArr3[5] = fArr3[3];
|
||||
float[][] fArr4 = TOUCH_SIDES;
|
||||
fArr4[5] = fArr4[1];
|
||||
fArr4[6] = fArr4[2];
|
||||
}
|
||||
float[] fArr5 = TOUCH_SIDES[this.mTouchAnchorSide];
|
||||
this.mTouchAnchorX = fArr5[0];
|
||||
this.mTouchAnchorY = fArr5[1];
|
||||
int i = this.mTouchSide;
|
||||
float[][] fArr6 = TOUCH_DIRECTION;
|
||||
if (i >= fArr6.length) {
|
||||
return;
|
||||
}
|
||||
float[] fArr7 = fArr6[i];
|
||||
this.mTouchDirectionX = fArr7[0];
|
||||
this.mTouchDirectionY = fArr7[1];
|
||||
}
|
||||
|
||||
private void fillFromAttributeList(Context context, AttributeSet attrs) {
|
||||
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attrs, R.styleable.OnSwipe);
|
||||
fill(obtainStyledAttributes);
|
||||
obtainStyledAttributes.recycle();
|
||||
}
|
||||
|
||||
private void fill(TypedArray a) {
|
||||
int indexCount = a.getIndexCount();
|
||||
for (int i = 0; i < indexCount; i++) {
|
||||
int index = a.getIndex(i);
|
||||
if (index == R.styleable.OnSwipe_touchAnchorId) {
|
||||
this.mTouchAnchorId = a.getResourceId(index, this.mTouchAnchorId);
|
||||
} else if (index == R.styleable.OnSwipe_touchAnchorSide) {
|
||||
int i2 = a.getInt(index, this.mTouchAnchorSide);
|
||||
this.mTouchAnchorSide = i2;
|
||||
float[] fArr = TOUCH_SIDES[i2];
|
||||
this.mTouchAnchorX = fArr[0];
|
||||
this.mTouchAnchorY = fArr[1];
|
||||
} else if (index == R.styleable.OnSwipe_dragDirection) {
|
||||
int i3 = a.getInt(index, this.mTouchSide);
|
||||
this.mTouchSide = i3;
|
||||
float[][] fArr2 = TOUCH_DIRECTION;
|
||||
if (i3 < fArr2.length) {
|
||||
float[] fArr3 = fArr2[i3];
|
||||
this.mTouchDirectionX = fArr3[0];
|
||||
this.mTouchDirectionY = fArr3[1];
|
||||
} else {
|
||||
this.mTouchDirectionY = Float.NaN;
|
||||
this.mTouchDirectionX = Float.NaN;
|
||||
this.mIsRotateMode = true;
|
||||
}
|
||||
} else if (index == R.styleable.OnSwipe_maxVelocity) {
|
||||
this.mMaxVelocity = a.getFloat(index, this.mMaxVelocity);
|
||||
} else if (index == R.styleable.OnSwipe_maxAcceleration) {
|
||||
this.mMaxAcceleration = a.getFloat(index, this.mMaxAcceleration);
|
||||
} else if (index == R.styleable.OnSwipe_moveWhenScrollAtTop) {
|
||||
this.mMoveWhenScrollAtTop = a.getBoolean(index, this.mMoveWhenScrollAtTop);
|
||||
} else if (index == R.styleable.OnSwipe_dragScale) {
|
||||
this.mDragScale = a.getFloat(index, this.mDragScale);
|
||||
} else if (index == R.styleable.OnSwipe_dragThreshold) {
|
||||
this.mDragThreshold = a.getFloat(index, this.mDragThreshold);
|
||||
} else if (index == R.styleable.OnSwipe_touchRegionId) {
|
||||
this.mTouchRegionId = a.getResourceId(index, this.mTouchRegionId);
|
||||
} else if (index == R.styleable.OnSwipe_onTouchUp) {
|
||||
this.mOnTouchUp = a.getInt(index, this.mOnTouchUp);
|
||||
} else if (index == R.styleable.OnSwipe_nestedScrollFlags) {
|
||||
this.mFlags = a.getInteger(index, 0);
|
||||
} else if (index == R.styleable.OnSwipe_limitBoundsTo) {
|
||||
this.mLimitBoundsTo = a.getResourceId(index, 0);
|
||||
} else if (index == R.styleable.OnSwipe_rotationCenterId) {
|
||||
this.mRotationCenterId = a.getResourceId(index, this.mRotationCenterId);
|
||||
} else if (index == R.styleable.OnSwipe_springDamping) {
|
||||
this.mSpringDamping = a.getFloat(index, this.mSpringDamping);
|
||||
} else if (index == R.styleable.OnSwipe_springMass) {
|
||||
this.mSpringMass = a.getFloat(index, this.mSpringMass);
|
||||
} else if (index == R.styleable.OnSwipe_springStiffness) {
|
||||
this.mSpringStiffness = a.getFloat(index, this.mSpringStiffness);
|
||||
} else if (index == R.styleable.OnSwipe_springStopThreshold) {
|
||||
this.mSpringStopThreshold = a.getFloat(index, this.mSpringStopThreshold);
|
||||
} else if (index == R.styleable.OnSwipe_springBoundary) {
|
||||
this.mSpringBoundary = a.getInt(index, this.mSpringBoundary);
|
||||
} else if (index == R.styleable.OnSwipe_autoCompleteMode) {
|
||||
this.mAutoCompleteMode = a.getInt(index, this.mAutoCompleteMode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX WARN: Removed duplicated region for block: B:56:0x0273 */
|
||||
/* JADX WARN: Removed duplicated region for block: B:59:0x02b5 */
|
||||
/* JADX WARN: Removed duplicated region for block: B:96:0x02c2 */
|
||||
/* JADX WARN: Removed duplicated region for block: B:97:0x0297 */
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct add '--show-bad-code' argument
|
||||
*/
|
||||
void processTouchRotateEvent(android.view.MotionEvent r24, androidx.constraintlayout.motion.widget.MotionLayout.MotionTracker r25, int r26, androidx.constraintlayout.motion.widget.MotionScene r27) {
|
||||
/*
|
||||
Method dump skipped, instructions count: 840
|
||||
To view this dump add '--comments-level debug' option
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: androidx.constraintlayout.motion.widget.TouchResponse.processTouchRotateEvent(android.view.MotionEvent, androidx.constraintlayout.motion.widget.MotionLayout$MotionTracker, int, androidx.constraintlayout.motion.widget.MotionScene):void");
|
||||
}
|
||||
|
||||
void processTouchEvent(MotionEvent event, MotionLayout.MotionTracker velocityTracker, int currentState, MotionScene motionScene) {
|
||||
int i;
|
||||
float f;
|
||||
if (this.mIsRotateMode) {
|
||||
processTouchRotateEvent(event, velocityTracker, currentState, motionScene);
|
||||
return;
|
||||
}
|
||||
velocityTracker.addMovement(event);
|
||||
int action = event.getAction();
|
||||
if (action == 0) {
|
||||
this.mLastTouchX = event.getRawX();
|
||||
this.mLastTouchY = event.getRawY();
|
||||
this.mDragStarted = false;
|
||||
return;
|
||||
}
|
||||
if (action == 1) {
|
||||
this.mDragStarted = false;
|
||||
velocityTracker.computeCurrentVelocity(1000);
|
||||
float xVelocity = velocityTracker.getXVelocity();
|
||||
float yVelocity = velocityTracker.getYVelocity();
|
||||
float progress = this.mMotionLayout.getProgress();
|
||||
int i2 = this.mTouchAnchorId;
|
||||
if (i2 != -1) {
|
||||
this.mMotionLayout.getAnchorDpDt(i2, progress, this.mTouchAnchorX, this.mTouchAnchorY, this.mAnchorDpDt);
|
||||
} else {
|
||||
float min = Math.min(this.mMotionLayout.getWidth(), this.mMotionLayout.getHeight());
|
||||
float[] fArr = this.mAnchorDpDt;
|
||||
fArr[1] = this.mTouchDirectionY * min;
|
||||
fArr[0] = min * this.mTouchDirectionX;
|
||||
}
|
||||
float f2 = this.mTouchDirectionX;
|
||||
float[] fArr2 = this.mAnchorDpDt;
|
||||
float f3 = f2 != 0.0f ? xVelocity / fArr2[0] : yVelocity / fArr2[1];
|
||||
float f4 = !Float.isNaN(f3) ? (f3 / 3.0f) + progress : progress;
|
||||
if (f4 == 0.0f || f4 == 1.0f || (i = this.mOnTouchUp) == 3) {
|
||||
if (0.0f >= f4 || 1.0f <= f4) {
|
||||
this.mMotionLayout.setState(MotionLayout.TransitionState.FINISHED);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
float f5 = ((double) f4) < 0.5d ? 0.0f : 1.0f;
|
||||
if (i == 6) {
|
||||
if (progress + f3 < 0.0f) {
|
||||
f3 = Math.abs(f3);
|
||||
}
|
||||
f5 = 1.0f;
|
||||
}
|
||||
if (this.mOnTouchUp == 7) {
|
||||
if (progress + f3 > 1.0f) {
|
||||
f3 = -Math.abs(f3);
|
||||
}
|
||||
f5 = 0.0f;
|
||||
}
|
||||
this.mMotionLayout.touchAnimateTo(this.mOnTouchUp, f5, f3);
|
||||
if (0.0f >= progress || 1.0f <= progress) {
|
||||
this.mMotionLayout.setState(MotionLayout.TransitionState.FINISHED);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (action != 2) {
|
||||
return;
|
||||
}
|
||||
float rawY = event.getRawY() - this.mLastTouchY;
|
||||
float rawX = event.getRawX() - this.mLastTouchX;
|
||||
if (Math.abs((this.mTouchDirectionX * rawX) + (this.mTouchDirectionY * rawY)) > this.mDragThreshold || this.mDragStarted) {
|
||||
float progress2 = this.mMotionLayout.getProgress();
|
||||
if (!this.mDragStarted) {
|
||||
this.mDragStarted = true;
|
||||
this.mMotionLayout.setProgress(progress2);
|
||||
}
|
||||
int i3 = this.mTouchAnchorId;
|
||||
if (i3 != -1) {
|
||||
this.mMotionLayout.getAnchorDpDt(i3, progress2, this.mTouchAnchorX, this.mTouchAnchorY, this.mAnchorDpDt);
|
||||
} else {
|
||||
float min2 = Math.min(this.mMotionLayout.getWidth(), this.mMotionLayout.getHeight());
|
||||
float[] fArr3 = this.mAnchorDpDt;
|
||||
fArr3[1] = this.mTouchDirectionY * min2;
|
||||
fArr3[0] = min2 * this.mTouchDirectionX;
|
||||
}
|
||||
float f6 = this.mTouchDirectionX;
|
||||
float[] fArr4 = this.mAnchorDpDt;
|
||||
if (Math.abs(((f6 * fArr4[0]) + (this.mTouchDirectionY * fArr4[1])) * this.mDragScale) < 0.01d) {
|
||||
float[] fArr5 = this.mAnchorDpDt;
|
||||
fArr5[0] = 0.01f;
|
||||
fArr5[1] = 0.01f;
|
||||
}
|
||||
if (this.mTouchDirectionX != 0.0f) {
|
||||
f = rawX / this.mAnchorDpDt[0];
|
||||
} else {
|
||||
f = rawY / this.mAnchorDpDt[1];
|
||||
}
|
||||
float max = Math.max(Math.min(progress2 + f, 1.0f), 0.0f);
|
||||
if (this.mOnTouchUp == 6) {
|
||||
max = Math.max(max, 0.01f);
|
||||
}
|
||||
if (this.mOnTouchUp == 7) {
|
||||
max = Math.min(max, 0.99f);
|
||||
}
|
||||
float progress3 = this.mMotionLayout.getProgress();
|
||||
if (max != progress3) {
|
||||
if (progress3 == 0.0f || progress3 == 1.0f) {
|
||||
this.mMotionLayout.endTrigger(progress3 == 0.0f);
|
||||
}
|
||||
this.mMotionLayout.setProgress(max);
|
||||
velocityTracker.computeCurrentVelocity(1000);
|
||||
this.mMotionLayout.mLastVelocity = this.mTouchDirectionX != 0.0f ? velocityTracker.getXVelocity() / this.mAnchorDpDt[0] : velocityTracker.getYVelocity() / this.mAnchorDpDt[1];
|
||||
} else {
|
||||
this.mMotionLayout.mLastVelocity = 0.0f;
|
||||
}
|
||||
this.mLastTouchX = event.getRawX();
|
||||
this.mLastTouchY = event.getRawY();
|
||||
}
|
||||
}
|
||||
|
||||
float getProgressDirection(float dx, float dy) {
|
||||
this.mMotionLayout.getAnchorDpDt(this.mTouchAnchorId, this.mMotionLayout.getProgress(), this.mTouchAnchorX, this.mTouchAnchorY, this.mAnchorDpDt);
|
||||
float f = this.mTouchDirectionX;
|
||||
if (f != 0.0f) {
|
||||
float[] fArr = this.mAnchorDpDt;
|
||||
if (fArr[0] == 0.0f) {
|
||||
fArr[0] = 1.0E-7f;
|
||||
}
|
||||
return (dx * f) / fArr[0];
|
||||
}
|
||||
float[] fArr2 = this.mAnchorDpDt;
|
||||
if (fArr2[1] == 0.0f) {
|
||||
fArr2[1] = 1.0E-7f;
|
||||
}
|
||||
return (dy * this.mTouchDirectionY) / fArr2[1];
|
||||
}
|
||||
|
||||
void scrollUp(float dx, float dy) {
|
||||
this.mDragStarted = false;
|
||||
float progress = this.mMotionLayout.getProgress();
|
||||
this.mMotionLayout.getAnchorDpDt(this.mTouchAnchorId, progress, this.mTouchAnchorX, this.mTouchAnchorY, this.mAnchorDpDt);
|
||||
float f = this.mTouchDirectionX;
|
||||
float[] fArr = this.mAnchorDpDt;
|
||||
float f2 = f != 0.0f ? (dx * f) / fArr[0] : (dy * this.mTouchDirectionY) / fArr[1];
|
||||
if (!Float.isNaN(f2)) {
|
||||
progress += f2 / 3.0f;
|
||||
}
|
||||
if (progress != 0.0f) {
|
||||
boolean z = progress != 1.0f;
|
||||
int i = this.mOnTouchUp;
|
||||
if ((i != 3) && z) {
|
||||
this.mMotionLayout.touchAnimateTo(i, ((double) progress) >= 0.5d ? 1.0f : 0.0f, f2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void scrollMove(float dx, float dy) {
|
||||
float f;
|
||||
float progress = this.mMotionLayout.getProgress();
|
||||
if (!this.mDragStarted) {
|
||||
this.mDragStarted = true;
|
||||
this.mMotionLayout.setProgress(progress);
|
||||
}
|
||||
this.mMotionLayout.getAnchorDpDt(this.mTouchAnchorId, progress, this.mTouchAnchorX, this.mTouchAnchorY, this.mAnchorDpDt);
|
||||
float f2 = this.mTouchDirectionX;
|
||||
float[] fArr = this.mAnchorDpDt;
|
||||
if (Math.abs((f2 * fArr[0]) + (this.mTouchDirectionY * fArr[1])) < 0.01d) {
|
||||
float[] fArr2 = this.mAnchorDpDt;
|
||||
fArr2[0] = 0.01f;
|
||||
fArr2[1] = 0.01f;
|
||||
}
|
||||
float f3 = this.mTouchDirectionX;
|
||||
if (f3 != 0.0f) {
|
||||
f = (dx * f3) / this.mAnchorDpDt[0];
|
||||
} else {
|
||||
f = (dy * this.mTouchDirectionY) / this.mAnchorDpDt[1];
|
||||
}
|
||||
float max = Math.max(Math.min(progress + f, 1.0f), 0.0f);
|
||||
if (max != this.mMotionLayout.getProgress()) {
|
||||
this.mMotionLayout.setProgress(max);
|
||||
}
|
||||
}
|
||||
|
||||
void setupTouch() {
|
||||
View view;
|
||||
int i = this.mTouchAnchorId;
|
||||
if (i != -1) {
|
||||
view = this.mMotionLayout.findViewById(i);
|
||||
if (view == null) {
|
||||
Log.e(TAG, "cannot find TouchAnchorId @id/" + Debug.getName(this.mMotionLayout.getContext(), this.mTouchAnchorId));
|
||||
}
|
||||
} else {
|
||||
view = null;
|
||||
}
|
||||
if (view instanceof NestedScrollView) {
|
||||
NestedScrollView nestedScrollView = (NestedScrollView) view;
|
||||
nestedScrollView.setOnTouchListener(new View.OnTouchListener(this) { // from class: androidx.constraintlayout.motion.widget.TouchResponse.1
|
||||
@Override // android.view.View.OnTouchListener
|
||||
public boolean onTouch(View view2, MotionEvent motionEvent) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
nestedScrollView.setOnScrollChangeListener(new NestedScrollView.OnScrollChangeListener(this) { // from class: androidx.constraintlayout.motion.widget.TouchResponse.2
|
||||
@Override // androidx.core.widget.NestedScrollView.OnScrollChangeListener
|
||||
public void onScrollChange(NestedScrollView v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
RectF getTouchRegion(ViewGroup layout, RectF rect) {
|
||||
View findViewById;
|
||||
int i = this.mTouchRegionId;
|
||||
if (i == -1 || (findViewById = layout.findViewById(i)) == null) {
|
||||
return null;
|
||||
}
|
||||
rect.set(findViewById.getLeft(), findViewById.getTop(), findViewById.getRight(), findViewById.getBottom());
|
||||
return rect;
|
||||
}
|
||||
|
||||
RectF getLimitBoundsTo(ViewGroup layout, RectF rect) {
|
||||
View findViewById;
|
||||
int i = this.mLimitBoundsTo;
|
||||
if (i == -1 || (findViewById = layout.findViewById(i)) == null) {
|
||||
return null;
|
||||
}
|
||||
rect.set(findViewById.getLeft(), findViewById.getTop(), findViewById.getRight(), findViewById.getBottom());
|
||||
return rect;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
if (Float.isNaN(this.mTouchDirectionX)) {
|
||||
return Key.ROTATION;
|
||||
}
|
||||
return this.mTouchDirectionX + " , " + this.mTouchDirectionY;
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package androidx.constraintlayout.motion.widget;
|
||||
|
||||
import androidx.constraintlayout.motion.widget.MotionLayout;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class TransitionAdapter implements MotionLayout.TransitionListener {
|
||||
@Override // androidx.constraintlayout.motion.widget.MotionLayout.TransitionListener
|
||||
public void onTransitionChange(MotionLayout motionLayout, int startId, int endId, float progress) {
|
||||
}
|
||||
|
||||
@Override // androidx.constraintlayout.motion.widget.MotionLayout.TransitionListener
|
||||
public void onTransitionCompleted(MotionLayout motionLayout, int currentId) {
|
||||
}
|
||||
|
||||
@Override // androidx.constraintlayout.motion.widget.MotionLayout.TransitionListener
|
||||
public void onTransitionStarted(MotionLayout motionLayout, int startId, int endId) {
|
||||
}
|
||||
|
||||
@Override // androidx.constraintlayout.motion.widget.MotionLayout.TransitionListener
|
||||
public void onTransitionTrigger(MotionLayout motionLayout, int triggerId, boolean positive, float progress) {
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package androidx.constraintlayout.motion.widget;
|
||||
|
||||
import androidx.constraintlayout.motion.widget.MotionScene;
|
||||
import androidx.constraintlayout.widget.ConstraintSet;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class TransitionBuilder {
|
||||
private static final String TAG = "TransitionBuilder";
|
||||
|
||||
public static void validate(MotionLayout layout) {
|
||||
if (layout.mScene == null) {
|
||||
throw new RuntimeException("Invalid motion layout. Layout missing Motion Scene.");
|
||||
}
|
||||
MotionScene motionScene = layout.mScene;
|
||||
if (!motionScene.validateLayout(layout)) {
|
||||
throw new RuntimeException("MotionLayout doesn't have the right motion scene.");
|
||||
}
|
||||
if (motionScene.mCurrentTransition == null || motionScene.getDefinedTransitions().isEmpty()) {
|
||||
throw new RuntimeException("Invalid motion layout. Motion Scene doesn't have any transition.");
|
||||
}
|
||||
}
|
||||
|
||||
public static MotionScene.Transition buildTransition(MotionScene scene, int transitionId, int startConstraintSetId, ConstraintSet startConstraintSet, int endConstraintSetId, ConstraintSet endConstraintSet) {
|
||||
MotionScene.Transition transition = new MotionScene.Transition(transitionId, scene, startConstraintSetId, endConstraintSetId);
|
||||
updateConstraintSetInMotionScene(scene, transition, startConstraintSet, endConstraintSet);
|
||||
return transition;
|
||||
}
|
||||
|
||||
private static void updateConstraintSetInMotionScene(MotionScene scene, MotionScene.Transition transition, ConstraintSet startConstraintSet, ConstraintSet endConstraintSet) {
|
||||
int startConstraintSetId = transition.getStartConstraintSetId();
|
||||
int endConstraintSetId = transition.getEndConstraintSetId();
|
||||
scene.setConstraintSet(startConstraintSetId, startConstraintSet);
|
||||
scene.setConstraintSet(endConstraintSetId, endConstraintSet);
|
||||
}
|
||||
}
|
@ -0,0 +1,557 @@
|
||||
package androidx.constraintlayout.motion.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Rect;
|
||||
import android.util.Log;
|
||||
import android.util.TypedValue;
|
||||
import android.util.Xml;
|
||||
import android.view.View;
|
||||
import android.view.animation.AccelerateDecelerateInterpolator;
|
||||
import android.view.animation.AccelerateInterpolator;
|
||||
import android.view.animation.AnimationUtils;
|
||||
import android.view.animation.AnticipateInterpolator;
|
||||
import android.view.animation.BounceInterpolator;
|
||||
import android.view.animation.DecelerateInterpolator;
|
||||
import android.view.animation.Interpolator;
|
||||
import android.view.animation.OvershootInterpolator;
|
||||
import androidx.constraintlayout.core.motion.utils.Easing;
|
||||
import androidx.constraintlayout.core.motion.utils.KeyCache;
|
||||
import androidx.constraintlayout.motion.widget.MotionScene;
|
||||
import androidx.constraintlayout.widget.ConstraintAttribute;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.constraintlayout.widget.ConstraintSet;
|
||||
import androidx.constraintlayout.widget.R;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ViewTransition {
|
||||
static final int ANTICIPATE = 6;
|
||||
static final int BOUNCE = 4;
|
||||
public static final String CONSTRAINT_OVERRIDE = "ConstraintOverride";
|
||||
public static final String CUSTOM_ATTRIBUTE = "CustomAttribute";
|
||||
public static final String CUSTOM_METHOD = "CustomMethod";
|
||||
static final int EASE_IN = 1;
|
||||
static final int EASE_IN_OUT = 0;
|
||||
static final int EASE_OUT = 2;
|
||||
private static final int INTERPOLATOR_REFERENCE_ID = -2;
|
||||
public static final String KEY_FRAME_SET_TAG = "KeyFrameSet";
|
||||
static final int LINEAR = 3;
|
||||
public static final int ONSTATE_ACTION_DOWN = 1;
|
||||
public static final int ONSTATE_ACTION_DOWN_UP = 3;
|
||||
public static final int ONSTATE_ACTION_UP = 2;
|
||||
public static final int ONSTATE_SHARED_VALUE_SET = 4;
|
||||
public static final int ONSTATE_SHARED_VALUE_UNSET = 5;
|
||||
static final int OVERSHOOT = 5;
|
||||
private static final int SPLINE_STRING = -1;
|
||||
private static String TAG = "ViewTransition";
|
||||
private static final int UNSET = -1;
|
||||
static final int VIEWTRANSITIONMODE_ALLSTATES = 1;
|
||||
static final int VIEWTRANSITIONMODE_CURRENTSTATE = 0;
|
||||
static final int VIEWTRANSITIONMODE_NOSTATE = 2;
|
||||
public static final String VIEW_TRANSITION_TAG = "ViewTransition";
|
||||
ConstraintSet.Constraint mConstraintDelta;
|
||||
Context mContext;
|
||||
private int mId;
|
||||
KeyFrames mKeyFrames;
|
||||
private int mTargetId;
|
||||
private String mTargetString;
|
||||
int mViewTransitionMode;
|
||||
ConstraintSet set;
|
||||
private int mOnStateTransition = -1;
|
||||
private boolean mDisabled = false;
|
||||
private int mPathMotionArc = 0;
|
||||
private int mDuration = -1;
|
||||
private int mUpDuration = -1;
|
||||
private int mDefaultInterpolator = 0;
|
||||
private String mDefaultInterpolatorString = null;
|
||||
private int mDefaultInterpolatorID = -1;
|
||||
private int mSetsTag = -1;
|
||||
private int mClearsTag = -1;
|
||||
private int mIfTagSet = -1;
|
||||
private int mIfTagNotSet = -1;
|
||||
private int mSharedValueTarget = -1;
|
||||
private int mSharedValueID = -1;
|
||||
private int mSharedValueCurrent = -1;
|
||||
|
||||
int getId() {
|
||||
return this.mId;
|
||||
}
|
||||
|
||||
public int getSharedValue() {
|
||||
return this.mSharedValueTarget;
|
||||
}
|
||||
|
||||
public int getSharedValueCurrent() {
|
||||
return this.mSharedValueCurrent;
|
||||
}
|
||||
|
||||
public int getSharedValueID() {
|
||||
return this.mSharedValueID;
|
||||
}
|
||||
|
||||
public int getStateTransition() {
|
||||
return this.mOnStateTransition;
|
||||
}
|
||||
|
||||
boolean isEnabled() {
|
||||
return !this.mDisabled;
|
||||
}
|
||||
|
||||
void setEnabled(boolean enable) {
|
||||
this.mDisabled = !enable;
|
||||
}
|
||||
|
||||
void setId(int id) {
|
||||
this.mId = id;
|
||||
}
|
||||
|
||||
public void setSharedValue(int sharedValue) {
|
||||
this.mSharedValueTarget = sharedValue;
|
||||
}
|
||||
|
||||
public void setSharedValueCurrent(int sharedValueCurrent) {
|
||||
this.mSharedValueCurrent = sharedValueCurrent;
|
||||
}
|
||||
|
||||
public void setSharedValueID(int sharedValueID) {
|
||||
this.mSharedValueID = sharedValueID;
|
||||
}
|
||||
|
||||
public void setStateTransition(int stateTransition) {
|
||||
this.mOnStateTransition = stateTransition;
|
||||
}
|
||||
|
||||
boolean supports(int action) {
|
||||
int i = this.mOnStateTransition;
|
||||
return i == 1 ? action == 0 : i == 2 ? action == 1 : i == 3 && action == 0;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "ViewTransition(" + Debug.getName(this.mContext, this.mId) + ")";
|
||||
}
|
||||
|
||||
Interpolator getInterpolator(Context context) {
|
||||
int i = this.mDefaultInterpolator;
|
||||
if (i == -2) {
|
||||
return AnimationUtils.loadInterpolator(context, this.mDefaultInterpolatorID);
|
||||
}
|
||||
if (i == -1) {
|
||||
final Easing interpolator = Easing.getInterpolator(this.mDefaultInterpolatorString);
|
||||
return new Interpolator(this) { // from class: androidx.constraintlayout.motion.widget.ViewTransition.1
|
||||
@Override // android.animation.TimeInterpolator
|
||||
public float getInterpolation(float v) {
|
||||
return (float) interpolator.get(v);
|
||||
}
|
||||
};
|
||||
}
|
||||
if (i == 0) {
|
||||
return new AccelerateDecelerateInterpolator();
|
||||
}
|
||||
if (i == 1) {
|
||||
return new AccelerateInterpolator();
|
||||
}
|
||||
if (i == 2) {
|
||||
return new DecelerateInterpolator();
|
||||
}
|
||||
if (i == 4) {
|
||||
return new BounceInterpolator();
|
||||
}
|
||||
if (i == 5) {
|
||||
return new OvershootInterpolator();
|
||||
}
|
||||
if (i != 6) {
|
||||
return null;
|
||||
}
|
||||
return new AnticipateInterpolator();
|
||||
}
|
||||
|
||||
ViewTransition(Context context, XmlPullParser parser) {
|
||||
char c;
|
||||
this.mContext = context;
|
||||
try {
|
||||
int eventType = parser.getEventType();
|
||||
while (eventType != 1) {
|
||||
if (eventType == 2) {
|
||||
String name = parser.getName();
|
||||
switch (name.hashCode()) {
|
||||
case -1962203927:
|
||||
if (name.equals(CONSTRAINT_OVERRIDE)) {
|
||||
c = 2;
|
||||
break;
|
||||
}
|
||||
c = 65535;
|
||||
break;
|
||||
case -1239391468:
|
||||
if (name.equals(KEY_FRAME_SET_TAG)) {
|
||||
c = 1;
|
||||
break;
|
||||
}
|
||||
c = 65535;
|
||||
break;
|
||||
case 61998586:
|
||||
if (name.equals(VIEW_TRANSITION_TAG)) {
|
||||
c = 0;
|
||||
break;
|
||||
}
|
||||
c = 65535;
|
||||
break;
|
||||
case 366511058:
|
||||
if (name.equals(CUSTOM_METHOD)) {
|
||||
c = 4;
|
||||
break;
|
||||
}
|
||||
c = 65535;
|
||||
break;
|
||||
case 1791837707:
|
||||
if (name.equals(CUSTOM_ATTRIBUTE)) {
|
||||
c = 3;
|
||||
break;
|
||||
}
|
||||
c = 65535;
|
||||
break;
|
||||
default:
|
||||
c = 65535;
|
||||
break;
|
||||
}
|
||||
if (c == 0) {
|
||||
parseViewTransitionTags(context, parser);
|
||||
} else if (c == 1) {
|
||||
this.mKeyFrames = new KeyFrames(context, parser);
|
||||
} else if (c == 2) {
|
||||
this.mConstraintDelta = ConstraintSet.buildDelta(context, parser);
|
||||
} else if (c == 3 || c == 4) {
|
||||
ConstraintAttribute.parse(context, parser, this.mConstraintDelta.mCustomConstraints);
|
||||
} else {
|
||||
Log.e(TAG, Debug.getLoc() + " unknown tag " + name);
|
||||
Log.e(TAG, ".xml:" + parser.getLineNumber());
|
||||
}
|
||||
} else if (eventType != 3) {
|
||||
continue;
|
||||
} else if (VIEW_TRANSITION_TAG.equals(parser.getName())) {
|
||||
return;
|
||||
}
|
||||
eventType = parser.next();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (XmlPullParserException e2) {
|
||||
e2.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void parseViewTransitionTags(Context context, XmlPullParser parser) {
|
||||
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(Xml.asAttributeSet(parser), R.styleable.ViewTransition);
|
||||
int indexCount = obtainStyledAttributes.getIndexCount();
|
||||
for (int i = 0; i < indexCount; i++) {
|
||||
int index = obtainStyledAttributes.getIndex(i);
|
||||
if (index == R.styleable.ViewTransition_android_id) {
|
||||
this.mId = obtainStyledAttributes.getResourceId(index, this.mId);
|
||||
} else if (index == R.styleable.ViewTransition_motionTarget) {
|
||||
if (MotionLayout.IS_IN_EDIT_MODE) {
|
||||
int resourceId = obtainStyledAttributes.getResourceId(index, this.mTargetId);
|
||||
this.mTargetId = resourceId;
|
||||
if (resourceId == -1) {
|
||||
this.mTargetString = obtainStyledAttributes.getString(index);
|
||||
}
|
||||
} else if (obtainStyledAttributes.peekValue(index).type == 3) {
|
||||
this.mTargetString = obtainStyledAttributes.getString(index);
|
||||
} else {
|
||||
this.mTargetId = obtainStyledAttributes.getResourceId(index, this.mTargetId);
|
||||
}
|
||||
} else if (index == R.styleable.ViewTransition_onStateTransition) {
|
||||
this.mOnStateTransition = obtainStyledAttributes.getInt(index, this.mOnStateTransition);
|
||||
} else if (index == R.styleable.ViewTransition_transitionDisable) {
|
||||
this.mDisabled = obtainStyledAttributes.getBoolean(index, this.mDisabled);
|
||||
} else if (index == R.styleable.ViewTransition_pathMotionArc) {
|
||||
this.mPathMotionArc = obtainStyledAttributes.getInt(index, this.mPathMotionArc);
|
||||
} else if (index == R.styleable.ViewTransition_duration) {
|
||||
this.mDuration = obtainStyledAttributes.getInt(index, this.mDuration);
|
||||
} else if (index == R.styleable.ViewTransition_upDuration) {
|
||||
this.mUpDuration = obtainStyledAttributes.getInt(index, this.mUpDuration);
|
||||
} else if (index == R.styleable.ViewTransition_viewTransitionMode) {
|
||||
this.mViewTransitionMode = obtainStyledAttributes.getInt(index, this.mViewTransitionMode);
|
||||
} else if (index == R.styleable.ViewTransition_motionInterpolator) {
|
||||
TypedValue peekValue = obtainStyledAttributes.peekValue(index);
|
||||
if (peekValue.type == 1) {
|
||||
int resourceId2 = obtainStyledAttributes.getResourceId(index, -1);
|
||||
this.mDefaultInterpolatorID = resourceId2;
|
||||
if (resourceId2 != -1) {
|
||||
this.mDefaultInterpolator = -2;
|
||||
}
|
||||
} else if (peekValue.type == 3) {
|
||||
String string = obtainStyledAttributes.getString(index);
|
||||
this.mDefaultInterpolatorString = string;
|
||||
if (string == null || string.indexOf("/") <= 0) {
|
||||
this.mDefaultInterpolator = -1;
|
||||
} else {
|
||||
this.mDefaultInterpolatorID = obtainStyledAttributes.getResourceId(index, -1);
|
||||
this.mDefaultInterpolator = -2;
|
||||
}
|
||||
} else {
|
||||
this.mDefaultInterpolator = obtainStyledAttributes.getInteger(index, this.mDefaultInterpolator);
|
||||
}
|
||||
} else if (index == R.styleable.ViewTransition_setsTag) {
|
||||
this.mSetsTag = obtainStyledAttributes.getResourceId(index, this.mSetsTag);
|
||||
} else if (index == R.styleable.ViewTransition_clearsTag) {
|
||||
this.mClearsTag = obtainStyledAttributes.getResourceId(index, this.mClearsTag);
|
||||
} else if (index == R.styleable.ViewTransition_ifTagSet) {
|
||||
this.mIfTagSet = obtainStyledAttributes.getResourceId(index, this.mIfTagSet);
|
||||
} else if (index == R.styleable.ViewTransition_ifTagNotSet) {
|
||||
this.mIfTagNotSet = obtainStyledAttributes.getResourceId(index, this.mIfTagNotSet);
|
||||
} else if (index == R.styleable.ViewTransition_SharedValueId) {
|
||||
this.mSharedValueID = obtainStyledAttributes.getResourceId(index, this.mSharedValueID);
|
||||
} else if (index == R.styleable.ViewTransition_SharedValue) {
|
||||
this.mSharedValueTarget = obtainStyledAttributes.getInteger(index, this.mSharedValueTarget);
|
||||
}
|
||||
}
|
||||
obtainStyledAttributes.recycle();
|
||||
}
|
||||
|
||||
void applyIndependentTransition(ViewTransitionController controller, MotionLayout motionLayout, View view) {
|
||||
MotionController motionController = new MotionController(view);
|
||||
motionController.setBothStates(view);
|
||||
this.mKeyFrames.addAllFrames(motionController);
|
||||
motionController.setup(motionLayout.getWidth(), motionLayout.getHeight(), this.mDuration, System.nanoTime());
|
||||
new Animate(controller, motionController, this.mDuration, this.mUpDuration, this.mOnStateTransition, getInterpolator(motionLayout.getContext()), this.mSetsTag, this.mClearsTag);
|
||||
}
|
||||
|
||||
static class Animate {
|
||||
boolean hold_at_100;
|
||||
private final int mClearsTag;
|
||||
float mDpositionDt;
|
||||
int mDuration;
|
||||
Interpolator mInterpolator;
|
||||
long mLastRender;
|
||||
MotionController mMC;
|
||||
float mPosition;
|
||||
private final int mSetsTag;
|
||||
long mStart;
|
||||
int mUpDuration;
|
||||
ViewTransitionController mVtController;
|
||||
KeyCache mCache = new KeyCache();
|
||||
boolean reverse = false;
|
||||
Rect mTempRec = new Rect();
|
||||
|
||||
Animate(ViewTransitionController controller, MotionController motionController, int duration, int upDuration, int mode, Interpolator interpolator, int setTag, int clearTag) {
|
||||
this.hold_at_100 = false;
|
||||
this.mVtController = controller;
|
||||
this.mMC = motionController;
|
||||
this.mDuration = duration;
|
||||
this.mUpDuration = upDuration;
|
||||
long nanoTime = System.nanoTime();
|
||||
this.mStart = nanoTime;
|
||||
this.mLastRender = nanoTime;
|
||||
this.mVtController.addAnimation(this);
|
||||
this.mInterpolator = interpolator;
|
||||
this.mSetsTag = setTag;
|
||||
this.mClearsTag = clearTag;
|
||||
if (mode == 3) {
|
||||
this.hold_at_100 = true;
|
||||
}
|
||||
this.mDpositionDt = duration == 0 ? Float.MAX_VALUE : 1.0f / duration;
|
||||
mutate();
|
||||
}
|
||||
|
||||
void reverse(boolean dir) {
|
||||
int i;
|
||||
this.reverse = dir;
|
||||
if (dir && (i = this.mUpDuration) != -1) {
|
||||
this.mDpositionDt = i == 0 ? Float.MAX_VALUE : 1.0f / i;
|
||||
}
|
||||
this.mVtController.invalidate();
|
||||
this.mLastRender = System.nanoTime();
|
||||
}
|
||||
|
||||
void mutate() {
|
||||
if (this.reverse) {
|
||||
mutateReverse();
|
||||
} else {
|
||||
mutateForward();
|
||||
}
|
||||
}
|
||||
|
||||
void mutateReverse() {
|
||||
long nanoTime = System.nanoTime();
|
||||
long j = nanoTime - this.mLastRender;
|
||||
this.mLastRender = nanoTime;
|
||||
float f = this.mPosition - (((float) (j * 1.0E-6d)) * this.mDpositionDt);
|
||||
this.mPosition = f;
|
||||
if (f < 0.0f) {
|
||||
this.mPosition = 0.0f;
|
||||
}
|
||||
Interpolator interpolator = this.mInterpolator;
|
||||
float interpolation = interpolator == null ? this.mPosition : interpolator.getInterpolation(this.mPosition);
|
||||
MotionController motionController = this.mMC;
|
||||
boolean interpolate = motionController.interpolate(motionController.mView, interpolation, nanoTime, this.mCache);
|
||||
if (this.mPosition <= 0.0f) {
|
||||
if (this.mSetsTag != -1) {
|
||||
this.mMC.getView().setTag(this.mSetsTag, Long.valueOf(System.nanoTime()));
|
||||
}
|
||||
if (this.mClearsTag != -1) {
|
||||
this.mMC.getView().setTag(this.mClearsTag, null);
|
||||
}
|
||||
this.mVtController.removeAnimation(this);
|
||||
}
|
||||
if (this.mPosition > 0.0f || interpolate) {
|
||||
this.mVtController.invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
void mutateForward() {
|
||||
long nanoTime = System.nanoTime();
|
||||
long j = nanoTime - this.mLastRender;
|
||||
this.mLastRender = nanoTime;
|
||||
float f = this.mPosition + (((float) (j * 1.0E-6d)) * this.mDpositionDt);
|
||||
this.mPosition = f;
|
||||
if (f >= 1.0f) {
|
||||
this.mPosition = 1.0f;
|
||||
}
|
||||
Interpolator interpolator = this.mInterpolator;
|
||||
float interpolation = interpolator == null ? this.mPosition : interpolator.getInterpolation(this.mPosition);
|
||||
MotionController motionController = this.mMC;
|
||||
boolean interpolate = motionController.interpolate(motionController.mView, interpolation, nanoTime, this.mCache);
|
||||
if (this.mPosition >= 1.0f) {
|
||||
if (this.mSetsTag != -1) {
|
||||
this.mMC.getView().setTag(this.mSetsTag, Long.valueOf(System.nanoTime()));
|
||||
}
|
||||
if (this.mClearsTag != -1) {
|
||||
this.mMC.getView().setTag(this.mClearsTag, null);
|
||||
}
|
||||
if (!this.hold_at_100) {
|
||||
this.mVtController.removeAnimation(this);
|
||||
}
|
||||
}
|
||||
if (this.mPosition < 1.0f || interpolate) {
|
||||
this.mVtController.invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public void reactTo(int action, float x, float y) {
|
||||
if (action == 1) {
|
||||
if (this.reverse) {
|
||||
return;
|
||||
}
|
||||
reverse(true);
|
||||
} else {
|
||||
if (action != 2) {
|
||||
return;
|
||||
}
|
||||
this.mMC.getView().getHitRect(this.mTempRec);
|
||||
if (this.mTempRec.contains((int) x, (int) y) || this.reverse) {
|
||||
return;
|
||||
}
|
||||
reverse(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void applyTransition(ViewTransitionController controller, MotionLayout layout, int fromId, ConstraintSet current, final View... views) {
|
||||
if (this.mDisabled) {
|
||||
return;
|
||||
}
|
||||
int i = this.mViewTransitionMode;
|
||||
if (i == 2) {
|
||||
applyIndependentTransition(controller, layout, views[0]);
|
||||
return;
|
||||
}
|
||||
if (i == 1) {
|
||||
for (int i2 : layout.getConstraintSetIds()) {
|
||||
if (i2 != fromId) {
|
||||
ConstraintSet constraintSet = layout.getConstraintSet(i2);
|
||||
for (View view : views) {
|
||||
ConstraintSet.Constraint constraint = constraintSet.getConstraint(view.getId());
|
||||
ConstraintSet.Constraint constraint2 = this.mConstraintDelta;
|
||||
if (constraint2 != null) {
|
||||
constraint2.applyDelta(constraint);
|
||||
constraint.mCustomConstraints.putAll(this.mConstraintDelta.mCustomConstraints);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ConstraintSet constraintSet2 = new ConstraintSet();
|
||||
constraintSet2.clone(current);
|
||||
for (View view2 : views) {
|
||||
ConstraintSet.Constraint constraint3 = constraintSet2.getConstraint(view2.getId());
|
||||
ConstraintSet.Constraint constraint4 = this.mConstraintDelta;
|
||||
if (constraint4 != null) {
|
||||
constraint4.applyDelta(constraint3);
|
||||
constraint3.mCustomConstraints.putAll(this.mConstraintDelta.mCustomConstraints);
|
||||
}
|
||||
}
|
||||
layout.updateState(fromId, constraintSet2);
|
||||
layout.updateState(R.id.view_transition, current);
|
||||
layout.setState(R.id.view_transition, -1, -1);
|
||||
MotionScene.Transition transition = new MotionScene.Transition(-1, layout.mScene, R.id.view_transition, fromId);
|
||||
for (View view3 : views) {
|
||||
updateTransition(transition, view3);
|
||||
}
|
||||
layout.setTransition(transition);
|
||||
layout.transitionToEnd(new Runnable() { // from class: androidx.constraintlayout.motion.widget.ViewTransition$$ExternalSyntheticLambda0
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
ViewTransition.this.m50x14d7500(views);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/* renamed from: lambda$applyTransition$0$androidx-constraintlayout-motion-widget-ViewTransition, reason: not valid java name */
|
||||
/* synthetic */ void m50x14d7500(View[] viewArr) {
|
||||
if (this.mSetsTag != -1) {
|
||||
for (View view : viewArr) {
|
||||
view.setTag(this.mSetsTag, Long.valueOf(System.nanoTime()));
|
||||
}
|
||||
}
|
||||
if (this.mClearsTag != -1) {
|
||||
for (View view2 : viewArr) {
|
||||
view2.setTag(this.mClearsTag, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updateTransition(MotionScene.Transition transition, View view) {
|
||||
int i = this.mDuration;
|
||||
if (i != -1) {
|
||||
transition.setDuration(i);
|
||||
}
|
||||
transition.setPathMotionArc(this.mPathMotionArc);
|
||||
transition.setInterpolatorInfo(this.mDefaultInterpolator, this.mDefaultInterpolatorString, this.mDefaultInterpolatorID);
|
||||
int id = view.getId();
|
||||
KeyFrames keyFrames = this.mKeyFrames;
|
||||
if (keyFrames != null) {
|
||||
ArrayList<Key> keyFramesForView = keyFrames.getKeyFramesForView(-1);
|
||||
KeyFrames keyFrames2 = new KeyFrames();
|
||||
Iterator<Key> it = keyFramesForView.iterator();
|
||||
while (it.hasNext()) {
|
||||
keyFrames2.addKey(it.next().mo49clone().setViewId(id));
|
||||
}
|
||||
transition.addKeyFrame(keyFrames2);
|
||||
}
|
||||
}
|
||||
|
||||
boolean matchesView(View view) {
|
||||
String str;
|
||||
if (view == null) {
|
||||
return false;
|
||||
}
|
||||
if ((this.mTargetId == -1 && this.mTargetString == null) || !checkTags(view)) {
|
||||
return false;
|
||||
}
|
||||
if (view.getId() == this.mTargetId) {
|
||||
return true;
|
||||
}
|
||||
return this.mTargetString != null && (view.getLayoutParams() instanceof ConstraintLayout.LayoutParams) && (str = ((ConstraintLayout.LayoutParams) view.getLayoutParams()).constraintTag) != null && str.matches(this.mTargetString);
|
||||
}
|
||||
|
||||
boolean checkTags(View view) {
|
||||
int i = this.mIfTagSet;
|
||||
boolean z = i == -1 || view.getTag(i) != null;
|
||||
int i2 = this.mIfTagNotSet;
|
||||
return z && (i2 == -1 || view.getTag(i2) == null);
|
||||
}
|
||||
}
|
@ -0,0 +1,265 @@
|
||||
package androidx.constraintlayout.motion.widget;
|
||||
|
||||
import android.graphics.Rect;
|
||||
import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import androidx.constraintlayout.motion.widget.ViewTransition;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.constraintlayout.widget.ConstraintSet;
|
||||
import androidx.constraintlayout.widget.SharedValues;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ViewTransitionController {
|
||||
ArrayList<ViewTransition.Animate> animations;
|
||||
private final MotionLayout mMotionLayout;
|
||||
private HashSet<View> mRelatedViews;
|
||||
private ArrayList<ViewTransition> viewTransitions = new ArrayList<>();
|
||||
private String TAG = "ViewTransitionController";
|
||||
ArrayList<ViewTransition.Animate> removeList = new ArrayList<>();
|
||||
|
||||
public ViewTransitionController(MotionLayout layout) {
|
||||
this.mMotionLayout = layout;
|
||||
}
|
||||
|
||||
public void add(ViewTransition viewTransition) {
|
||||
this.viewTransitions.add(viewTransition);
|
||||
this.mRelatedViews = null;
|
||||
if (viewTransition.getStateTransition() == 4) {
|
||||
listenForSharedVariable(viewTransition, true);
|
||||
} else if (viewTransition.getStateTransition() == 5) {
|
||||
listenForSharedVariable(viewTransition, false);
|
||||
}
|
||||
}
|
||||
|
||||
void remove(int id) {
|
||||
ViewTransition viewTransition;
|
||||
Iterator<ViewTransition> it = this.viewTransitions.iterator();
|
||||
while (true) {
|
||||
if (!it.hasNext()) {
|
||||
viewTransition = null;
|
||||
break;
|
||||
} else {
|
||||
viewTransition = it.next();
|
||||
if (viewTransition.getId() == id) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (viewTransition != null) {
|
||||
this.mRelatedViews = null;
|
||||
this.viewTransitions.remove(viewTransition);
|
||||
}
|
||||
}
|
||||
|
||||
private void viewTransition(ViewTransition vt, View... view) {
|
||||
int currentState = this.mMotionLayout.getCurrentState();
|
||||
if (vt.mViewTransitionMode == 2) {
|
||||
vt.applyTransition(this, this.mMotionLayout, currentState, null, view);
|
||||
return;
|
||||
}
|
||||
if (currentState == -1) {
|
||||
Log.w(this.TAG, "No support for ViewTransition within transition yet. Currently: " + this.mMotionLayout.toString());
|
||||
return;
|
||||
}
|
||||
ConstraintSet constraintSet = this.mMotionLayout.getConstraintSet(currentState);
|
||||
if (constraintSet == null) {
|
||||
return;
|
||||
}
|
||||
vt.applyTransition(this, this.mMotionLayout, currentState, constraintSet, view);
|
||||
}
|
||||
|
||||
void enableViewTransition(int id, boolean enable) {
|
||||
Iterator<ViewTransition> it = this.viewTransitions.iterator();
|
||||
while (it.hasNext()) {
|
||||
ViewTransition next = it.next();
|
||||
if (next.getId() == id) {
|
||||
next.setEnabled(enable);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
boolean isViewTransitionEnabled(int id) {
|
||||
Iterator<ViewTransition> it = this.viewTransitions.iterator();
|
||||
while (it.hasNext()) {
|
||||
ViewTransition next = it.next();
|
||||
if (next.getId() == id) {
|
||||
return next.isEnabled();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void viewTransition(int id, View... views) {
|
||||
ArrayList arrayList = new ArrayList();
|
||||
Iterator<ViewTransition> it = this.viewTransitions.iterator();
|
||||
ViewTransition viewTransition = null;
|
||||
while (it.hasNext()) {
|
||||
ViewTransition next = it.next();
|
||||
if (next.getId() == id) {
|
||||
for (View view : views) {
|
||||
if (next.checkTags(view)) {
|
||||
arrayList.add(view);
|
||||
}
|
||||
}
|
||||
if (!arrayList.isEmpty()) {
|
||||
viewTransition(next, (View[]) arrayList.toArray(new View[0]));
|
||||
arrayList.clear();
|
||||
}
|
||||
viewTransition = next;
|
||||
}
|
||||
}
|
||||
if (viewTransition == null) {
|
||||
Log.e(this.TAG, " Could not find ViewTransition");
|
||||
}
|
||||
}
|
||||
|
||||
void touchEvent(MotionEvent event) {
|
||||
ViewTransition viewTransition;
|
||||
int currentState = this.mMotionLayout.getCurrentState();
|
||||
if (currentState == -1) {
|
||||
return;
|
||||
}
|
||||
if (this.mRelatedViews == null) {
|
||||
this.mRelatedViews = new HashSet<>();
|
||||
Iterator<ViewTransition> it = this.viewTransitions.iterator();
|
||||
while (it.hasNext()) {
|
||||
ViewTransition next = it.next();
|
||||
int childCount = this.mMotionLayout.getChildCount();
|
||||
for (int i = 0; i < childCount; i++) {
|
||||
View childAt = this.mMotionLayout.getChildAt(i);
|
||||
if (next.matchesView(childAt)) {
|
||||
childAt.getId();
|
||||
this.mRelatedViews.add(childAt);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
float x = event.getX();
|
||||
float y = event.getY();
|
||||
Rect rect = new Rect();
|
||||
int action = event.getAction();
|
||||
ArrayList<ViewTransition.Animate> arrayList = this.animations;
|
||||
if (arrayList != null && !arrayList.isEmpty()) {
|
||||
Iterator<ViewTransition.Animate> it2 = this.animations.iterator();
|
||||
while (it2.hasNext()) {
|
||||
it2.next().reactTo(action, x, y);
|
||||
}
|
||||
}
|
||||
if (action == 0 || action == 1) {
|
||||
ConstraintSet constraintSet = this.mMotionLayout.getConstraintSet(currentState);
|
||||
Iterator<ViewTransition> it3 = this.viewTransitions.iterator();
|
||||
while (it3.hasNext()) {
|
||||
ViewTransition next2 = it3.next();
|
||||
if (next2.supports(action)) {
|
||||
Iterator<View> it4 = this.mRelatedViews.iterator();
|
||||
while (it4.hasNext()) {
|
||||
View next3 = it4.next();
|
||||
if (next2.matchesView(next3)) {
|
||||
next3.getHitRect(rect);
|
||||
if (rect.contains((int) x, (int) y)) {
|
||||
viewTransition = next2;
|
||||
next2.applyTransition(this, this.mMotionLayout, currentState, constraintSet, next3);
|
||||
} else {
|
||||
viewTransition = next2;
|
||||
}
|
||||
next2 = viewTransition;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void addAnimation(ViewTransition.Animate animation) {
|
||||
if (this.animations == null) {
|
||||
this.animations = new ArrayList<>();
|
||||
}
|
||||
this.animations.add(animation);
|
||||
}
|
||||
|
||||
void removeAnimation(ViewTransition.Animate animation) {
|
||||
this.removeList.add(animation);
|
||||
}
|
||||
|
||||
void animate() {
|
||||
ArrayList<ViewTransition.Animate> arrayList = this.animations;
|
||||
if (arrayList == null) {
|
||||
return;
|
||||
}
|
||||
Iterator<ViewTransition.Animate> it = arrayList.iterator();
|
||||
while (it.hasNext()) {
|
||||
it.next().mutate();
|
||||
}
|
||||
this.animations.removeAll(this.removeList);
|
||||
this.removeList.clear();
|
||||
if (this.animations.isEmpty()) {
|
||||
this.animations = null;
|
||||
}
|
||||
}
|
||||
|
||||
void invalidate() {
|
||||
this.mMotionLayout.invalidate();
|
||||
}
|
||||
|
||||
boolean applyViewTransition(int viewTransitionId, MotionController motionController) {
|
||||
Iterator<ViewTransition> it = this.viewTransitions.iterator();
|
||||
while (it.hasNext()) {
|
||||
ViewTransition next = it.next();
|
||||
if (next.getId() == viewTransitionId) {
|
||||
next.mKeyFrames.addAllFrames(motionController);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void listenForSharedVariable(final ViewTransition viewTransition, final boolean isSet) {
|
||||
final int sharedValueID = viewTransition.getSharedValueID();
|
||||
final int sharedValue = viewTransition.getSharedValue();
|
||||
ConstraintLayout.getSharedValues().addListener(viewTransition.getSharedValueID(), new SharedValues.SharedValuesListener() { // from class: androidx.constraintlayout.motion.widget.ViewTransitionController.1
|
||||
@Override // androidx.constraintlayout.widget.SharedValues.SharedValuesListener
|
||||
public void onNewValue(int id, int value, int oldValue) {
|
||||
int sharedValueCurrent = viewTransition.getSharedValueCurrent();
|
||||
viewTransition.setSharedValueCurrent(value);
|
||||
if (sharedValueID != id || sharedValueCurrent == value) {
|
||||
return;
|
||||
}
|
||||
if (isSet) {
|
||||
if (sharedValue == value) {
|
||||
int childCount = ViewTransitionController.this.mMotionLayout.getChildCount();
|
||||
for (int i = 0; i < childCount; i++) {
|
||||
View childAt = ViewTransitionController.this.mMotionLayout.getChildAt(i);
|
||||
if (viewTransition.matchesView(childAt)) {
|
||||
int currentState = ViewTransitionController.this.mMotionLayout.getCurrentState();
|
||||
ConstraintSet constraintSet = ViewTransitionController.this.mMotionLayout.getConstraintSet(currentState);
|
||||
ViewTransition viewTransition2 = viewTransition;
|
||||
ViewTransitionController viewTransitionController = ViewTransitionController.this;
|
||||
viewTransition2.applyTransition(viewTransitionController, viewTransitionController.mMotionLayout, currentState, constraintSet, childAt);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (sharedValue != value) {
|
||||
int childCount2 = ViewTransitionController.this.mMotionLayout.getChildCount();
|
||||
for (int i2 = 0; i2 < childCount2; i2++) {
|
||||
View childAt2 = ViewTransitionController.this.mMotionLayout.getChildAt(i2);
|
||||
if (viewTransition.matchesView(childAt2)) {
|
||||
int currentState2 = ViewTransitionController.this.mMotionLayout.getCurrentState();
|
||||
ConstraintSet constraintSet2 = ViewTransitionController.this.mMotionLayout.getConstraintSet(currentState2);
|
||||
ViewTransition viewTransition3 = viewTransition;
|
||||
ViewTransitionController viewTransitionController2 = ViewTransitionController.this;
|
||||
viewTransition3.applyTransition(viewTransitionController2, viewTransitionController2.mMotionLayout, currentState2, constraintSet2, childAt2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user