content: package androidx.appcompat.widget;
  
  import android.content.res.ColorStateList;
  import android.graphics.Canvas;
  import android.graphics.PorterDuff;
  import android.graphics.drawable.Drawable;
  import android.util.AttributeSet;
  import android.widget.SeekBar;
  import androidx.appcompat.R;
  import androidx.core.graphics.drawable.DrawableCompat;
  import androidx.core.view.ViewCompat;
  
  class AppCompatSeekBarHelper extends AppCompatProgressBarHelper {
      private boolean mHasTickMarkTint = false;
      private boolean mHasTickMarkTintMode = false;
      private Drawable mTickMark;
      private ColorStateList mTickMarkTintList = null;
      private PorterDuff.Mode mTickMarkTintMode = null;
      private final SeekBar mView;
  
      AppCompatSeekBarHelper(SeekBar view) {
          super(view);
          this.mView = view;
      }
  
      private void applyTickMarkTint() {
          Drawable drawable = this.mTickMark;
          if (drawable == null) {
              return;
          }
          if (this.mHasTickMarkTint || this.mHasTickMarkTintMode) {
              Drawable wrap = DrawableCompat.wrap(drawable.mutate());
              this.mTickMark = wrap;
              if (this.mHasTickMarkTint) {
                  DrawableCompat.setTintList(wrap, this.mTickMarkTintList);
              }
              if (this.mHasTickMarkTintMode) {
                  DrawableCompat.setTintMode(this.mTickMark, this.mTickMarkTintMode);
              }
              if (this.mTickMark.isStateful()) {
                  this.mTickMark.setState(this.mView.getDrawableState());
              }
          }
      }
  
      /* access modifiers changed from: package-private */
      public void drawTickMarks(Canvas canvas) {
          if (this.mTickMark != null) {
              int max = this.mView.getMax();
              int i = 1;
              if (max > 1) {
                  int intrinsicWidth = this.mTickMark.getIntrinsicWidth();
                  int intrinsicHeight = this.mTickMark.getIntrinsicHeight();
                  int i2 = intrinsicWidth >= 0 ? intrinsicWidth / 2 : 1;
                  if (intrinsicHeight >= 0) {
                      i = intrinsicHeight / 2;
                  }
                  this.mTickMark.setBounds(-i2, -i, i2, i);
                  float width = ((float) ((this.mView.getWidth() - this.mView.getPaddingLeft()) - this.mView.getPaddingRight())) / ((float) max);
                  int save = canvas.save();
                  canvas.translate((float) this.mView.getPaddingLeft(), (float) (this.mView.getHeight() / 2));
                  for (int i3 = 0; i3 <= max; i3++) {
                      this.mTickMark.draw(canvas);
                      canvas.translate(width, 0.0f);
                  }
                  canvas.restoreToCount(save);
              }
          }
      }
  
      /* access modifiers changed from: package-private */
      public void drawableStateChanged() {
          Drawable drawable = this.mTickMark;
          if (drawable != null && drawable.isStateful() && drawable.setState(this.mView.getDrawableState())) {
              this.mView.invalidateDrawable(drawable);
          }
      }
  
      /* access modifiers changed from: package-private */
      public Drawable getTickMark() {
          return this.mTickMark;
      }
  
      /* access modifiers changed from: package-private */
      public ColorStateList getTickMarkTintList() {
          return this.mTickMarkTintList;
      }
  
      /* access modifiers changed from: package-private */
      public PorterDuff.Mode getTickMarkTintMode() {
          return this.mTickMarkTintMode;
      }
  
      /* access modifiers changed from: package-private */
      public void jumpDrawablesToCurrentState() {
          Drawable drawable = this.mTickMark;
          if (drawable != null) {
              drawable.jumpToCurrentState();
          }
      }
  
      /* access modifiers changed from: package-private */
      public void loadFromAttributes(AttributeSet attrs, int defStyleAttr) {
          super.loadFromAttributes(attrs, defStyleAttr);
          TintTypedArray obtainStyledAttributes = TintTypedArray.obtainStyledAttributes(this.mView.getContext(), attrs, R.styleable.AppCompatSeekBar, defStyleAttr, 0);
          SeekBar seekBar = this.mView;
          ViewCompat.saveAttributeDataForStyleable(seekBar, seekBar.getContext(), R.styleable.AppCompatSeekBar, attrs, obtainStyledAttributes.getWrappedTypeArray(), defStyleAttr, 0);
          Drawable drawableIfKnown = obtainStyledAttributes.getDrawableIfKnown(R.styleable.AppCompatSeekBar_android_thumb);
          if (drawableIfKnown != null) {
              this.mView.setThumb(drawableIfKnown);
          }
          setTickMark(obtainStyledAttributes.getDrawable(R.styleable.AppCompatSeekBar_tickMark));
          if (obtainStyledAttributes.hasValue(R.styleable.AppCompatSeekBar_tickMarkTintMode)) {
              this.mTickMarkTintMode = DrawableUtils.parseTintMode(obtainStyledAttributes.getInt(R.styleable.AppCompatSeekBar_tickMarkTintMode, -1), this.mTickMarkTintMode);
              this.mHasTickMarkTintMode = true;
          }
          if (obtainStyledAttributes.hasValue(R.styleable.AppCompatSeekBar_tickMarkTint)) {
              this.mTickMarkTintList = obtainStyledAttributes.getColorStateList(R.styleable.AppCompatSeekBar_tickMarkTint);
              this.mHasTickMarkTint = true;
          }
          obtainStyledAttributes.recycle();
          applyTickMarkTint();
      }
  
      /* access modifiers changed from: package-private */
      public void setTickMark(Drawable tickMark) {
          Drawable drawable = this.mTickMark;
          if (drawable != null) {
              drawable.setCallback((Drawable.Callback) null);
          }
          this.mTickMark = tickMark;
          if (tickMark != null) {
              tickMark.setCallback(this.mView);
              DrawableCompat.setLayoutDirection(tickMark, ViewCompat.getLayoutDirection(this.mView));
              if (tickMark.isStateful()) {
                  tickMark.setState(this.mView.getDrawableState());
              }
              applyTickMarkTint();
          }
          this.mView.invalidate();
      }
  
      /* access modifiers changed from: package-private */
      public void setTickMarkTintList(ColorStateList tint) {
          this.mTickMarkTintList = tint;
          this.mHasTickMarkTint = true;
          applyTickMarkTint();
      }
  
      /* access modifiers changed from: package-private */
      public void setTickMarkTintMode(PorterDuff.Mode tintMode) {
          this.mTickMarkTintMode = tintMode;
          this.mHasTickMarkTintMode = true;
          applyTickMarkTint();
      }
  }
  