@Override
 protected void onSizeChanged(int w, int h, int oldw, int oldh) {
   super.onSizeChanged(w, h, oldw, oldh);
   if (mProgressBar != null) {
     setupProgressBarBounds();
   }
 }
  private void drawEndlessProgress(Canvas canvas) {
    if (mProgressBar == null) {
      mProgressBar = new ProgressBar(this);
      setupProgressBarBounds();
      mProgressBar.setColorScheme(mColor1, mColor2, mColor3, mColor4);
      mProgressBar.start();
    }

    if (getProgress() > 0) {
      mProgressBar.draw(canvas);
    }
  }