|
@@ -157,6 +157,14 @@ public class ThumbnailsCacheManager {
|
|
|
mAccount = account;
|
|
|
}
|
|
|
|
|
|
+ public ThumbnailGenerationTask(FileDataStorageManager storageManager, Account account){
|
|
|
+ if (storageManager == null)
|
|
|
+ throw new IllegalArgumentException("storageManager must not be NULL");
|
|
|
+ mStorageManager = storageManager;
|
|
|
+ mAccount = account;
|
|
|
+ mImageViewReference = null;
|
|
|
+ }
|
|
|
+
|
|
|
public ThumbnailGenerationTask(ImageView imageView) {
|
|
|
// Use a WeakReference to ensure the ImageView can be garbage collected
|
|
|
mImageViewReference = new WeakReference<ImageView>(imageView);
|
|
@@ -195,7 +203,7 @@ public class ThumbnailsCacheManager {
|
|
|
}
|
|
|
|
|
|
protected void onPostExecute(Bitmap bitmap){
|
|
|
- if (bitmap != null) {
|
|
|
+ if (bitmap != null && mImageViewReference != null) {
|
|
|
final ImageView imageView = mImageViewReference.get();
|
|
|
final ThumbnailGenerationTask bitmapWorkerTask = getBitmapWorkerTask(imageView);
|
|
|
if (this == bitmapWorkerTask) {
|