Ejemplo n.º 1
0
 public Gui(ProgressBar progressBar) {
   mProgressBar = progressBar;
   mProgressBar.setMax(MAX);
   mProgressBar.setProgress(MAX);
   mProgressBarAnimation = new ProgressBarAnimation(mProgressBar, MAX, 0);
   mProgressBarAnimation.setInterpolator(new LinearInterpolator());
 }
Ejemplo n.º 2
0
 @Override
 public void onTimeoutEvent(Timeout timeout, int event) {
   switch (event) {
     case Timeout.EVENT_PAUSED:
       mProgressBar.clearAnimation();
       break;
     case Timeout.EVENT_RESUMED:
     case Timeout.EVENT_CHANGED:
       long remainingTime = timeout.getRemainingTime();
       if (remainingTime > 0 && !timeout.isPaused()) {
         int progress = (int) (mProgressBar.getMax() * (1f - timeout.getProgress()));
         mProgressBarAnimation.setRange(progress, 0);
         mProgressBarAnimation.setDuration(remainingTime);
         mProgressBar.setProgress(progress);
         mProgressBar.startAnimation(mProgressBarAnimation);
       }
       break;
     case Timeout.EVENT_CLEARED:
       mProgressBar.clearAnimation();
       mProgressBar.setProgress(mProgressBar.getMax());
       break;
   }
 }