133 lines
		
	
	
		
			4.5 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
			
		
		
	
	
			133 lines
		
	
	
		
			4.5 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
| 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++;
 | |
|         }
 | |
|     }
 | |
| }
 |