/**
   * Set the range of the progress bar to 0...<tt>max</tt>.
   *
   * @param max the upper range of this progress bar
   * @see #getMax()
   * @see #setProgress(int)
   * @see #setSecondaryProgress(int)
   */
  @android.view.RemotableViewMethod
  public synchronized void setMax(int max) {
    if (max < 0) {
      max = 0;
    }
    if (max != mMax) {
      mMax = max;
      postInvalidate();

      if (mProgress > max) {
        mProgress = max;
        refreshProgress(R.id.progress, mProgress, false);
      }
    }
  }
  /**
   * Set the current secondary progress to the specified value. Does not do anything if the progress
   * bar is in indeterminate mode.
   *
   * @param secondaryProgress the new secondary progress, between 0 and {@link #getMax()}
   * @see #setIndeterminate(boolean)
   * @see #isIndeterminate()
   * @see #getSecondaryProgress()
   * @see #incrementSecondaryProgressBy(int)
   */
  @android.view.RemotableViewMethod
  public synchronized void setSecondaryProgress(int secondaryProgress) {
    if (mIndeterminate) {
      return;
    }

    if (secondaryProgress < 0) {
      secondaryProgress = 0;
    }

    if (secondaryProgress > mMax) {
      secondaryProgress = mMax;
    }

    if (secondaryProgress != mSecondaryProgress) {
      mSecondaryProgress = secondaryProgress;
      refreshProgress(R.id.secondaryProgress, mSecondaryProgress, false);
    }
  }
  @android.view.RemotableViewMethod
  synchronized void setProgress(int progress, boolean fromUser) {
    if (mIndeterminate) {
      return;
    }

    if (progress < 0) {
      progress = 0;
    }

    if (progress > mMax) {
      progress = mMax;
    }

    if (progress != mProgress) {
      mProgress = progress;
      refreshProgress(R.id.progress, mProgress, fromUser);
    }
  }