diff options
author | nicolasroard <nicolasroard@google.com> | 2013-10-11 18:27:55 -0700 |
---|---|---|
committer | nicolasroard <nicolasroard@google.com> | 2013-10-11 18:34:05 -0700 |
commit | 976b9a3a98f48ed69bbe66070e2e2e3f3e6aae43 (patch) | |
tree | a418e4c8d2d1e31846447e27e78aae6f334a887c /src/com | |
parent | eeed64b1fbdafe5c91ce36b3c5488c003fbb8fab (diff) | |
download | android_packages_apps_Gallery2-976b9a3a98f48ed69bbe66070e2e2e3f3e6aae43.tar.gz android_packages_apps_Gallery2-976b9a3a98f48ed69bbe66070e2e2e3f3e6aae43.tar.bz2 android_packages_apps_Gallery2-976b9a3a98f48ed69bbe66070e2e2e3f3e6aae43.zip |
Fix showing the wrong image after animation
bug:10856175
Change-Id: I87d2bcd1bb1a4ee28536a97f018b6a3cf409d1b8
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/gallery3d/filtershow/imageshow/ImageShow.java | 23 | ||||
-rw-r--r-- | src/com/android/gallery3d/filtershow/imageshow/MasterImage.java | 6 |
2 files changed, 14 insertions, 15 deletions
diff --git a/src/com/android/gallery3d/filtershow/imageshow/ImageShow.java b/src/com/android/gallery3d/filtershow/imageshow/ImageShow.java index 5fd971ac4..7089e6036 100644 --- a/src/com/android/gallery3d/filtershow/imageshow/ImageShow.java +++ b/src/com/android/gallery3d/filtershow/imageshow/ImageShow.java @@ -366,8 +366,21 @@ public class ImageShow extends View implements OnGestureListener, m.mapRect(d); d.roundOut(mImageBounds); - if (master.onGoingNewLookAnimation()) { + boolean showAnimatedImage = master.onGoingNewLookAnimation(); + if (!showAnimatedImage && mDidStartAnimation) { + // animation ended, but do we have the correct image to show? + if (master.getPreset().equals(master.getCurrentPreset())) { + // we do, let's stop showing the animated image + mDidStartAnimation = false; + MasterImage.getImage().resetAnimBitmap(); + } else { + showAnimatedImage = true; + } + } else if (showAnimatedImage) { mDidStartAnimation = true; + } + + if (showAnimatedImage) { canvas.save(); // Animation uses the image before the change @@ -472,14 +485,6 @@ public class ImageShow extends View implements OnGestureListener, canvas.drawBitmap(image, m, mPaint); } - if (!master.onGoingNewLookAnimation() - && mDidStartAnimation - && !master.getPreviousPreset().equals(master.getCurrentPreset())) { - mDidStartAnimation = false; - MasterImage.getImage().resetAnimBitmap(); - invalidate(); - } - canvas.restore(); } diff --git a/src/com/android/gallery3d/filtershow/imageshow/MasterImage.java b/src/com/android/gallery3d/filtershow/imageshow/MasterImage.java index dc2a54d5c..3513ded12 100644 --- a/src/com/android/gallery3d/filtershow/imageshow/MasterImage.java +++ b/src/com/android/gallery3d/filtershow/imageshow/MasterImage.java @@ -83,7 +83,6 @@ public class MasterImage implements RenderingRequestCaller { private Bitmap mPartialBitmap = null; private Bitmap mHighresBitmap = null; private Bitmap mPreviousImage = null; - private ImagePreset mPreviousPreset = null; private int mShadowMargin = 15; // not scaled, fixed in the asset private Rect mPartialBounds = new Rect(); @@ -366,10 +365,6 @@ public class MasterImage implements RenderingRequestCaller { return mPreviousImage; } - public ImagePreset getPreviousPreset() { - return mPreviousPreset; - } - public ImagePreset getCurrentPreset() { return getPreviewBuffer().getConsumer().getPreset(); } @@ -426,7 +421,6 @@ public class MasterImage implements RenderingRequestCaller { resetAnimBitmap(); mPreviousImage = mBitmapCache.getBitmapCopy(getFilteredImage(), BitmapCache.NEW_LOOK); } - mPreviousPreset = getPreviewBuffer().getConsumer().getPreset(); if (newRepresentation instanceof FilterUserPresetRepresentation) { mCurrentLookAnimation = CIRCLE_ANIMATION; mAnimator = ValueAnimator.ofFloat(0, 1); |