content: package androidx.constraintlayout.widget;
  
  import android.content.Context;
  import android.content.res.TypedArray;
  import android.graphics.Canvas;
  import android.util.AttributeSet;
  import android.view.View;
  import androidx.constraintlayout.motion.widget.MotionLayout;
  import androidx.constraintlayout.widget.ConstraintLayout;
  import androidx.constraintlayout.widget.SharedValues;
  
  public class ReactiveGuide extends View implements SharedValues.SharedValuesListener {
      private boolean mAnimateChange = false;
      private boolean mApplyToAllConstraintSets = true;
      private int mApplyToConstraintSetId = 0;
      private int mAttributeId = -1;
  
      public ReactiveGuide(Context context) {
          super(context);
          super.setVisibility(8);
          init((AttributeSet) null);
      }
  
      public ReactiveGuide(Context context, AttributeSet attrs) {
          super(context, attrs);
          super.setVisibility(8);
          init(attrs);
      }
  
      public ReactiveGuide(Context context, AttributeSet attrs, int defStyleAttr) {
          super(context, attrs, defStyleAttr);
          super.setVisibility(8);
          init(attrs);
      }
  
      public ReactiveGuide(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
          super(context, attrs, defStyleAttr);
          super.setVisibility(8);
          init(attrs);
      }
  
      private void changeValue(int newValue, int id, MotionLayout motionLayout, int currentState) {
          ConstraintSet constraintSet = motionLayout.getConstraintSet(currentState);
          constraintSet.setGuidelineEnd(id, newValue);
          motionLayout.updateState(currentState, constraintSet);
      }
  
      private void init(AttributeSet attrs) {
          if (attrs != null) {
              TypedArray obtainStyledAttributes = getContext().obtainStyledAttributes(attrs, R.styleable.ConstraintLayout_ReactiveGuide);
              int indexCount = obtainStyledAttributes.getIndexCount();
              for (int i = 0; i < indexCount; i++) {
                  int index = obtainStyledAttributes.getIndex(i);
                  if (index == R.styleable.ConstraintLayout_ReactiveGuide_reactiveGuide_valueId) {
                      this.mAttributeId = obtainStyledAttributes.getResourceId(index, this.mAttributeId);
                  } else if (index == R.styleable.ConstraintLayout_ReactiveGuide_reactiveGuide_animateChange) {
                      this.mAnimateChange = obtainStyledAttributes.getBoolean(index, this.mAnimateChange);
                  } else if (index == R.styleable.ConstraintLayout_ReactiveGuide_reactiveGuide_applyToConstraintSet) {
                      this.mApplyToConstraintSetId = obtainStyledAttributes.getResourceId(index, this.mApplyToConstraintSetId);
                  } else if (index == R.styleable.ConstraintLayout_ReactiveGuide_reactiveGuide_applyToAllConstraintSets) {
                      this.mApplyToAllConstraintSets = obtainStyledAttributes.getBoolean(index, this.mApplyToAllConstraintSets);
                  }
              }
              obtainStyledAttributes.recycle();
          }
          if (this.mAttributeId != -1) {
              ConstraintLayout.getSharedValues().addListener(this.mAttributeId, this);
          }
      }
  
      public void draw(Canvas canvas) {
      }
  
      public int getApplyToConstraintSetId() {
          return this.mApplyToConstraintSetId;
      }
  
      public int getAttributeId() {
          return this.mAttributeId;
      }
  
      public boolean isAnimatingChange() {
          return this.mAnimateChange;
      }
  
      /* access modifiers changed from: protected */
      public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
          setMeasuredDimension(0, 0);
      }
  
      public void onNewValue(int key, int newValue, int oldValue) {
          setGuidelineBegin(newValue);
          int id = getId();
          if (id > 0 && (getParent() instanceof MotionLayout)) {
              MotionLayout motionLayout = (MotionLayout) getParent();
              int currentState = motionLayout.getCurrentState();
              if (this.mApplyToConstraintSetId != 0) {
                  currentState = this.mApplyToConstraintSetId;
              }
              if (this.mAnimateChange) {
                  if (this.mApplyToAllConstraintSets) {
                      int[] constraintSetIds = motionLayout.getConstraintSetIds();
                      for (int i : constraintSetIds) {
                          if (i != currentState) {
                              changeValue(newValue, id, motionLayout, i);
                          }
                      }
                  }
                  ConstraintSet cloneConstraintSet = motionLayout.cloneConstraintSet(currentState);
                  cloneConstraintSet.setGuidelineEnd(id, newValue);
                  motionLayout.updateStateAnimate(currentState, cloneConstraintSet, 1000);
              } else if (this.mApplyToAllConstraintSets) {
                  int[] constraintSetIds2 = motionLayout.getConstraintSetIds();
                  for (int changeValue : constraintSetIds2) {
                      changeValue(newValue, id, motionLayout, changeValue);
                  }
              } else {
                  changeValue(newValue, id, motionLayout, currentState);
              }
          }
      }
  
      public void setAnimateChange(boolean animate) {
          this.mAnimateChange = animate;
      }
  
      public void setApplyToConstraintSetId(int id) {
          this.mApplyToConstraintSetId = id;
      }
  
      public void setAttributeId(int id) {
          SharedValues sharedValues = ConstraintLayout.getSharedValues();
          int i = this.mAttributeId;
          if (i != -1) {
              sharedValues.removeListener(i, this);
          }
          this.mAttributeId = id;
          if (id != -1) {
              sharedValues.addListener(id, this);
          }
      }
  
      public void setGuidelineBegin(int margin) {
          ConstraintLayout.LayoutParams layoutParams = (ConstraintLayout.LayoutParams) getLayoutParams();
          layoutParams.guideBegin = margin;
          setLayoutParams(layoutParams);
      }
  
      public void setGuidelineEnd(int margin) {
          ConstraintLayout.LayoutParams layoutParams = (ConstraintLayout.LayoutParams) getLayoutParams();
          layoutParams.guideEnd = margin;
          setLayoutParams(layoutParams);
      }
  
      public void setGuidelinePercent(float ratio) {
          ConstraintLayout.LayoutParams layoutParams = (ConstraintLayout.LayoutParams) getLayoutParams();
          layoutParams.guidePercent = ratio;
          setLayoutParams(layoutParams);
      }
  
      public void setVisibility(int visibility) {
      }
  }
  