/** Sets the current progress (must be between 0 and max). */ public void setProgress(int progress) { if (progress > mMax || progress < 0) { throw new IllegalArgumentException( String.format("Progress (%d) must be between %d and %d", progress, 0, mMax)); } mProgress = progress; if (null != mListener) { if (mProgress == mMax) { mListener.onProgressCompleted(); } else { mListener.onProgressChanged(mProgress, mMax); } } invalidate(); }