Beispiel #1
0
  /**
   * Sets the maximum value for this DiscreteSeekBar if the supplied argument is smaller than the
   * Current MIN value, the MIN value will be set to MAX-1
   *
   * <p>
   *
   * <p>Also if the current progress is out of the new range, it will be set to MIN
   *
   * @param max
   * @see #setMin(int)
   * @see #setProgress(int)
   */
  public void setMax(int max) {
    mMax = max;
    if (mMax < mMin) {
      setMin(mMax - 1);
    }
    updateKeyboardRange();

    if (mValue < mMin || mValue > mMax) {
      setProgress(mMin);
    }
  }
Beispiel #2
0
  @Override
  protected void onRestoreInstanceState(Parcelable state) {
    if (state == null || !state.getClass().equals(CustomState.class)) {
      super.onRestoreInstanceState(state);
      return;
    }

    CustomState customState = (CustomState) state;
    setMin(customState.min);
    setMax(customState.max);
    setProgress(customState.progress, false);
    super.onRestoreInstanceState(customState.getSuperState());
  }