summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/android/gallery3d/app/PhotoDataAdapter.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/com/android/gallery3d/app/PhotoDataAdapter.java b/src/com/android/gallery3d/app/PhotoDataAdapter.java
index 78afe7ee7..b976dec84 100644
--- a/src/com/android/gallery3d/app/PhotoDataAdapter.java
+++ b/src/com/android/gallery3d/app/PhotoDataAdapter.java
@@ -214,11 +214,12 @@ public class PhotoDataAdapter implements PhotoPage.Model {
private void updateScreenNail(long version, Future<Bitmap> future) {
ImageEntry entry = mImageCache.get(version);
- if (entry == null || entry.screenNailTask == null) {
+ if (entry == null || entry.screenNailTask != future) {
Bitmap screenNail = future.get();
if (screenNail != null) screenNail.recycle();
return;
}
+
entry.screenNailTask = null;
entry.screenNail = future.get();
@@ -240,11 +241,12 @@ public class PhotoDataAdapter implements PhotoPage.Model {
private void updateFullImage(long version, Future<BitmapRegionDecoder> future) {
ImageEntry entry = mImageCache.get(version);
- if (entry == null || entry.fullImageTask == null) {
+ 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) {
@@ -567,12 +569,14 @@ public class PhotoDataAdapter implements PhotoPage.Model {
mVersion = version;
}
+ @Override
public void onFutureDone(Future<BitmapRegionDecoder> future) {
mFuture = future;
mMainHandler.sendMessage(
mMainHandler.obtainMessage(MSG_RUN_OBJECT, this));
}
+ @Override
public void run() {
updateFullImage(mVersion, mFuture);
}
@@ -587,12 +591,14 @@ public class PhotoDataAdapter implements PhotoPage.Model {
mVersion = version;
}
+ @Override
public void onFutureDone(Future<Bitmap> future) {
mFuture = future;
mMainHandler.sendMessage(
mMainHandler.obtainMessage(MSG_RUN_OBJECT, this));
}
+ @Override
public void run() {
updateScreenNail(mVersion, mFuture);
}