コード例 #1
0
ファイル: Timeout.java プロジェクト: GermainZ/AcDisplay
 public Gui(ProgressBar progressBar) {
   mProgressBar = progressBar;
   mProgressBar.setMax(MAX);
   mProgressBar.setProgress(MAX);
   mProgressBarAnimation = new ProgressBarAnimation(mProgressBar, MAX, 0);
   mProgressBarAnimation.setInterpolator(new LinearInterpolator());
 }
コード例 #2
0
ファイル: Timeout.java プロジェクト: GermainZ/AcDisplay
 @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;
   }
 }