content: package com.google.android.material.slider;
  
  import android.animation.Animator;
  import android.animation.AnimatorListenerAdapter;
  import android.animation.ValueAnimator;
  import android.content.Context;
  import android.content.res.ColorStateList;
  import android.content.res.Resources;
  import android.content.res.TypedArray;
  import android.graphics.Canvas;
  import android.graphics.Paint;
  import android.graphics.PorterDuff;
  import android.graphics.PorterDuffXfermode;
  import android.graphics.Rect;
  import android.graphics.Region;
  import android.graphics.drawable.Drawable;
  import android.graphics.drawable.RippleDrawable;
  import android.os.Build;
  import android.os.Bundle;
  import android.os.Parcel;
  import android.os.Parcelable;
  import android.util.AttributeSet;
  import android.util.Log;
  import android.view.KeyEvent;
  import android.view.MotionEvent;
  import android.view.View;
  import android.view.ViewConfiguration;
  import android.view.ViewGroup;
  import android.view.ViewParent;
  import android.view.accessibility.AccessibilityManager;
  import android.widget.SeekBar;
  import androidx.appcompat.content.res.AppCompatResources;
  import androidx.constraintlayout.core.widgets.analyzer.BasicMeasure;
  import androidx.constraintlayout.widget.ConstraintLayout;
  import androidx.core.graphics.drawable.DrawableCompat;
  import androidx.core.math.MathUtils;
  import androidx.core.view.ViewCompat;
  import androidx.core.view.accessibility.AccessibilityNodeInfoCompat;
  import androidx.customview.widget.ExploreByTouchHelper;
  import com.google.android.material.R;
  import com.google.android.material.animation.AnimationUtils;
  import com.google.android.material.drawable.DrawableUtils;
  import com.google.android.material.internal.DescendantOffsetUtils;
  import com.google.android.material.internal.ThemeEnforcement;
  import com.google.android.material.internal.ViewOverlayImpl;
  import com.google.android.material.internal.ViewUtils;
  import com.google.android.material.resources.MaterialResources;
  import com.google.android.material.shape.MaterialShapeDrawable;
  import com.google.android.material.shape.ShapeAppearanceModel;
  import com.google.android.material.slider.BaseOnChangeListener;
  import com.google.android.material.slider.BaseOnSliderTouchListener;
  import com.google.android.material.slider.BaseSlider;
  import com.google.android.material.theme.overlay.MaterialThemeOverlay;
  import com.google.android.material.tooltip.TooltipDrawable;
  import java.math.BigDecimal;
  import java.math.MathContext;
  import java.util.ArrayList;
  import java.util.Collections;
  import java.util.Iterator;
  import java.util.List;
  import kotlinx.coroutines.internal.LockFreeTaskQueueCore;
  import mt.Log1F380D;
  import okhttp3.HttpUrl;
  
  /* compiled from: 00FB */
  abstract class BaseSlider<S extends BaseSlider<S, L, T>, L extends BaseOnChangeListener<S>, T extends BaseOnSliderTouchListener<S>> extends View {
      static final int DEF_STYLE_RES = R.style.Widget_MaterialComponents_Slider;
      private static final String EXCEPTION_ILLEGAL_DISCRETE_VALUE = "Value(%s) must be equal to valueFrom(%s) plus a multiple of stepSize(%s) when using stepSize(%s)";
      private static final String EXCEPTION_ILLEGAL_MIN_SEPARATION = "minSeparation(%s) must be greater or equal to 0";
      private static final String EXCEPTION_ILLEGAL_MIN_SEPARATION_STEP_SIZE = "minSeparation(%s) must be greater or equal and a multiple of stepSize(%s) when using stepSize(%s)";
      private static final String EXCEPTION_ILLEGAL_MIN_SEPARATION_STEP_SIZE_UNIT = "minSeparation(%s) cannot be set as a dimension when using stepSize(%s)";
      private static final String EXCEPTION_ILLEGAL_STEP_SIZE = "The stepSize(%s) must be 0, or a factor of the valueFrom(%s)-valueTo(%s) range";
      private static final String EXCEPTION_ILLEGAL_VALUE = "Slider value(%s) must be greater or equal to valueFrom(%s), and lower or equal to valueTo(%s)";
      private static final String EXCEPTION_ILLEGAL_VALUE_FROM = "valueFrom(%s) must be smaller than valueTo(%s)";
      private static final String EXCEPTION_ILLEGAL_VALUE_TO = "valueTo(%s) must be greater than valueFrom(%s)";
      private static final int HALO_ALPHA = 63;
      private static final long LABEL_ANIMATION_ENTER_DURATION = 83;
      private static final long LABEL_ANIMATION_EXIT_DURATION = 117;
      private static final String TAG = BaseSlider.class.getSimpleName();
      private static final double THRESHOLD = 1.0E-4d;
      private static final int TIMEOUT_SEND_ACCESSIBILITY_EVENT = 200;
      static final int UNIT_PX = 0;
      static final int UNIT_VALUE = 1;
      private static final String WARNING_FLOATING_POINT_ERROR = "Floating point value used for %s(%s). Using floats can have rounding errors which may result in incorrect values. Instead, consider using integers with a custom LabelFormatter to display the value correctly.";
      private BaseSlider<S, L, T>.AccessibilityEventSender accessibilityEventSender;
      /* access modifiers changed from: private */
      public final AccessibilityHelper accessibilityHelper;
      private final AccessibilityManager accessibilityManager;
      private int activeThumbIdx;
      private final Paint activeTicksPaint;
      private final Paint activeTrackPaint;
      private final List<L> changeListeners;
      private Drawable customThumbDrawable;
      private List<Drawable> customThumbDrawablesForValues;
      private final MaterialShapeDrawable defaultThumbDrawable;
      private int defaultThumbRadius;
      private boolean dirtyConfig;
      private int focusedThumbIdx;
      private boolean forceDrawCompatHalo;
      private LabelFormatter formatter;
      private ColorStateList haloColor;
      private final Paint haloPaint;
      private int haloRadius;
      private final Paint inactiveTicksPaint;
      private final Paint inactiveTrackPaint;
      private boolean isLongPress;
      private int labelBehavior;
      private final TooltipDrawableFactory labelMaker;
      private int labelPadding;
      /* access modifiers changed from: private */
      public final List<TooltipDrawable> labels;
      private boolean labelsAreAnimatedIn;
      private ValueAnimator labelsInAnimator;
      private ValueAnimator labelsOutAnimator;
      private MotionEvent lastEvent;
      private int minTrackSidePadding;
      private final int scaledTouchSlop;
      private int separationUnit;
      private float stepSize;
      private boolean thumbIsPressed;
      private final Paint thumbPaint;
      private int thumbRadius;
      private ColorStateList tickColorActive;
      private ColorStateList tickColorInactive;
      private boolean tickVisible;
      private float[] ticksCoordinates;
      private float touchDownX;
      private final List<T> touchListeners;
      private float touchPosition;
      private ColorStateList trackColorActive;
      private ColorStateList trackColorInactive;
      private int trackHeight;
      private int trackSidePadding;
      private int trackTop;
      private int trackWidth;
      private float valueFrom;
      private float valueTo;
      private ArrayList<Float> values;
      private int widgetHeight;
  
      private class AccessibilityEventSender implements Runnable {
          int virtualViewId;
  
          private AccessibilityEventSender() {
              this.virtualViewId = -1;
          }
  
          public void run() {
              BaseSlider.this.accessibilityHelper.sendEventForVirtualView(this.virtualViewId, 4);
          }
  
          /* access modifiers changed from: package-private */
          public void setVirtualViewId(int virtualViewId2) {
              this.virtualViewId = virtualViewId2;
          }
      }
  
      /* compiled from: 00FA */
      private static class AccessibilityHelper extends ExploreByTouchHelper {
          private final BaseSlider<?, ?, ?> slider;
          final Rect virtualViewBounds = new Rect();
  
          AccessibilityHelper(BaseSlider<?, ?, ?> baseSlider) {
              super(baseSlider);
              this.slider = baseSlider;
          }
  
          private String startOrEndDescription(int virtualViewId) {
              return virtualViewId == this.slider.getValues().size() + -1 ? this.slider.getContext().getString(R.string.material_slider_range_end) : virtualViewId == 0 ? this.slider.getContext().getString(R.string.material_slider_range_start) : HttpUrl.FRAGMENT_ENCODE_SET;
          }
  
          /* access modifiers changed from: protected */
          public int getVirtualViewAt(float x, float y) {
              for (int i = 0; i < this.slider.getValues().size(); i++) {
                  this.slider.updateBoundsForVirturalViewId(i, this.virtualViewBounds);
                  if (this.virtualViewBounds.contains((int) x, (int) y)) {
                      return i;
                  }
              }
              return -1;
          }
  
          /* access modifiers changed from: protected */
          public void getVisibleVirtualViews(List<Integer> list) {
              for (int i = 0; i < this.slider.getValues().size(); i++) {
                  list.add(Integer.valueOf(i));
              }
          }
  
          /* access modifiers changed from: protected */
          public boolean onPerformActionForVirtualView(int virtualViewId, int action, Bundle arguments) {
              if (!this.slider.isEnabled()) {
                  return false;
              }
              switch (action) {
                  case 4096:
                  case 8192:
                      float access$800 = this.slider.calculateStepIncrement(20);
                      if (action == 8192) {
                          access$800 = -access$800;
                      }
                      if (this.slider.isRtl()) {
                          access$800 = -access$800;
                      }
                      if (!this.slider.snapThumbToValue(virtualViewId, MathUtils.clamp(this.slider.getValues().get(virtualViewId).floatValue() + access$800, this.slider.getValueFrom(), this.slider.getValueTo()))) {
                          return false;
                      }
                      this.slider.updateHaloHotspot();
                      this.slider.postInvalidate();
                      invalidateVirtualView(virtualViewId);
                      return true;
                  case 16908349:
                      if (arguments == null || !arguments.containsKey(AccessibilityNodeInfoCompat.ACTION_ARGUMENT_PROGRESS_VALUE)) {
                          return false;
                      }
                      if (!this.slider.snapThumbToValue(virtualViewId, arguments.getFloat(AccessibilityNodeInfoCompat.ACTION_ARGUMENT_PROGRESS_VALUE))) {
                          return false;
                      }
                      this.slider.updateHaloHotspot();
                      this.slider.postInvalidate();
                      invalidateVirtualView(virtualViewId);
                      return true;
                  default:
                      return false;
              }
          }
  
          /* access modifiers changed from: protected */
          public void onPopulateNodeForVirtualView(int virtualViewId, AccessibilityNodeInfoCompat info) {
              info.addAction(AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_SET_PROGRESS);
              List<Float> values = this.slider.getValues();
              float floatValue = values.get(virtualViewId).floatValue();
              float valueFrom = this.slider.getValueFrom();
              float valueTo = this.slider.getValueTo();
              if (this.slider.isEnabled()) {
                  if (floatValue > valueFrom) {
                      info.addAction(8192);
                  }
                  if (floatValue < valueTo) {
                      info.addAction(4096);
                  }
              }
              info.setRangeInfo(AccessibilityNodeInfoCompat.RangeInfoCompat.obtain(1, valueFrom, valueTo, floatValue));
              info.setClassName(SeekBar.class.getName());
              StringBuilder sb = new StringBuilder();
              if (this.slider.getContentDescription() != null) {
                  sb.append(this.slider.getContentDescription()).append(",");
              }
              if (values.size() > 1) {
                  sb.append(startOrEndDescription(virtualViewId));
                  String access$500 = this.slider.formatValue(floatValue);
                  Log1F380D.a((Object) access$500);
                  sb.append(access$500);
              }
              info.setContentDescription(sb.toString());
              this.slider.updateBoundsForVirturalViewId(virtualViewId, this.virtualViewBounds);
              info.setBoundsInParent(this.virtualViewBounds);
          }
      }
  
      static class SliderState extends View.BaseSavedState {
          public static final Parcelable.Creator<SliderState> CREATOR = new Parcelable.Creator<SliderState>() {
              public SliderState createFromParcel(Parcel source) {
                  return new SliderState(source);
              }
  
              public SliderState[] newArray(int size) {
                  return new SliderState[size];
              }
          };
          boolean hasFocus;
          float stepSize;
          float valueFrom;
          float valueTo;
          ArrayList<Float> values;
  
          private SliderState(Parcel source) {
              super(source);
              this.valueFrom = source.readFloat();
              this.valueTo = source.readFloat();
              ArrayList<Float> arrayList = new ArrayList<>();
              this.values = arrayList;
              source.readList(arrayList, Float.class.getClassLoader());
              this.stepSize = source.readFloat();
              this.hasFocus = source.createBooleanArray()[0];
          }
  
          SliderState(Parcelable superState) {
              super(superState);
          }
  
          public void writeToParcel(Parcel dest, int flags) {
              super.writeToParcel(dest, flags);
              dest.writeFloat(this.valueFrom);
              dest.writeFloat(this.valueTo);
              dest.writeList(this.values);
              dest.writeFloat(this.stepSize);
              dest.writeBooleanArray(new boolean[]{this.hasFocus});
          }
      }
  
      private interface TooltipDrawableFactory {
          TooltipDrawable createTooltipDrawable();
      }
  
      public BaseSlider(Context context) {
          this(context, (AttributeSet) null);
      }
  
      public BaseSlider(Context context, AttributeSet attrs) {
          this(context, attrs, R.attr.sliderStyle);
      }
  
      public BaseSlider(Context context, final AttributeSet attrs, final int defStyleAttr) {
          super(MaterialThemeOverlay.wrap(context, attrs, defStyleAttr, DEF_STYLE_RES), attrs, defStyleAttr);
          this.labels = new ArrayList();
          this.changeListeners = new ArrayList();
          this.touchListeners = new ArrayList();
          this.labelsAreAnimatedIn = false;
          this.thumbIsPressed = false;
          this.values = new ArrayList<>();
          this.activeThumbIdx = -1;
          this.focusedThumbIdx = -1;
          this.stepSize = 0.0f;
          this.tickVisible = true;
          this.isLongPress = false;
          MaterialShapeDrawable materialShapeDrawable = new MaterialShapeDrawable();
          this.defaultThumbDrawable = materialShapeDrawable;
          this.customThumbDrawablesForValues = Collections.emptyList();
          this.separationUnit = 0;
          Context context2 = getContext();
          Paint paint = new Paint();
          this.inactiveTrackPaint = paint;
          paint.setStyle(Paint.Style.STROKE);
          paint.setStrokeCap(Paint.Cap.ROUND);
          Paint paint2 = new Paint();
          this.activeTrackPaint = paint2;
          paint2.setStyle(Paint.Style.STROKE);
          paint2.setStrokeCap(Paint.Cap.ROUND);
          Paint paint3 = new Paint(1);
          this.thumbPaint = paint3;
          paint3.setStyle(Paint.Style.FILL);
          paint3.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
          Paint paint4 = new Paint(1);
          this.haloPaint = paint4;
          paint4.setStyle(Paint.Style.FILL);
          Paint paint5 = new Paint();
          this.inactiveTicksPaint = paint5;
          paint5.setStyle(Paint.Style.STROKE);
          paint5.setStrokeCap(Paint.Cap.ROUND);
          Paint paint6 = new Paint();
          this.activeTicksPaint = paint6;
          paint6.setStyle(Paint.Style.STROKE);
          paint6.setStrokeCap(Paint.Cap.ROUND);
          loadResources(context2.getResources());
          this.labelMaker = new TooltipDrawableFactory() {
              public TooltipDrawable createTooltipDrawable() {
                  TypedArray obtainStyledAttributes = ThemeEnforcement.obtainStyledAttributes(BaseSlider.this.getContext(), attrs, R.styleable.Slider, defStyleAttr, BaseSlider.DEF_STYLE_RES, new int[0]);
                  TooltipDrawable access$000 = BaseSlider.parseLabelDrawable(BaseSlider.this.getContext(), obtainStyledAttributes);
                  obtainStyledAttributes.recycle();
                  return access$000;
              }
          };
          processAttributes(context2, attrs, defStyleAttr);
          setFocusable(true);
          setClickable(true);
          materialShapeDrawable.setShadowCompatibilityMode(2);
          this.scaledTouchSlop = ViewConfiguration.get(context2).getScaledTouchSlop();
          AccessibilityHelper accessibilityHelper2 = new AccessibilityHelper(this);
          this.accessibilityHelper = accessibilityHelper2;
          ViewCompat.setAccessibilityDelegate(this, accessibilityHelper2);
          this.accessibilityManager = (AccessibilityManager) getContext().getSystemService("accessibility");
      }
  
      private void adjustCustomThumbDrawableBounds(Drawable drawable) {
          int i = this.thumbRadius * 2;
          int intrinsicWidth = drawable.getIntrinsicWidth();
          int intrinsicHeight = drawable.getIntrinsicHeight();
          if (intrinsicWidth == -1 && intrinsicHeight == -1) {
              drawable.setBounds(0, 0, i, i);
              return;
          }
          float max = ((float) i) / ((float) Math.max(intrinsicWidth, intrinsicHeight));
          drawable.setBounds(0, 0, (int) (((float) intrinsicWidth) * max), (int) (((float) intrinsicHeight) * max));
      }
  
      private void attachLabelToContentView(TooltipDrawable label) {
          label.setRelativeToView(ViewUtils.getContentView(this));
      }
  
      private Float calculateIncrementForKey(int keyCode) {
          float calculateStepIncrement = this.isLongPress ? calculateStepIncrement(20) : calculateStepIncrement();
          switch (keyCode) {
              case 21:
                  return Float.valueOf(isRtl() ? calculateStepIncrement : -calculateStepIncrement);
              case 22:
                  return Float.valueOf(isRtl() ? -calculateStepIncrement : calculateStepIncrement);
              case 69:
                  return Float.valueOf(-calculateStepIncrement);
              case 70:
              case 81:
                  return Float.valueOf(calculateStepIncrement);
              default:
                  return null;
          }
      }
  
      private float calculateStepIncrement() {
          float f = this.stepSize;
          if (f == 0.0f) {
              return 1.0f;
          }
          return f;
      }
  
      /* access modifiers changed from: private */
      public float calculateStepIncrement(int stepFactor) {
          float calculateStepIncrement = calculateStepIncrement();
          float f = (this.valueTo - this.valueFrom) / calculateStepIncrement;
          return f <= ((float) stepFactor) ? calculateStepIncrement : ((float) Math.round(f / ((float) stepFactor))) * calculateStepIncrement;
      }
  
      private int calculateTop() {
          int i = this.trackTop;
          int i2 = 0;
          if (this.labelBehavior == 1 || shouldAlwaysShowLabel()) {
              i2 = this.labels.get(0).getIntrinsicHeight();
          }
          return i + i2;
      }
  
      private ValueAnimator createLabelAnimator(boolean enter) {
          float f = 0.0f;
          float animatorCurrentValueOrDefault = getAnimatorCurrentValueOrDefault(enter ? this.labelsOutAnimator : this.labelsInAnimator, enter ? 0.0f : 1.0f);
          if (enter) {
              f = 1.0f;
          }
          ValueAnimator ofFloat = ValueAnimator.ofFloat(new float[]{animatorCurrentValueOrDefault, f});
          ofFloat.setDuration(enter ? LABEL_ANIMATION_ENTER_DURATION : LABEL_ANIMATION_EXIT_DURATION);
          ofFloat.setInterpolator(enter ? AnimationUtils.DECELERATE_INTERPOLATOR : AnimationUtils.FAST_OUT_LINEAR_IN_INTERPOLATOR);
          ofFloat.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
              public void onAnimationUpdate(ValueAnimator animation) {
                  float floatValue = ((Float) animation.getAnimatedValue()).floatValue();
                  for (TooltipDrawable revealFraction : BaseSlider.this.labels) {
                      revealFraction.setRevealFraction(floatValue);
                  }
                  ViewCompat.postInvalidateOnAnimation(BaseSlider.this);
              }
          });
          return ofFloat;
      }
  
      private void createLabelPool() {
          if (this.labels.size() > this.values.size()) {
              List<TooltipDrawable> subList = this.labels.subList(this.values.size(), this.labels.size());
              for (TooltipDrawable next : subList) {
                  if (ViewCompat.isAttachedToWindow(this)) {
                      detachLabelFromContentView(next);
                  }
              }
              subList.clear();
          }
          while (this.labels.size() < this.values.size()) {
              TooltipDrawable createTooltipDrawable = this.labelMaker.createTooltipDrawable();
              this.labels.add(createTooltipDrawable);
              if (ViewCompat.isAttachedToWindow(this)) {
                  attachLabelToContentView(createTooltipDrawable);
              }
          }
          int i = 1;
          if (this.labels.size() == 1) {
              i = 0;
          }
          int i2 = i;
          for (TooltipDrawable strokeWidth : this.labels) {
              strokeWidth.setStrokeWidth((float) i2);
          }
      }
  
      private void detachLabelFromContentView(TooltipDrawable label) {
          ViewOverlayImpl contentViewOverlay = ViewUtils.getContentViewOverlay(this);
          if (contentViewOverlay != null) {
              contentViewOverlay.remove(label);
              label.detachView(ViewUtils.getContentView(this));
          }
      }
  
      private float dimenToValue(float dimen) {
          if (dimen == 0.0f) {
              return 0.0f;
          }
          float f = (dimen - ((float) this.trackSidePadding)) / ((float) this.trackWidth);
          float f2 = this.valueFrom;
          return (f * (f2 - this.valueTo)) + f2;
      }
  
      private void dispatchOnChangedFromUser(int idx) {
          for (L onValueChange : this.changeListeners) {
              onValueChange.onValueChange(this, this.values.get(idx).floatValue(), true);
          }
          AccessibilityManager accessibilityManager2 = this.accessibilityManager;
          if (accessibilityManager2 != null && accessibilityManager2.isEnabled()) {
              scheduleAccessibilityEventSender(idx);
          }
      }
  
      private void dispatchOnChangedProgrammatically() {
          for (L l : this.changeListeners) {
              Iterator<Float> it = this.values.iterator();
              while (it.hasNext()) {
                  l.onValueChange(this, it.next().floatValue(), false);
              }
          }
      }
  
      private void drawActiveTrack(Canvas canvas, int width, int top) {
          float[] activeRange = getActiveRange();
          int i = this.trackSidePadding;
          float f = ((float) i) + (activeRange[1] * ((float) width));
          canvas.drawLine(((float) i) + (activeRange[0] * ((float) width)), (float) top, f, (float) top, this.activeTrackPaint);
      }
  
      private void drawInactiveTrack(Canvas canvas, int width, int top) {
          float[] activeRange = getActiveRange();
          int i = this.trackSidePadding;
          float f = ((float) i) + (activeRange[1] * ((float) width));
          if (f < ((float) (i + width))) {
              canvas.drawLine(f, (float) top, (float) (i + width), (float) top, this.inactiveTrackPaint);
          }
          int i2 = this.trackSidePadding;
          float f2 = ((float) i2) + (activeRange[0] * ((float) width));
          if (f2 > ((float) i2)) {
              canvas.drawLine((float) i2, (float) top, f2, (float) top, this.inactiveTrackPaint);
          }
      }
  
      private void drawThumbDrawable(Canvas canvas, int width, int top, float value, Drawable thumbDrawable) {
          canvas.save();
          canvas.translate(((float) (this.trackSidePadding + ((int) (normalizeValue(value) * ((float) width))))) - (((float) thumbDrawable.getBounds().width()) / 2.0f), ((float) top) - (((float) thumbDrawable.getBounds().height()) / 2.0f));
          thumbDrawable.draw(canvas);
          canvas.restore();
      }
  
      private void drawThumbs(Canvas canvas, int width, int top) {
          for (int i = 0; i < this.values.size(); i++) {
              float floatValue = this.values.get(i).floatValue();
              Drawable drawable = this.customThumbDrawable;
              if (drawable != null) {
                  drawThumbDrawable(canvas, width, top, floatValue, drawable);
              } else if (i < this.customThumbDrawablesForValues.size()) {
                  drawThumbDrawable(canvas, width, top, floatValue, this.customThumbDrawablesForValues.get(i));
              } else {
                  if (!isEnabled()) {
                      canvas.drawCircle(((float) this.trackSidePadding) + (normalizeValue(floatValue) * ((float) width)), (float) top, (float) this.thumbRadius, this.thumbPaint);
                  }
                  drawThumbDrawable(canvas, width, top, floatValue, this.defaultThumbDrawable);
              }
          }
      }
  
      private void ensureLabelsAdded() {
          if (this.labelBehavior != 2) {
              if (!this.labelsAreAnimatedIn) {
                  this.labelsAreAnimatedIn = true;
                  ValueAnimator createLabelAnimator = createLabelAnimator(true);
                  this.labelsInAnimator = createLabelAnimator;
                  this.labelsOutAnimator = null;
                  createLabelAnimator.start();
              }
              Iterator<TooltipDrawable> it = this.labels.iterator();
              for (int i = 0; i < this.values.size() && it.hasNext(); i++) {
                  if (i != this.focusedThumbIdx) {
                      setValueForLabel(it.next(), this.values.get(i).floatValue());
                  }
              }
              if (it.hasNext()) {
                  setValueForLabel(it.next(), this.values.get(this.focusedThumbIdx).floatValue());
                  return;
              }
              String format = String.format("Not enough labels(%d) to display all the values(%d)", new Object[]{Integer.valueOf(this.labels.size()), Integer.valueOf(this.values.size())});
              Log1F380D.a((Object) format);
              throw new IllegalStateException(format);
          }
      }
  
      private void ensureLabelsRemoved() {
          if (this.labelsAreAnimatedIn) {
              this.labelsAreAnimatedIn = false;
              ValueAnimator createLabelAnimator = createLabelAnimator(false);
              this.labelsOutAnimator = createLabelAnimator;
              this.labelsInAnimator = null;
              createLabelAnimator.addListener(new AnimatorListenerAdapter() {
                  public void onAnimationEnd(Animator animation) {
                      super.onAnimationEnd(animation);
                      for (TooltipDrawable remove : BaseSlider.this.labels) {
                          ViewUtils.getContentViewOverlay(BaseSlider.this).remove(remove);
                      }
                  }
              });
              this.labelsOutAnimator.start();
          }
      }
  
      private void focusThumbOnFocusGained(int direction) {
          switch (direction) {
              case 1:
                  moveFocus(Integer.MAX_VALUE);
                  return;
              case 2:
                  moveFocus(Integer.MIN_VALUE);
                  return;
              case 17:
                  moveFocusInAbsoluteDirection(Integer.MAX_VALUE);
                  return;
              case ConstraintLayout.LayoutParams.Table.LAYOUT_WRAP_BEHAVIOR_IN_PARENT:
                  moveFocusInAbsoluteDirection(Integer.MIN_VALUE);
                  return;
              default:
                  return;
          }
      }
  
      private float[] getActiveRange() {
          float floatValue = ((Float) Collections.max(getValues())).floatValue();
          float normalizeValue = normalizeValue(this.values.size() == 1 ? this.valueFrom : ((Float) Collections.min(getValues())).floatValue());
          float normalizeValue2 = normalizeValue(floatValue);
          if (isRtl()) {
              return new float[]{normalizeValue2, normalizeValue};
          }
          return new float[]{normalizeValue, normalizeValue2};
      }
  
      private static float getAnimatorCurrentValueOrDefault(ValueAnimator animator, float defaultValue) {
          if (animator == null || !animator.isRunning()) {
              return defaultValue;
          }
          float floatValue = ((Float) animator.getAnimatedValue()).floatValue();
          animator.cancel();
          return floatValue;
      }
  
      private float getClampedValue(int idx, float value) {
          float minSeparation = getMinSeparation();
          float dimenToValue = this.separationUnit == 0 ? dimenToValue(minSeparation) : minSeparation;
          if (isRtl()) {
              dimenToValue = -dimenToValue;
          }
          return MathUtils.clamp(value, idx + -1 < 0 ? this.valueFrom : this.values.get(idx - 1).floatValue() + dimenToValue, idx + 1 >= this.values.size() ? this.valueTo : this.values.get(idx + 1).floatValue() - dimenToValue);
      }
  
      private int getColorForState(ColorStateList colorStateList) {
          return colorStateList.getColorForState(getDrawableState(), colorStateList.getDefaultColor());
      }
  
      private float getValueOfTouchPosition() {
          double snapPosition = snapPosition(this.touchPosition);
          if (isRtl()) {
              snapPosition = 1.0d - snapPosition;
          }
          float f = this.valueTo;
          float f2 = this.valueFrom;
          return (float) ((((double) (f - f2)) * snapPosition) + ((double) f2));
      }
  
      private float getValueOfTouchPositionAbsolute() {
          float f = this.touchPosition;
          if (isRtl()) {
              f = 1.0f - f;
          }
          float f2 = this.valueTo;
          float f3 = this.valueFrom;
          return ((f2 - f3) * f) + f3;
      }
  
      private Drawable initializeCustomThumbDrawable(Drawable originalDrawable) {
          Drawable newDrawable = originalDrawable.mutate().getConstantState().newDrawable();
          adjustCustomThumbDrawableBounds(newDrawable);
          return newDrawable;
      }
  
      private void invalidateTrack() {
          this.inactiveTrackPaint.setStrokeWidth((float) this.trackHeight);
          this.activeTrackPaint.setStrokeWidth((float) this.trackHeight);
          this.inactiveTicksPaint.setStrokeWidth(((float) this.trackHeight) / 2.0f);
          this.activeTicksPaint.setStrokeWidth(((float) this.trackHeight) / 2.0f);
      }
  
      private boolean isInVerticalScrollingContainer() {
          ViewParent parent = getParent();
          while (true) {
              boolean z = false;
              if (!(parent instanceof ViewGroup)) {
                  return false;
              }
              ViewGroup viewGroup = (ViewGroup) parent;
              if (viewGroup.canScrollVertically(1) || viewGroup.canScrollVertically(-1)) {
                  z = true;
              }
              if (z && viewGroup.shouldDelayChildPressedState()) {
                  return true;
              }
              parent = parent.getParent();
          }
      }
  
      private void loadResources(Resources resources) {
          this.widgetHeight = resources.getDimensionPixelSize(R.dimen.mtrl_slider_widget_height);
          int dimensionPixelOffset = resources.getDimensionPixelOffset(R.dimen.mtrl_slider_track_side_padding);
          this.minTrackSidePadding = dimensionPixelOffset;
          this.trackSidePadding = dimensionPixelOffset;
          this.defaultThumbRadius = resources.getDimensionPixelSize(R.dimen.mtrl_slider_thumb_radius);
          this.trackTop = resources.getDimensionPixelOffset(R.dimen.mtrl_slider_track_top);
          this.labelPadding = resources.getDimensionPixelSize(R.dimen.mtrl_slider_label_padding);
      }
  
      private void maybeCalculateTicksCoordinates() {
          if (this.stepSize > 0.0f) {
              validateConfigurationIfDirty();
              int min = Math.min((int) (((this.valueTo - this.valueFrom) / this.stepSize) + 1.0f), (this.trackWidth / (this.trackHeight * 2)) + 1);
              float[] fArr = this.ticksCoordinates;
              if (fArr == null || fArr.length != min * 2) {
                  this.ticksCoordinates = new float[(min * 2)];
              }
              float f = ((float) this.trackWidth) / ((float) (min - 1));
              for (int i = 0; i < min * 2; i += 2) {
                  float[] fArr2 = this.ticksCoordinates;
                  fArr2[i] = ((float) this.trackSidePadding) + (((float) (i / 2)) * f);
                  fArr2[i + 1] = (float) calculateTop();
              }
          }
      }
  
      private void maybeDrawHalo(Canvas canvas, int width, int top) {
          if (shouldDrawCompatHalo()) {
              int normalizeValue = (int) (((float) this.trackSidePadding) + (normalizeValue(this.values.get(this.focusedThumbIdx).floatValue()) * ((float) width)));
              if (Build.VERSION.SDK_INT < 28) {
                  int i = this.haloRadius;
                  canvas.clipRect((float) (normalizeValue - i), (float) (top - i), (float) (normalizeValue + i), (float) (i + top), Region.Op.UNION);
              }
              canvas.drawCircle((float) normalizeValue, (float) top, (float) this.haloRadius, this.haloPaint);
          }
      }
  
      private void maybeDrawTicks(Canvas canvas) {
          if (this.tickVisible && this.stepSize > 0.0f) {
              float[] activeRange = getActiveRange();
              int pivotIndex = pivotIndex(this.ticksCoordinates, activeRange[0]);
              int pivotIndex2 = pivotIndex(this.ticksCoordinates, activeRange[1]);
              canvas.drawPoints(this.ticksCoordinates, 0, pivotIndex * 2, this.inactiveTicksPaint);
              canvas.drawPoints(this.ticksCoordinates, pivotIndex * 2, (pivotIndex2 * 2) - (pivotIndex * 2), this.activeTicksPaint);
              float[] fArr = this.ticksCoordinates;
              canvas.drawPoints(fArr, pivotIndex2 * 2, fArr.length - (pivotIndex2 * 2), this.inactiveTicksPaint);
          }
      }
  
      private void maybeIncreaseTrackSidePadding() {
          this.trackSidePadding = this.minTrackSidePadding + Math.max(this.thumbRadius - this.defaultThumbRadius, 0);
          if (ViewCompat.isLaidOut(this)) {
              updateTrackWidth(getWidth());
          }
      }
  
      private boolean moveFocus(int direction) {
          int i = this.focusedThumbIdx;
          int clamp = (int) MathUtils.clamp(((long) i) + ((long) direction), 0, (long) (this.values.size() - 1));
          this.focusedThumbIdx = clamp;
          if (clamp == i) {
              return false;
          }
          if (this.activeThumbIdx != -1) {
              this.activeThumbIdx = clamp;
          }
          updateHaloHotspot();
          postInvalidate();
          return true;
      }
  
      private boolean moveFocusInAbsoluteDirection(int direction) {
          if (isRtl()) {
              direction = direction == Integer.MIN_VALUE ? Integer.MAX_VALUE : -direction;
          }
          return moveFocus(direction);
      }
  
      private float normalizeValue(float value) {
          float f = this.valueFrom;
          float f2 = (value - f) / (this.valueTo - f);
          return isRtl() ? 1.0f - f2 : f2;
      }
  
      private Boolean onKeyDownNoActiveThumb(int keyCode, KeyEvent event) {
          switch (keyCode) {
              case 21:
                  moveFocusInAbsoluteDirection(-1);
                  return true;
              case 22:
                  moveFocusInAbsoluteDirection(1);
                  return true;
              case 23:
              case ConstraintLayout.LayoutParams.Table.LAYOUT_WRAP_BEHAVIOR_IN_PARENT:
                  this.activeThumbIdx = this.focusedThumbIdx;
                  postInvalidate();
                  return true;
              case LockFreeTaskQueueCore.CLOSED_SHIFT /*61*/:
                  if (event.hasNoModifiers()) {
                      return Boolean.valueOf(moveFocus(1));
                  }
                  if (event.isShiftPressed()) {
                      return Boolean.valueOf(moveFocus(-1));
                  }
                  return false;
              case 69:
                  moveFocus(-1);
                  return true;
              case 70:
              case 81:
                  moveFocus(1);
                  return true;
              default:
                  return null;
          }
      }
  
      private void onStartTrackingTouch() {
          for (T onStartTrackingTouch : this.touchListeners) {
              onStartTrackingTouch.onStartTrackingTouch(this);
          }
      }
  
      private void onStopTrackingTouch() {
          for (T onStopTrackingTouch : this.touchListeners) {
              onStopTrackingTouch.onStopTrackingTouch(this);
          }
      }
  
      /* access modifiers changed from: private */
      public static TooltipDrawable parseLabelDrawable(Context context, TypedArray a) {
          return TooltipDrawable.createFromAttributes(context, (AttributeSet) null, 0, a.getResourceId(R.styleable.Slider_labelStyle, R.style.Widget_MaterialComponents_Tooltip));
      }
  
      private static int pivotIndex(float[] coordinates, float position) {
          return Math.round(((float) ((coordinates.length / 2) - 1)) * position);
      }
  
      private void processAttributes(Context context, AttributeSet attrs, int defStyleAttr) {
          Context context2 = context;
          TypedArray obtainStyledAttributes = ThemeEnforcement.obtainStyledAttributes(context, attrs, R.styleable.Slider, defStyleAttr, DEF_STYLE_RES, new int[0]);
          this.valueFrom = obtainStyledAttributes.getFloat(R.styleable.Slider_android_valueFrom, 0.0f);
          this.valueTo = obtainStyledAttributes.getFloat(R.styleable.Slider_android_valueTo, 1.0f);
          setValues(Float.valueOf(this.valueFrom));
          this.stepSize = obtainStyledAttributes.getFloat(R.styleable.Slider_android_stepSize, 0.0f);
          boolean hasValue = obtainStyledAttributes.hasValue(R.styleable.Slider_trackColor);
          int i = hasValue ? R.styleable.Slider_trackColor : R.styleable.Slider_trackColorInactive;
          int i2 = hasValue ? R.styleable.Slider_trackColor : R.styleable.Slider_trackColorActive;
          ColorStateList colorStateList = MaterialResources.getColorStateList(context2, obtainStyledAttributes, i);
          setTrackInactiveTintList(colorStateList != null ? colorStateList : AppCompatResources.getColorStateList(context2, R.color.material_slider_inactive_track_color));
          ColorStateList colorStateList2 = MaterialResources.getColorStateList(context2, obtainStyledAttributes, i2);
          setTrackActiveTintList(colorStateList2 != null ? colorStateList2 : AppCompatResources.getColorStateList(context2, R.color.material_slider_active_track_color));
          this.defaultThumbDrawable.setFillColor(MaterialResources.getColorStateList(context2, obtainStyledAttributes, R.styleable.Slider_thumbColor));
          if (obtainStyledAttributes.hasValue(R.styleable.Slider_thumbStrokeColor)) {
              setThumbStrokeColor(MaterialResources.getColorStateList(context2, obtainStyledAttributes, R.styleable.Slider_thumbStrokeColor));
          }
          setThumbStrokeWidth(obtainStyledAttributes.getDimension(R.styleable.Slider_thumbStrokeWidth, 0.0f));
          ColorStateList colorStateList3 = MaterialResources.getColorStateList(context2, obtainStyledAttributes, R.styleable.Slider_haloColor);
          setHaloTintList(colorStateList3 != null ? colorStateList3 : AppCompatResources.getColorStateList(context2, R.color.material_slider_halo_color));
          this.tickVisible = obtainStyledAttributes.getBoolean(R.styleable.Slider_tickVisible, true);
          boolean hasValue2 = obtainStyledAttributes.hasValue(R.styleable.Slider_tickColor);
          int i3 = hasValue2 ? R.styleable.Slider_tickColor : R.styleable.Slider_tickColorInactive;
          int i4 = hasValue2 ? R.styleable.Slider_tickColor : R.styleable.Slider_tickColorActive;
          ColorStateList colorStateList4 = MaterialResources.getColorStateList(context2, obtainStyledAttributes, i3);
          setTickInactiveTintList(colorStateList4 != null ? colorStateList4 : AppCompatResources.getColorStateList(context2, R.color.material_slider_inactive_tick_marks_color));
          ColorStateList colorStateList5 = MaterialResources.getColorStateList(context2, obtainStyledAttributes, i4);
          setTickActiveTintList(colorStateList5 != null ? colorStateList5 : AppCompatResources.getColorStateList(context2, R.color.material_slider_active_tick_marks_color));
          setThumbRadius(obtainStyledAttributes.getDimensionPixelSize(R.styleable.Slider_thumbRadius, 0));
          setHaloRadius(obtainStyledAttributes.getDimensionPixelSize(R.styleable.Slider_haloRadius, 0));
          setThumbElevation(obtainStyledAttributes.getDimension(R.styleable.Slider_thumbElevation, 0.0f));
          setTrackHeight(obtainStyledAttributes.getDimensionPixelSize(R.styleable.Slider_trackHeight, 0));
          setLabelBehavior(obtainStyledAttributes.getInt(R.styleable.Slider_labelBehavior, 0));
          if (!obtainStyledAttributes.getBoolean(R.styleable.Slider_android_enabled, true)) {
              setEnabled(false);
          }
          obtainStyledAttributes.recycle();
      }
  
      private void scheduleAccessibilityEventSender(int idx) {
          BaseSlider<S, L, T>.AccessibilityEventSender accessibilityEventSender2 = this.accessibilityEventSender;
          if (accessibilityEventSender2 == null) {
              this.accessibilityEventSender = new AccessibilityEventSender();
          } else {
              removeCallbacks(accessibilityEventSender2);
          }
          this.accessibilityEventSender.setVirtualViewId(idx);
          postDelayed(this.accessibilityEventSender, 200);
      }
  
      private void setValueForLabel(TooltipDrawable label, float value) {
          label.setText(formatValue(value));
          int normalizeValue = (this.trackSidePadding + ((int) (normalizeValue(value) * ((float) this.trackWidth)))) - (label.getIntrinsicWidth() / 2);
          int calculateTop = calculateTop() - (this.labelPadding + this.thumbRadius);
          label.setBounds(normalizeValue, calculateTop - label.getIntrinsicHeight(), label.getIntrinsicWidth() + normalizeValue, calculateTop);
          Rect rect = new Rect(label.getBounds());
          DescendantOffsetUtils.offsetDescendantRect(ViewUtils.getContentView(this), this, rect);
          label.setBounds(rect);
          ViewUtils.getContentViewOverlay(this).add(label);
      }
  
      private void setValuesInternal(ArrayList<Float> arrayList) {
          if (!arrayList.isEmpty()) {
              Collections.sort(arrayList);
              if (this.values.size() != arrayList.size() || !this.values.equals(arrayList)) {
                  this.values = arrayList;
                  this.dirtyConfig = true;
                  this.focusedThumbIdx = 0;
                  updateHaloHotspot();
                  createLabelPool();
                  dispatchOnChangedProgrammatically();
                  postInvalidate();
                  return;
              }
              return;
          }
          throw new IllegalArgumentException("At least one value must be set");
      }
  
      private boolean shouldAlwaysShowLabel() {
          return this.labelBehavior == 3;
      }
  
      private boolean shouldDrawCompatHalo() {
          return this.forceDrawCompatHalo || Build.VERSION.SDK_INT < 21 || !(getBackground() instanceof RippleDrawable);
      }
  
      private boolean snapActiveThumbToValue(float value) {
          return snapThumbToValue(this.activeThumbIdx, value);
      }
  
      private double snapPosition(float position) {
          float f = this.stepSize;
          if (f <= 0.0f) {
              return (double) position;
          }
          int i = (int) ((this.valueTo - this.valueFrom) / f);
          return ((double) Math.round(((float) i) * position)) / ((double) i);
      }
  
      /* access modifiers changed from: private */
      public boolean snapThumbToValue(int idx, float value) {
          this.focusedThumbIdx = idx;
          if (((double) Math.abs(value - this.values.get(idx).floatValue())) < THRESHOLD) {
              return false;
          }
          this.values.set(idx, Float.valueOf(getClampedValue(idx, value)));
          dispatchOnChangedFromUser(idx);
          return true;
      }
  
      private boolean snapTouchPosition() {
          return snapActiveThumbToValue(getValueOfTouchPosition());
      }
  
      /* access modifiers changed from: private */
      public void updateHaloHotspot() {
          if (!shouldDrawCompatHalo() && getMeasuredWidth() > 0) {
              Drawable background = getBackground();
              if (background instanceof RippleDrawable) {
                  int normalizeValue = (int) ((normalizeValue(this.values.get(this.focusedThumbIdx).floatValue()) * ((float) this.trackWidth)) + ((float) this.trackSidePadding));
                  int calculateTop = calculateTop();
                  int i = this.haloRadius;
                  DrawableCompat.setHotspotBounds(background, normalizeValue - i, calculateTop - i, normalizeValue + i, i + calculateTop);
              }
          }
      }
  
      private void updateTrackWidth(int width) {
          this.trackWidth = Math.max(width - (this.trackSidePadding * 2), 0);
          maybeCalculateTicksCoordinates();
      }
  
      private void validateConfigurationIfDirty() {
          if (this.dirtyConfig) {
              validateValueFrom();
              validateValueTo();
              validateStepSize();
              validateValues();
              validateMinSeparation();
              warnAboutFloatingPointError();
              this.dirtyConfig = false;
          }
      }
  
      private boolean valueLandsOnTick(float value) {
          return isMultipleOfStepSize(value - this.valueFrom);
      }
  
      private float valueToX(float value) {
          return (normalizeValue(value) * ((float) this.trackWidth)) + ((float) this.trackSidePadding);
      }
  
      public void addOnChangeListener(L l) {
          this.changeListeners.add(l);
      }
  
      public void addOnSliderTouchListener(T t) {
          this.touchListeners.add(t);
      }
  
      public void clearOnChangeListeners() {
          this.changeListeners.clear();
      }
  
      public void clearOnSliderTouchListeners() {
          this.touchListeners.clear();
      }
  
      public boolean dispatchHoverEvent(MotionEvent event) {
          return this.accessibilityHelper.dispatchHoverEvent(event) || super.dispatchHoverEvent(event);
      }
  
      public boolean dispatchKeyEvent(KeyEvent event) {
          return super.dispatchKeyEvent(event);
      }
  
      /* access modifiers changed from: protected */
      public void drawableStateChanged() {
          super.drawableStateChanged();
          this.inactiveTrackPaint.setColor(getColorForState(this.trackColorInactive));
          this.activeTrackPaint.setColor(getColorForState(this.trackColorActive));
          this.inactiveTicksPaint.setColor(getColorForState(this.tickColorInactive));
          this.activeTicksPaint.setColor(getColorForState(this.tickColorActive));
          for (TooltipDrawable next : this.labels) {
              if (next.isStateful()) {
                  next.setState(getDrawableState());
              }
          }
          if (this.defaultThumbDrawable.isStateful()) {
              this.defaultThumbDrawable.setState(getDrawableState());
          }
          this.haloPaint.setColor(getColorForState(this.haloColor));
          this.haloPaint.setAlpha(63);
      }
  
      /* access modifiers changed from: package-private */
      public void forceDrawCompatHalo(boolean force) {
          this.forceDrawCompatHalo = force;
      }
  
      public CharSequence getAccessibilityClassName() {
          return SeekBar.class.getName();
      }
  
      /* access modifiers changed from: package-private */
      public final int getAccessibilityFocusedVirtualViewId() {
          return this.accessibilityHelper.getAccessibilityFocusedVirtualViewId();
      }
  
      public int getActiveThumbIndex() {
          return this.activeThumbIdx;
      }
  
      public int getFocusedThumbIndex() {
          return this.focusedThumbIdx;
      }
  
      public int getHaloRadius() {
          return this.haloRadius;
      }
  
      public ColorStateList getHaloTintList() {
          return this.haloColor;
      }
  
      public int getLabelBehavior() {
          return this.labelBehavior;
      }
  
      /* access modifiers changed from: protected */
      public float getMinSeparation() {
          return 0.0f;
      }
  
      public float getStepSize() {
          return this.stepSize;
      }
  
      public float getThumbElevation() {
          return this.defaultThumbDrawable.getElevation();
      }
  
      public int getThumbRadius() {
          return this.thumbRadius;
      }
  
      public ColorStateList getThumbStrokeColor() {
          return this.defaultThumbDrawable.getStrokeColor();
      }
  
      public float getThumbStrokeWidth() {
          return this.defaultThumbDrawable.getStrokeWidth();
      }
  
      public ColorStateList getThumbTintList() {
          return this.defaultThumbDrawable.getFillColor();
      }
  
      public ColorStateList getTickActiveTintList() {
          return this.tickColorActive;
      }
  
      public ColorStateList getTickInactiveTintList() {
          return this.tickColorInactive;
      }
  
      public ColorStateList getTickTintList() {
          if (this.tickColorInactive.equals(this.tickColorActive)) {
              return this.tickColorActive;
          }
          throw new IllegalStateException("The inactive and active ticks are different colors. Use the getTickColorInactive() and getTickColorActive() methods instead.");
      }
  
      public ColorStateList getTrackActiveTintList() {
          return this.trackColorActive;
      }
  
      public int getTrackHeight() {
          return this.trackHeight;
      }
  
      public ColorStateList getTrackInactiveTintList() {
          return this.trackColorInactive;
      }
  
      public int getTrackSidePadding() {
          return this.trackSidePadding;
      }
  
      public ColorStateList getTrackTintList() {
          if (this.trackColorInactive.equals(this.trackColorActive)) {
              return this.trackColorActive;
          }
          throw new IllegalStateException("The inactive and active parts of the track are different colors. Use the getInactiveTrackColor() and getActiveTrackColor() methods instead.");
      }
  
      public int getTrackWidth() {
          return this.trackWidth;
      }
  
      public float getValueFrom() {
          return this.valueFrom;
      }
  
      public float getValueTo() {
          return this.valueTo;
      }
  
      /* access modifiers changed from: package-private */
      public List<Float> getValues() {
          return new ArrayList(this.values);
      }
  
      public boolean hasLabelFormatter() {
          return this.formatter != null;
      }
  
      /* access modifiers changed from: package-private */
      public final boolean isRtl() {
          return ViewCompat.getLayoutDirection(this) == 1;
      }
  
      public boolean isTickVisible() {
          return this.tickVisible;
      }
  
      /* access modifiers changed from: protected */
      public void onAttachedToWindow() {
          super.onAttachedToWindow();
          for (TooltipDrawable attachLabelToContentView : this.labels) {
              attachLabelToContentView(attachLabelToContentView);
          }
      }
  
      /* access modifiers changed from: protected */
      public void onDetachedFromWindow() {
          BaseSlider<S, L, T>.AccessibilityEventSender accessibilityEventSender2 = this.accessibilityEventSender;
          if (accessibilityEventSender2 != null) {
              removeCallbacks(accessibilityEventSender2);
          }
          this.labelsAreAnimatedIn = false;
          for (TooltipDrawable detachLabelFromContentView : this.labels) {
              detachLabelFromContentView(detachLabelFromContentView);
          }
          super.onDetachedFromWindow();
      }
  
      /* access modifiers changed from: protected */
      public void onDraw(Canvas canvas) {
          if (this.dirtyConfig) {
              validateConfigurationIfDirty();
              maybeCalculateTicksCoordinates();
          }
          super.onDraw(canvas);
          int calculateTop = calculateTop();
          drawInactiveTrack(canvas, this.trackWidth, calculateTop);
          if (((Float) Collections.max(getValues())).floatValue() > this.valueFrom) {
              drawActiveTrack(canvas, this.trackWidth, calculateTop);
          }
          maybeDrawTicks(canvas);
          if ((this.thumbIsPressed || isFocused() || shouldAlwaysShowLabel()) && isEnabled()) {
              maybeDrawHalo(canvas, this.trackWidth, calculateTop);
              if (this.activeThumbIdx != -1 || shouldAlwaysShowLabel()) {
                  ensureLabelsAdded();
              } else {
                  ensureLabelsRemoved();
              }
          } else {
              ensureLabelsRemoved();
          }
          drawThumbs(canvas, this.trackWidth, calculateTop);
      }
  
      /* access modifiers changed from: protected */
      public void onFocusChanged(boolean gainFocus, int direction, Rect previouslyFocusedRect) {
          super.onFocusChanged(gainFocus, direction, previouslyFocusedRect);
          if (!gainFocus) {
              this.activeThumbIdx = -1;
              this.accessibilityHelper.clearKeyboardFocusForVirtualView(this.focusedThumbIdx);
              return;
          }
          focusThumbOnFocusGained(direction);
          this.accessibilityHelper.requestKeyboardFocusForVirtualView(this.focusedThumbIdx);
      }
  
      public boolean onKeyDown(int keyCode, KeyEvent event) {
          if (!isEnabled()) {
              return super.onKeyDown(keyCode, event);
          }
          if (this.values.size() == 1) {
              this.activeThumbIdx = 0;
          }
          if (this.activeThumbIdx == -1) {
              Boolean onKeyDownNoActiveThumb = onKeyDownNoActiveThumb(keyCode, event);
              return onKeyDownNoActiveThumb != null ? onKeyDownNoActiveThumb.booleanValue() : super.onKeyDown(keyCode, event);
          }
          this.isLongPress |= event.isLongPress();
          Float calculateIncrementForKey = calculateIncrementForKey(keyCode);
          if (calculateIncrementForKey != null) {
              if (snapActiveThumbToValue(this.values.get(this.activeThumbIdx).floatValue() + calculateIncrementForKey.floatValue())) {
                  updateHaloHotspot();
                  postInvalidate();
              }
              return true;
          }
          switch (keyCode) {
              case 23:
              case ConstraintLayout.LayoutParams.Table.LAYOUT_WRAP_BEHAVIOR_IN_PARENT:
                  this.activeThumbIdx = -1;
                  postInvalidate();
                  return true;
              case LockFreeTaskQueueCore.CLOSED_SHIFT /*61*/:
                  if (event.hasNoModifiers()) {
                      return moveFocus(1);
                  }
                  if (event.isShiftPressed()) {
                      return moveFocus(-1);
                  }
                  return false;
              default:
                  return super.onKeyDown(keyCode, event);
          }
      }
  
      public boolean onKeyUp(int keyCode, KeyEvent event) {
          this.isLongPress = false;
          return super.onKeyUp(keyCode, event);
      }
  
      /* access modifiers changed from: protected */
      public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
          int i = this.widgetHeight;
          int i2 = 0;
          if (this.labelBehavior == 1 || shouldAlwaysShowLabel()) {
              i2 = this.labels.get(0).getIntrinsicHeight();
          }
          super.onMeasure(widthMeasureSpec, View.MeasureSpec.makeMeasureSpec(i + i2, BasicMeasure.EXACTLY));
      }
  
      /* access modifiers changed from: protected */
      public void onRestoreInstanceState(Parcelable state) {
          SliderState sliderState = (SliderState) state;
          super.onRestoreInstanceState(sliderState.getSuperState());
          this.valueFrom = sliderState.valueFrom;
          this.valueTo = sliderState.valueTo;
          setValuesInternal(sliderState.values);
          this.stepSize = sliderState.stepSize;
          if (sliderState.hasFocus) {
              requestFocus();
          }
      }
  
      /* access modifiers changed from: protected */
      public Parcelable onSaveInstanceState() {
          SliderState sliderState = new SliderState(super.onSaveInstanceState());
          sliderState.valueFrom = this.valueFrom;
          sliderState.valueTo = this.valueTo;
          sliderState.values = new ArrayList<>(this.values);
          sliderState.stepSize = this.stepSize;
          sliderState.hasFocus = hasFocus();
          return sliderState;
      }
  
      /* access modifiers changed from: protected */
      public void onSizeChanged(int w, int h, int oldw, int oldh) {
          updateTrackWidth(w);
          updateHaloHotspot();
      }
  
      public boolean onTouchEvent(MotionEvent event) {
          if (!isEnabled()) {
              return false;
          }
          float x = event.getX();
          float f = (x - ((float) this.trackSidePadding)) / ((float) this.trackWidth);
          this.touchPosition = f;
          float max = Math.max(0.0f, f);
          this.touchPosition = max;
          this.touchPosition = Math.min(1.0f, max);
          switch (event.getActionMasked()) {
              case 0:
                  this.touchDownX = x;
                  if (!isInVerticalScrollingContainer()) {
                      getParent().requestDisallowInterceptTouchEvent(true);
                      if (pickActiveThumb()) {
                          requestFocus();
                          this.thumbIsPressed = true;
                          snapTouchPosition();
                          updateHaloHotspot();
                          invalidate();
                          onStartTrackingTouch();
                          break;
                      }
                  }
                  break;
              case 1:
                  this.thumbIsPressed = false;
                  MotionEvent motionEvent = this.lastEvent;
                  if (motionEvent != null && motionEvent.getActionMasked() == 0 && Math.abs(this.lastEvent.getX() - event.getX()) <= ((float) this.scaledTouchSlop) && Math.abs(this.lastEvent.getY() - event.getY()) <= ((float) this.scaledTouchSlop) && pickActiveThumb()) {
                      onStartTrackingTouch();
                  }
                  if (this.activeThumbIdx != -1) {
                      snapTouchPosition();
                      this.activeThumbIdx = -1;
                      onStopTrackingTouch();
                  }
                  invalidate();
                  break;
              case 2:
                  if (!this.thumbIsPressed) {
                      if (isInVerticalScrollingContainer() && Math.abs(x - this.touchDownX) < ((float) this.scaledTouchSlop)) {
                          return false;
                      }
                      getParent().requestDisallowInterceptTouchEvent(true);
                      onStartTrackingTouch();
                  }
                  if (pickActiveThumb()) {
                      this.thumbIsPressed = true;
                      snapTouchPosition();
                      updateHaloHotspot();
                      invalidate();
                      break;
                  }
                  break;
          }
          setPressed(this.thumbIsPressed);
          this.lastEvent = MotionEvent.obtain(event);
          return true;
      }
  
      /* access modifiers changed from: protected */
      public boolean pickActiveThumb() {
          if (this.activeThumbIdx != -1) {
              return true;
          }
          float valueOfTouchPositionAbsolute = getValueOfTouchPositionAbsolute();
          float valueToX = valueToX(valueOfTouchPositionAbsolute);
          this.activeThumbIdx = 0;
          float abs = Math.abs(this.values.get(0).floatValue() - valueOfTouchPositionAbsolute);
          for (int i = 1; i < this.values.size(); i++) {
              float abs2 = Math.abs(this.values.get(i).floatValue() - valueOfTouchPositionAbsolute);
              float valueToX2 = valueToX(this.values.get(i).floatValue());
              if (Float.compare(abs2, abs) > 1) {
                  break;
              }
              boolean z = !isRtl() ? valueToX2 - valueToX < 0.0f : valueToX2 - valueToX > 0.0f;
              if (Float.compare(abs2, abs) < 0) {
                  abs = abs2;
                  this.activeThumbIdx = i;
              } else if (Float.compare(abs2, abs) != 0) {
                  continue;
              } else if (Math.abs(valueToX2 - valueToX) < ((float) this.scaledTouchSlop)) {
                  this.activeThumbIdx = -1;
                  return false;
              } else if (z) {
                  abs = abs2;
                  this.activeThumbIdx = i;
              }
          }
          return this.activeThumbIdx != -1;
      }
  
      public void removeOnChangeListener(L l) {
          this.changeListeners.remove(l);
      }
  
      public void removeOnSliderTouchListener(T t) {
          this.touchListeners.remove(t);
      }
  
      /* access modifiers changed from: protected */
      public void setActiveThumbIndex(int index) {
          this.activeThumbIdx = index;
      }
  
      /* access modifiers changed from: package-private */
      public void setCustomThumbDrawable(int drawableResId) {
          setCustomThumbDrawable(getResources().getDrawable(drawableResId));
      }
  
      /* access modifiers changed from: package-private */
      public void setCustomThumbDrawable(Drawable drawable) {
          this.customThumbDrawable = initializeCustomThumbDrawable(drawable);
          this.customThumbDrawablesForValues.clear();
          postInvalidate();
      }
  
      /* access modifiers changed from: package-private */
      public void setCustomThumbDrawablesForValues(int... customThumbDrawableResIds) {
          Drawable[] drawableArr = new Drawable[customThumbDrawableResIds.length];
          for (int i = 0; i < customThumbDrawableResIds.length; i++) {
              drawableArr[i] = getResources().getDrawable(customThumbDrawableResIds[i]);
          }
          setCustomThumbDrawablesForValues(drawableArr);
      }
  
      /* access modifiers changed from: package-private */
      public void setCustomThumbDrawablesForValues(Drawable... customThumbDrawables) {
          this.customThumbDrawable = null;
          this.customThumbDrawablesForValues = new ArrayList();
          for (Drawable initializeCustomThumbDrawable : customThumbDrawables) {
              this.customThumbDrawablesForValues.add(initializeCustomThumbDrawable(initializeCustomThumbDrawable));
          }
          postInvalidate();
      }
  
      public void setEnabled(boolean enabled) {
          super.setEnabled(enabled);
          setLayerType(enabled ? 0 : 2, (Paint) null);
      }
  
      public void setFocusedThumbIndex(int index) {
          if (index < 0 || index >= this.values.size()) {
              throw new IllegalArgumentException("index out of range");
          }
          this.focusedThumbIdx = index;
          this.accessibilityHelper.requestKeyboardFocusForVirtualView(index);
          postInvalidate();
      }
  
      public void setHaloRadius(int radius) {
          if (radius != this.haloRadius) {
              this.haloRadius = radius;
              Drawable background = getBackground();
              if (shouldDrawCompatHalo() || !(background instanceof RippleDrawable)) {
                  postInvalidate();
              } else {
                  DrawableUtils.setRippleDrawableRadius((RippleDrawable) background, this.haloRadius);
              }
          }
      }
  
      public void setHaloRadiusResource(int radius) {
          setHaloRadius(getResources().getDimensionPixelSize(radius));
      }
  
      public void setHaloTintList(ColorStateList haloColor2) {
          if (!haloColor2.equals(this.haloColor)) {
              this.haloColor = haloColor2;
              Drawable background = getBackground();
              if (shouldDrawCompatHalo() || !(background instanceof RippleDrawable)) {
                  this.haloPaint.setColor(getColorForState(haloColor2));
                  this.haloPaint.setAlpha(63);
                  invalidate();
                  return;
              }
              ((RippleDrawable) background).setColor(haloColor2);
          }
      }
  
      public void setLabelBehavior(int labelBehavior2) {
          if (this.labelBehavior != labelBehavior2) {
              this.labelBehavior = labelBehavior2;
              requestLayout();
          }
      }
  
      public void setLabelFormatter(LabelFormatter formatter2) {
          this.formatter = formatter2;
      }
  
      /* access modifiers changed from: protected */
      public void setSeparationUnit(int separationUnit2) {
          this.separationUnit = separationUnit2;
          this.dirtyConfig = true;
          postInvalidate();
      }
  
      public void setThumbElevation(float elevation) {
          this.defaultThumbDrawable.setElevation(elevation);
      }
  
      public void setThumbElevationResource(int elevation) {
          setThumbElevation(getResources().getDimension(elevation));
      }
  
      public void setThumbRadius(int radius) {
          if (radius != this.thumbRadius) {
              this.thumbRadius = radius;
              maybeIncreaseTrackSidePadding();
              this.defaultThumbDrawable.setShapeAppearanceModel(ShapeAppearanceModel.builder().setAllCorners(0, (float) this.thumbRadius).build());
              MaterialShapeDrawable materialShapeDrawable = this.defaultThumbDrawable;
              int i = this.thumbRadius;
              materialShapeDrawable.setBounds(0, 0, i * 2, i * 2);
              Drawable drawable = this.customThumbDrawable;
              if (drawable != null) {
                  adjustCustomThumbDrawableBounds(drawable);
              }
              for (Drawable adjustCustomThumbDrawableBounds : this.customThumbDrawablesForValues) {
                  adjustCustomThumbDrawableBounds(adjustCustomThumbDrawableBounds);
              }
              postInvalidate();
          }
      }
  
      public void setThumbRadiusResource(int radius) {
          setThumbRadius(getResources().getDimensionPixelSize(radius));
      }
  
      public void setThumbStrokeColor(ColorStateList thumbStrokeColor) {
          this.defaultThumbDrawable.setStrokeColor(thumbStrokeColor);
          postInvalidate();
      }
  
      public void setThumbStrokeColorResource(int thumbStrokeColorResourceId) {
          if (thumbStrokeColorResourceId != 0) {
              setThumbStrokeColor(AppCompatResources.getColorStateList(getContext(), thumbStrokeColorResourceId));
          }
      }
  
      public void setThumbStrokeWidth(float thumbStrokeWidth) {
          this.defaultThumbDrawable.setStrokeWidth(thumbStrokeWidth);
          postInvalidate();
      }
  
      public void setThumbStrokeWidthResource(int thumbStrokeWidthResourceId) {
          if (thumbStrokeWidthResourceId != 0) {
              setThumbStrokeWidth(getResources().getDimension(thumbStrokeWidthResourceId));
          }
      }
  
      public void setThumbTintList(ColorStateList thumbColor) {
          if (!thumbColor.equals(this.defaultThumbDrawable.getFillColor())) {
              this.defaultThumbDrawable.setFillColor(thumbColor);
              invalidate();
          }
      }
  
      public void setTickActiveTintList(ColorStateList tickColor) {
          if (!tickColor.equals(this.tickColorActive)) {
              this.tickColorActive = tickColor;
              this.activeTicksPaint.setColor(getColorForState(tickColor));
              invalidate();
          }
      }
  
      public void setTickInactiveTintList(ColorStateList tickColor) {
          if (!tickColor.equals(this.tickColorInactive)) {
              this.tickColorInactive = tickColor;
              this.inactiveTicksPaint.setColor(getColorForState(tickColor));
              invalidate();
          }
      }
  
      public void setTickTintList(ColorStateList tickColor) {
          setTickInactiveTintList(tickColor);
          setTickActiveTintList(tickColor);
      }
  
      public void setTickVisible(boolean tickVisible2) {
          if (this.tickVisible != tickVisible2) {
              this.tickVisible = tickVisible2;
              postInvalidate();
          }
      }
  
      public void setTrackActiveTintList(ColorStateList trackColor) {
          if (!trackColor.equals(this.trackColorActive)) {
              this.trackColorActive = trackColor;
              this.activeTrackPaint.setColor(getColorForState(trackColor));
              invalidate();
          }
      }
  
      public void setTrackHeight(int trackHeight2) {
          if (this.trackHeight != trackHeight2) {
              this.trackHeight = trackHeight2;
              invalidateTrack();
              postInvalidate();
          }
      }
  
      public void setTrackInactiveTintList(ColorStateList trackColor) {
          if (!trackColor.equals(this.trackColorInactive)) {
              this.trackColorInactive = trackColor;
              this.inactiveTrackPaint.setColor(getColorForState(trackColor));
              invalidate();
          }
      }
  
      public void setTrackTintList(ColorStateList trackColor) {
          setTrackInactiveTintList(trackColor);
          setTrackActiveTintList(trackColor);
      }
  
      public void setValueFrom(float valueFrom2) {
          this.valueFrom = valueFrom2;
          this.dirtyConfig = true;
          postInvalidate();
      }
  
      public void setValueTo(float valueTo2) {
          this.valueTo = valueTo2;
          this.dirtyConfig = true;
          postInvalidate();
      }
  
      /* access modifiers changed from: package-private */
      public void setValues(List<Float> list) {
          setValuesInternal(new ArrayList(list));
      }
  
      /* access modifiers changed from: package-private */
      public void setValues(Float... values2) {
          ArrayList arrayList = new ArrayList();
          Collections.addAll(arrayList, values2);
          setValuesInternal(arrayList);
      }
  
      /* access modifiers changed from: package-private */
      public void updateBoundsForVirturalViewId(int virtualViewId, Rect virtualViewBounds) {
          int normalizeValue = this.trackSidePadding + ((int) (normalizeValue(getValues().get(virtualViewId).floatValue()) * ((float) this.trackWidth)));
          int calculateTop = calculateTop();
          int i = this.thumbRadius;
          virtualViewBounds.set(normalizeValue - i, calculateTop - i, normalizeValue + i, i + calculateTop);
      }
  
      /* access modifiers changed from: private */
      public String formatValue(float value) {
          if (hasLabelFormatter()) {
              return this.formatter.getFormattedValue(value);
          }
          String format = String.format(((float) ((int) value)) == value ? "%.0f" : "%.2f", new Object[]{Float.valueOf(value)});
          Log1F380D.a((Object) format);
          return format;
      }
  
      private boolean isMultipleOfStepSize(float value) {
          String f = Float.toString(value);
          Log1F380D.a((Object) f);
          BigDecimal bigDecimal = new BigDecimal(f);
          String f2 = Float.toString(this.stepSize);
          Log1F380D.a((Object) f2);
          double doubleValue = bigDecimal.divide(new BigDecimal(f2), MathContext.DECIMAL64).doubleValue();
          return Math.abs(((double) Math.round(doubleValue)) - doubleValue) < THRESHOLD;
      }
  
      private void validateMinSeparation() {
          float minSeparation = getMinSeparation();
          if (minSeparation >= 0.0f) {
              float f = this.stepSize;
              if (f > 0.0f && minSeparation > 0.0f) {
                  if (this.separationUnit != 1) {
                      String format = String.format(EXCEPTION_ILLEGAL_MIN_SEPARATION_STEP_SIZE_UNIT, new Object[]{Float.valueOf(minSeparation), Float.valueOf(this.stepSize)});
                      Log1F380D.a((Object) format);
                      throw new IllegalStateException(format);
                  } else if (minSeparation < f || !isMultipleOfStepSize(minSeparation)) {
                      String format2 = String.format(EXCEPTION_ILLEGAL_MIN_SEPARATION_STEP_SIZE, new Object[]{Float.valueOf(minSeparation), Float.valueOf(this.stepSize), Float.valueOf(this.stepSize)});
                      Log1F380D.a((Object) format2);
                      throw new IllegalStateException(format2);
                  }
              }
          } else {
              String format3 = String.format(EXCEPTION_ILLEGAL_MIN_SEPARATION, new Object[]{Float.valueOf(minSeparation)});
              Log1F380D.a((Object) format3);
              throw new IllegalStateException(format3);
          }
      }
  
      private void validateStepSize() {
          if (this.stepSize > 0.0f && !valueLandsOnTick(this.valueTo)) {
              String format = String.format(EXCEPTION_ILLEGAL_STEP_SIZE, new Object[]{Float.valueOf(this.stepSize), Float.valueOf(this.valueFrom), Float.valueOf(this.valueTo)});
              Log1F380D.a((Object) format);
              throw new IllegalStateException(format);
          }
      }
  
      private void validateValueFrom() {
          if (this.valueFrom >= this.valueTo) {
              String format = String.format(EXCEPTION_ILLEGAL_VALUE_FROM, new Object[]{Float.valueOf(this.valueFrom), Float.valueOf(this.valueTo)});
              Log1F380D.a((Object) format);
              throw new IllegalStateException(format);
          }
      }
  
      private void validateValueTo() {
          if (this.valueTo <= this.valueFrom) {
              String format = String.format(EXCEPTION_ILLEGAL_VALUE_TO, new Object[]{Float.valueOf(this.valueTo), Float.valueOf(this.valueFrom)});
              Log1F380D.a((Object) format);
              throw new IllegalStateException(format);
          }
      }
  
      private void validateValues() {
          Iterator<Float> it = this.values.iterator();
          while (it.hasNext()) {
              Float next = it.next();
              if (next.floatValue() < this.valueFrom || next.floatValue() > this.valueTo) {
                  String format = String.format(EXCEPTION_ILLEGAL_VALUE, new Object[]{next, Float.valueOf(this.valueFrom), Float.valueOf(this.valueTo)});
                  Log1F380D.a((Object) format);
                  throw new IllegalStateException(format);
              } else if (this.stepSize > 0.0f && !valueLandsOnTick(next.floatValue())) {
                  String format2 = String.format(EXCEPTION_ILLEGAL_DISCRETE_VALUE, new Object[]{next, Float.valueOf(this.valueFrom), Float.valueOf(this.stepSize), Float.valueOf(this.stepSize)});
                  Log1F380D.a((Object) format2);
                  throw new IllegalStateException(format2);
              }
          }
      }
  
      private void warnAboutFloatingPointError() {
          float f = this.stepSize;
          if (f != 0.0f) {
              if (((float) ((int) f)) != f) {
                  String str = TAG;
                  String format = String.format(WARNING_FLOATING_POINT_ERROR, new Object[]{"stepSize", Float.valueOf(f)});
                  Log1F380D.a((Object) format);
                  Log.w(str, format);
              }
              float f2 = this.valueFrom;
              if (((float) ((int) f2)) != f2) {
                  String str2 = TAG;
                  String format2 = String.format(WARNING_FLOATING_POINT_ERROR, new Object[]{"valueFrom", Float.valueOf(f2)});
                  Log1F380D.a((Object) format2);
                  Log.w(str2, format2);
              }
              float f3 = this.valueTo;
              if (((float) ((int) f3)) != f3) {
                  String str3 = TAG;
                  String format3 = String.format(WARNING_FLOATING_POINT_ERROR, new Object[]{"valueTo", Float.valueOf(f3)});
                  Log1F380D.a((Object) format3);
                  Log.w(str3, format3);
              }
          }
      }
  
      public void setStepSize(float stepSize2) {
          if (stepSize2 < 0.0f) {
              String format = String.format(EXCEPTION_ILLEGAL_STEP_SIZE, new Object[]{Float.valueOf(stepSize2), Float.valueOf(this.valueFrom), Float.valueOf(this.valueTo)});
              Log1F380D.a((Object) format);
              throw new IllegalArgumentException(format);
          } else if (this.stepSize != stepSize2) {
              this.stepSize = stepSize2;
              this.dirtyConfig = true;
              postInvalidate();
          }
      }
  }
  