private void updateTileProvider() { ImageEntry entry = mImageCache.get(getVersion(mCurrentIndex)); if (entry == null) { // in loading mTileProvider.clear(); } else { updateTileProvider(entry); } }
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(); }
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(); } }