summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYuli Huang <yuli@google.com>2012-05-16 19:25:16 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-05-16 19:25:16 -0700
commitbcfa1b79930e567c6a52235445c759d37041ed0c (patch)
treeb6537645fda519686d3783dba490b3c502273c5e
parentff6687e68791b86eeda54194b6bcddffb69651da (diff)
parentf320b8429dd5c68c117b8e9b1a36a435f4f4ff13 (diff)
downloadandroid_packages_apps_Gallery2-bcfa1b79930e567c6a52235445c759d37041ed0c.tar.gz
android_packages_apps_Gallery2-bcfa1b79930e567c6a52235445c759d37041ed0c.tar.bz2
android_packages_apps_Gallery2-bcfa1b79930e567c6a52235445c759d37041ed0c.zip
Merge "Fix card effect shown in opening animation." into jb-dev
-rw-r--r--src/com/android/gallery3d/ui/PhotoView.java3
-rw-r--r--src/com/android/gallery3d/ui/PositionController.java16
2 files changed, 18 insertions, 1 deletions
diff --git a/src/com/android/gallery3d/ui/PhotoView.java b/src/com/android/gallery3d/ui/PhotoView.java
index 1c0484979..7f3bee0a3 100644
--- a/src/com/android/gallery3d/ui/PhotoView.java
+++ b/src/com/android/gallery3d/ui/PhotoView.java
@@ -521,7 +521,8 @@ public class PhotoView extends GLView {
canvas.save(GLCanvas.SAVE_FLAG_MATRIX | GLCanvas.SAVE_FLAG_ALPHA);
float filmRatio = mPositionController.getFilmRatio();
boolean wantsCardEffect = CARD_EFFECT && !mIsCamera
- && filmRatio != 1f && !mPictures.get(-1).isCamera();
+ && filmRatio != 1f && !mPictures.get(-1).isCamera()
+ && !mPositionController.inOpeningAnimation();
if (wantsCardEffect) {
// Calculate the move-out progress value.
int left = r.left;
diff --git a/src/com/android/gallery3d/ui/PositionController.java b/src/com/android/gallery3d/ui/PositionController.java
index 99d36baec..1be601e1d 100644
--- a/src/com/android/gallery3d/ui/PositionController.java
+++ b/src/com/android/gallery3d/ui/PositionController.java
@@ -286,12 +286,21 @@ class PositionController {
// Start animation from the saved rectangle if we have one.
Rect r = mOpenAnimationRect;
mOpenAnimationRect = null;
+
mPlatform.mCurrentX = r.centerX() - mViewW / 2;
b.mCurrentY = r.centerY() - mViewH / 2;
b.mCurrentScale = Math.max(r.width() / (float) b.mImageW,
r.height() / (float) b.mImageH);
startAnimation(mPlatform.mDefaultX, 0, b.mScaleMin,
ANIM_KIND_OPENING);
+
+ // Animate from large gaps for neighbor boxes to avoid them
+ // shown on the screen during opening animation.
+ for (int i = -1; i < 1; i++) {
+ Gap g = mGaps.get(i);
+ g.mCurrentGap = mViewW;
+ g.doAnimation(g.mDefaultSize, ANIM_KIND_OPENING);
+ }
}
public void setFilmMode(boolean enabled) {
@@ -661,6 +670,13 @@ class PositionController {
if (changed) redraw();
}
+ public boolean inOpeningAnimation() {
+ return (mPlatform.mAnimationKind == ANIM_KIND_OPENING &&
+ mPlatform.mAnimationStartTime != NO_ANIMATION) ||
+ (mBoxes.get(0).mAnimationKind == ANIM_KIND_OPENING &&
+ mBoxes.get(0).mAnimationStartTime != NO_ANIMATION);
+ }
+
////////////////////////////////////////////////////////////////////////////
// Layout
////////////////////////////////////////////////////////////////////////////