392 lines
16 KiB
Java
392 lines
16 KiB
Java
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);
|
|
}
|
|
}
|