414 lines
		
	
	
		
			17 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
			
		
		
	
	
			414 lines
		
	
	
		
			17 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.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);
 | |
|     }
 | |
| }
 |