content: package androidx.constraintlayout.utils.widget;
  
  import android.content.Context;
  import android.content.res.TypedArray;
  import android.graphics.Canvas;
  import android.graphics.Matrix;
  import android.graphics.Paint;
  import android.util.AttributeSet;
  import android.view.ViewParent;
  import androidx.constraintlayout.motion.widget.MotionLayout;
  import androidx.constraintlayout.widget.R;
  
  public class MotionTelltales extends MockView {
      private static final String TAG = "MotionTelltales";
      Matrix mInvertMatrix = new Matrix();
      MotionLayout mMotionLayout;
      private Paint mPaintTelltales = new Paint();
      int mTailColor = -65281;
      float mTailScale = 0.25f;
      int mVelocityMode = 0;
      float[] velocity = new float[2];
  
      public MotionTelltales(Context context) {
          super(context);
          init(context, (AttributeSet) null);
      }
  
      public MotionTelltales(Context context, AttributeSet attrs) {
          super(context, attrs);
          init(context, attrs);
      }
  
      public MotionTelltales(Context context, AttributeSet attrs, int defStyleAttr) {
          super(context, attrs, defStyleAttr);
          init(context, attrs);
      }
  
      private void init(Context context, AttributeSet attrs) {
          if (attrs != null) {
              TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attrs, R.styleable.MotionTelltales);
              int indexCount = obtainStyledAttributes.getIndexCount();
              for (int i = 0; i < indexCount; i++) {
                  int index = obtainStyledAttributes.getIndex(i);
                  if (index == R.styleable.MotionTelltales_telltales_tailColor) {
                      this.mTailColor = obtainStyledAttributes.getColor(index, this.mTailColor);
                  } else if (index == R.styleable.MotionTelltales_telltales_velocityMode) {
                      this.mVelocityMode = obtainStyledAttributes.getInt(index, this.mVelocityMode);
                  } else if (index == R.styleable.MotionTelltales_telltales_tailScale) {
                      this.mTailScale = obtainStyledAttributes.getFloat(index, this.mTailScale);
                  }
              }
              obtainStyledAttributes.recycle();
          }
          this.mPaintTelltales.setColor(this.mTailColor);
          this.mPaintTelltales.setStrokeWidth(5.0f);
      }
  
      /* access modifiers changed from: protected */
      public void onAttachedToWindow() {
          super.onAttachedToWindow();
      }
  
      public void onDraw(Canvas canvas) {
          super.onDraw(canvas);
          getMatrix().invert(this.mInvertMatrix);
          if (this.mMotionLayout == null) {
              ViewParent parent = getParent();
              if (parent instanceof MotionLayout) {
                  this.mMotionLayout = (MotionLayout) parent;
                  return;
              }
              return;
          }
          int width = getWidth();
          int height = getHeight();
          float[] fArr = {0.1f, 0.25f, 0.5f, 0.75f, 0.9f};
          for (float f : fArr) {
              for (float f2 : fArr) {
                  this.mMotionLayout.getViewVelocity(this, f2, f, this.velocity, this.mVelocityMode);
                  this.mInvertMatrix.mapVectors(this.velocity);
                  float f3 = ((float) width) * f2;
                  float f4 = ((float) height) * f;
                  float[] fArr2 = this.velocity;
                  float f5 = fArr2[0];
                  float f6 = this.mTailScale;
                  float f7 = f4 - (fArr2[1] * f6);
                  this.mInvertMatrix.mapVectors(fArr2);
                  canvas.drawLine(f3, f4, f3 - (f5 * f6), f7, this.mPaintTelltales);
              }
          }
      }
  
      /* access modifiers changed from: protected */
      public void onLayout(boolean changed, int left, int top, int right, int bottom) {
          super.onLayout(changed, left, top, right, bottom);
          postInvalidate();
      }
  
      public void setText(CharSequence text) {
          this.mText = text.toString();
          requestLayout();
      }
  }
  