private void updateTileProvider() {
   ImageEntry entry = mImageCache.get(getVersion(mCurrentIndex));
   if (entry == null) { // in loading
     mTileProvider.clear();
   } else {
     updateTileProvider(entry);
   }
 }
 private void updateTileProvider(ImageEntry entry) {
   Bitmap screenNail = entry.screenNail;
   BitmapRegionDecoder fullImage = entry.fullImage;
   if (screenNail != null) {
     if (fullImage != null) {
       mTileProvider.setBackupImage(screenNail, fullImage.getWidth(), fullImage.getHeight());
       mTileProvider.setRegionDecoder(fullImage);
     } else {
       int width = screenNail.getWidth();
       int height = screenNail.getHeight();
       mTileProvider.setBackupImage(screenNail, width, height);
     }
   } else {
     mTileProvider.clear();
     if (entry.failToLoad) mTileProvider.setFailedToLoad();
   }
 }
  public void pause() {
    mIsActive = false;

    mReloadTask.terminate();
    mReloadTask = null;

    mSource.removeContentListener(mSourceListener);

    for (ImageEntry entry : mImageCache.values()) {
      if (entry.fullImageTask != null) entry.fullImageTask.cancel();
      if (entry.screenNailTask != null) entry.screenNailTask.cancel();
    }
    mImageCache.clear();
    mTileProvider.clear();
  }
 public boolean isFailedToLoad() {
   return mTileProvider.isFailedToLoad();
 }
 public Bitmap getTile(int level, int x, int y, int tileSize) {
   return mTileProvider.getTile(level, x, y, tileSize);
 }
 public int getLevelCount() {
   return mTileProvider.getLevelCount();
 }
 public int getImageWidth() {
   return mTileProvider.getImageWidth();
 }
 public int getImageHeight() {
   return mTileProvider.getImageHeight();
 }
 public Bitmap getBackupImage() {
   return mTileProvider.getBackupImage();
 }