content: package androidx.appcompat.graphics.drawable;
  
  import android.content.Context;
  import android.content.res.TypedArray;
  import android.graphics.Canvas;
  import android.graphics.ColorFilter;
  import android.graphics.Paint;
  import android.graphics.Path;
  import android.graphics.Rect;
  import android.graphics.drawable.Drawable;
  import android.util.AttributeSet;
  import androidx.appcompat.R;
  import androidx.core.graphics.drawable.DrawableCompat;
  import java.lang.annotation.Retention;
  import java.lang.annotation.RetentionPolicy;
  
  public class DrawerArrowDrawable extends Drawable {
      public static final int ARROW_DIRECTION_END = 3;
      public static final int ARROW_DIRECTION_LEFT = 0;
      public static final int ARROW_DIRECTION_RIGHT = 1;
      public static final int ARROW_DIRECTION_START = 2;
      private static final float ARROW_HEAD_ANGLE = ((float) Math.toRadians(45.0d));
      private float mArrowHeadLength;
      private float mArrowShaftLength;
      private float mBarGap;
      private float mBarLength;
      private int mDirection = 2;
      private float mMaxCutForBarSize;
      private final Paint mPaint;
      private final Path mPath = new Path();
      private float mProgress;
      private final int mSize;
      private boolean mSpin;
      private boolean mVerticalMirror = false;
  
      @Retention(RetentionPolicy.SOURCE)
      public @interface ArrowDirection {
      }
  
      public DrawerArrowDrawable(Context context) {
          Paint paint = new Paint();
          this.mPaint = paint;
          paint.setStyle(Paint.Style.STROKE);
          paint.setStrokeJoin(Paint.Join.MITER);
          paint.setStrokeCap(Paint.Cap.BUTT);
          paint.setAntiAlias(true);
          TypedArray obtainStyledAttributes = context.getTheme().obtainStyledAttributes((AttributeSet) null, R.styleable.DrawerArrowToggle, R.attr.drawerArrowStyle, R.style.Base_Widget_AppCompat_DrawerArrowToggle);
          setColor(obtainStyledAttributes.getColor(R.styleable.DrawerArrowToggle_color, 0));
          setBarThickness(obtainStyledAttributes.getDimension(R.styleable.DrawerArrowToggle_thickness, 0.0f));
          setSpinEnabled(obtainStyledAttributes.getBoolean(R.styleable.DrawerArrowToggle_spinBars, true));
          setGapSize((float) Math.round(obtainStyledAttributes.getDimension(R.styleable.DrawerArrowToggle_gapBetweenBars, 0.0f)));
          this.mSize = obtainStyledAttributes.getDimensionPixelSize(R.styleable.DrawerArrowToggle_drawableSize, 0);
          this.mBarLength = (float) Math.round(obtainStyledAttributes.getDimension(R.styleable.DrawerArrowToggle_barLength, 0.0f));
          this.mArrowHeadLength = (float) Math.round(obtainStyledAttributes.getDimension(R.styleable.DrawerArrowToggle_arrowHeadLength, 0.0f));
          this.mArrowShaftLength = obtainStyledAttributes.getDimension(R.styleable.DrawerArrowToggle_arrowShaftLength, 0.0f);
          obtainStyledAttributes.recycle();
      }
  
      private static float lerp(float a, float b, float t) {
          return ((b - a) * t) + a;
      }
  
      public void draw(Canvas canvas) {
          boolean z;
          Canvas canvas2 = canvas;
          Rect bounds = getBounds();
          boolean z2 = false;
          switch (this.mDirection) {
              case 0:
                  z = false;
                  break;
              case 1:
                  z = true;
                  break;
              case 3:
                  if (DrawableCompat.getLayoutDirection(this) == 0) {
                      z2 = true;
                  }
                  z = z2;
                  break;
              default:
                  if (DrawableCompat.getLayoutDirection(this) == 1) {
                      z2 = true;
                  }
                  z = z2;
                  break;
          }
          float f = this.mArrowHeadLength;
          float lerp = lerp(this.mBarLength, (float) Math.sqrt((double) (f * f * 2.0f)), this.mProgress);
          float lerp2 = lerp(this.mBarLength, this.mArrowShaftLength, this.mProgress);
          float round = (float) Math.round(lerp(0.0f, this.mMaxCutForBarSize, this.mProgress));
          float lerp3 = lerp(0.0f, ARROW_HEAD_ANGLE, this.mProgress);
          float lerp4 = lerp(z ? 0.0f : -180.0f, z ? 180.0f : 0.0f, this.mProgress);
          float round2 = (float) Math.round(((double) lerp) * Math.cos((double) lerp3));
          float round3 = (float) Math.round(((double) lerp) * Math.sin((double) lerp3));
          this.mPath.rewind();
          float lerp5 = lerp(this.mBarGap + this.mPaint.getStrokeWidth(), -this.mMaxCutForBarSize, this.mProgress);
          float f2 = (-lerp2) / 2.0f;
          this.mPath.moveTo(f2 + round, 0.0f);
          this.mPath.rLineTo(lerp2 - (round * 2.0f), 0.0f);
          this.mPath.moveTo(f2, lerp5);
          this.mPath.rLineTo(round2, round3);
          this.mPath.moveTo(f2, -lerp5);
          this.mPath.rLineTo(round2, -round3);
          this.mPath.close();
          canvas.save();
          float strokeWidth = this.mPaint.getStrokeWidth();
          float height = ((float) bounds.height()) - (3.0f * strokeWidth);
          float f3 = this.mBarGap;
          canvas2.translate((float) bounds.centerX(), ((float) ((((int) (height - (2.0f * f3))) / 4) * 2)) + (1.5f * strokeWidth) + f3);
          if (this.mSpin) {
              canvas2.rotate(((float) (this.mVerticalMirror ^ z ? -1 : 1)) * lerp4);
          } else if (z) {
              canvas2.rotate(180.0f);
          }
          Rect rect = bounds;
          canvas2.drawPath(this.mPath, this.mPaint);
          canvas.restore();
      }
  
      public float getArrowHeadLength() {
          return this.mArrowHeadLength;
      }
  
      public float getArrowShaftLength() {
          return this.mArrowShaftLength;
      }
  
      public float getBarLength() {
          return this.mBarLength;
      }
  
      public float getBarThickness() {
          return this.mPaint.getStrokeWidth();
      }
  
      public int getColor() {
          return this.mPaint.getColor();
      }
  
      public int getDirection() {
          return this.mDirection;
      }
  
      public float getGapSize() {
          return this.mBarGap;
      }
  
      public int getIntrinsicHeight() {
          return this.mSize;
      }
  
      public int getIntrinsicWidth() {
          return this.mSize;
      }
  
      public int getOpacity() {
          return -3;
      }
  
      public final Paint getPaint() {
          return this.mPaint;
      }
  
      public float getProgress() {
          return this.mProgress;
      }
  
      public boolean isSpinEnabled() {
          return this.mSpin;
      }
  
      public void setAlpha(int alpha) {
          if (alpha != this.mPaint.getAlpha()) {
              this.mPaint.setAlpha(alpha);
              invalidateSelf();
          }
      }
  
      public void setArrowHeadLength(float length) {
          if (this.mArrowHeadLength != length) {
              this.mArrowHeadLength = length;
              invalidateSelf();
          }
      }
  
      public void setArrowShaftLength(float length) {
          if (this.mArrowShaftLength != length) {
              this.mArrowShaftLength = length;
              invalidateSelf();
          }
      }
  
      public void setBarLength(float length) {
          if (this.mBarLength != length) {
              this.mBarLength = length;
              invalidateSelf();
          }
      }
  
      public void setBarThickness(float width) {
          if (this.mPaint.getStrokeWidth() != width) {
              this.mPaint.setStrokeWidth(width);
              this.mMaxCutForBarSize = (float) (((double) (width / 2.0f)) * Math.cos((double) ARROW_HEAD_ANGLE));
              invalidateSelf();
          }
      }
  
      public void setColor(int color) {
          if (color != this.mPaint.getColor()) {
              this.mPaint.setColor(color);
              invalidateSelf();
          }
      }
  
      public void setColorFilter(ColorFilter colorFilter) {
          this.mPaint.setColorFilter(colorFilter);
          invalidateSelf();
      }
  
      public void setDirection(int direction) {
          if (direction != this.mDirection) {
              this.mDirection = direction;
              invalidateSelf();
          }
      }
  
      public void setGapSize(float gap) {
          if (gap != this.mBarGap) {
              this.mBarGap = gap;
              invalidateSelf();
          }
      }
  
      public void setProgress(float progress) {
          if (this.mProgress != progress) {
              this.mProgress = progress;
              invalidateSelf();
          }
      }
  
      public void setSpinEnabled(boolean enabled) {
          if (this.mSpin != enabled) {
              this.mSpin = enabled;
              invalidateSelf();
          }
      }
  
      public void setVerticalMirror(boolean verticalMirror) {
          if (this.mVerticalMirror != verticalMirror) {
              this.mVerticalMirror = verticalMirror;
              invalidateSelf();
          }
      }
  }
  