Exemplo n.º 1
0
    public void run() {
      boolean waitOnResume = false;
      try {
        if (paused) {
          synchronized (this) {
            KrollDict data = new KrollDict();
            proxy.fireEvent(TiC.EVENT_PAUSE, data);
            waitOnResume = true;
            wait();
          }
        }

        BitmapWithIndex b = loader.getBitmapQueue().take();
        Log.d(TAG, "set image: " + b.index, Log.DEBUG_MODE);
        setImage(b.bitmap);
        fireChange(b.index);

        // When the animation is paused, the timer will pause in the middle of a period.
        // When the animation resumes, the timer resumes from where it left off. As a result, it
        // will look like
        // one frame is left out when resumed (TIMOB-10207).
        // To avoid this, we force the thread to wait for one period on resume.
        if (waitOnResume) {
          Thread.sleep(currentDuration);
          waitOnResume = false;
        }
      } catch (InterruptedException e) {
        Log.e(TAG, "Loader interrupted");
      }
    }
 public void run() {
   try {
     BitmapWithIndex b = loader.getBitmapQueue().take();
     if (DBG) {
       Log.d(LCAT, "set image: " + b.index);
     }
     setImage(b.bitmap);
     fireChange(b.index);
   } catch (InterruptedException e) {
     Log.e(LCAT, "Loader interrupted");
   }
 }