Example #1
0
  private void updateScreenNail(long version, Future<Bitmap> future) {
    ImageEntry entry = mImageCache.get(version);
    if (entry == null || entry.screenNailTask != future) {
      Bitmap screenNail = future.get();
      if (screenNail != null) screenNail.recycle();
      return;
    }

    entry.screenNailTask = null;
    entry.screenNail = future.get();

    if (entry.screenNail == null) {
      entry.failToLoad = true;
      /*a@nufront start*/
      for (int i = -1; i <= 1; ++i) {
        if (version == getVersion(mCurrentIndex + i)) {
          if (0 == i) updateTileProvider(entry);
          mPhotoView.notifyImageInvalidated(i);
        }
      }
      /*a@nufront end*/
    } else {
      if (mDataListener != null) {
        mDataListener.onPhotoAvailable(version, false);
      }
      for (int i = -1; i <= 1; ++i) {
        if (version == getVersion(mCurrentIndex + i)) {
          if (i == 0) updateTileProvider(entry);
          mPhotoView.notifyImageInvalidated(i);
        }
      }
    }
    updateImageRequests();
  }
Example #2
0
 private void fireModelInvalidated() {
   for (int i = -1; i <= 1; ++i) {
     long current = getVersion(mCurrentIndex + i);
     long change = mChanges[i + 1];
     if (current != change) {
       mPhotoView.notifyImageInvalidated(i);
       mChanges[i + 1] = current;
     }
   }
 }
Example #3
0
  public void resume() {
    mIsActive = true;
    mSource.addContentListener(mSourceListener);
    updateImageCache();
    updateImageRequests();

    mReloadTask = new ReloadTask();
    mReloadTask.start();

    mPhotoView.notifyModelInvalidated();
  }
Example #4
0
  private void updateCurrentIndex(int index) {
    mCurrentIndex = index;
    updateSlidingWindow();

    MediaItem item = mData[index % DATA_CACHE_SIZE];
    mItemPath = item == null ? null : item.getPath();

    updateImageCache();
    updateImageRequests();
    updateTileProvider();
    mPhotoView.notifyOnNewImage();

    if (mDataListener != null) {
      mDataListener.onPhotoChanged(index, mItemPath);
    }
    fireModelInvalidated();
  }
Example #5
0
  private void updateFullImage(long version, Future<BitmapRegionDecoder> future) {
    ImageEntry entry = mImageCache.get(version);
    if (entry == null || entry.fullImageTask != future) {
      BitmapRegionDecoder fullImage = future.get();
      if (fullImage != null) fullImage.recycle();
      return;
    }

    entry.fullImageTask = null;
    entry.fullImage = future.get();
    if (entry.fullImage != null) {
      if (mDataListener != null) {
        mDataListener.onPhotoAvailable(version, true);
      }
      if (version == getVersion(mCurrentIndex)) {
        updateTileProvider(entry);
        mPhotoView.notifyImageInvalidated(0);
      }
    }
    updateImageRequests();
  }