diff options
author | Bobby Georgescu <georgescu@google.com> | 2012-10-16 18:17:16 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-10-16 18:17:17 -0700 |
commit | 2ad7b55cb31487fbfdbd50d60eb3e929cad0b42f (patch) | |
tree | 00fd1e12ca8b785cd6069ab444240306a7d110aa /src/com/android/gallery3d/ui | |
parent | 488ef8a9eb4d6ac7efd070956058d5ce6a1c3f89 (diff) | |
parent | 641b838e49a445592b17e56b11374d92f99789f2 (diff) | |
download | android_packages_apps_Snap-2ad7b55cb31487fbfdbd50d60eb3e929cad0b42f.tar.gz android_packages_apps_Snap-2ad7b55cb31487fbfdbd50d60eb3e929cad0b42f.tar.bz2 android_packages_apps_Snap-2ad7b55cb31487fbfdbd50d60eb3e929cad0b42f.zip |
Merge "Consistent animations & up button behavior in Gallery" into gb-ub-photos-arches
Diffstat (limited to 'src/com/android/gallery3d/ui')
-rw-r--r-- | src/com/android/gallery3d/ui/GLView.java | 39 | ||||
-rw-r--r-- | src/com/android/gallery3d/ui/PositionController.java | 2 | ||||
-rw-r--r-- | src/com/android/gallery3d/ui/PreparePageFadeoutTexture.java | 2 |
3 files changed, 41 insertions, 2 deletions
diff --git a/src/com/android/gallery3d/ui/GLView.java b/src/com/android/gallery3d/ui/GLView.java index 3924c6e9d..b91b71212 100644 --- a/src/com/android/gallery3d/ui/GLView.java +++ b/src/com/android/gallery3d/ui/GLView.java @@ -21,6 +21,7 @@ import android.os.SystemClock; import android.view.MotionEvent; import com.android.gallery3d.anim.CanvasAnimation; +import com.android.gallery3d.anim.StateTransitionAnimation; import com.android.gallery3d.common.Utils; import java.util.ArrayList; @@ -77,6 +78,11 @@ public class GLView { protected int mScrollHeight = 0; protected int mScrollWidth = 0; + public static final int ANIM_TIME_OPENING = 400; + private RawTexture mFadeOutTexture; + private float [] mBackgroundColor; + private StateTransitionAnimation mTransition = new StateTransitionAnimation(ANIM_TIME_OPENING); + public void startAnimation(CanvasAnimation animation) { GLRoot root = getGLRoot(); if (root == null) throw new IllegalStateException(); @@ -217,13 +223,46 @@ public class GLView { } protected void render(GLCanvas canvas) { + if (mTransition.calculate(AnimationTime.get())) invalidate(); + canvas.save(); renderBackground(canvas); + if (mTransition.isActive()) mTransition.applyForegroundTransformation(this, canvas); for (int i = 0, n = getComponentCount(); i < n; ++i) { renderChild(canvas, getComponent(i)); } + canvas.restore(); + } + + public void setFadeOutTexture(RawTexture texture) { + mFadeOutTexture = texture; + if (mFadeOutTexture != null) { + TiledScreenNail.disableDrawPlaceholder(); + } + mTransition.start(); + } + + public float [] getBackgroundColor() { + return mBackgroundColor; + } + + public void setBackgroundColor(float [] color) { + mBackgroundColor = color; } protected void renderBackground(GLCanvas view) { + if (mBackgroundColor != null) { + view.clearBuffer(mBackgroundColor); + } + if (mFadeOutTexture != null) { + if (!mTransition.isActive()) { + mFadeOutTexture.recycle(); + mFadeOutTexture = null; + TiledScreenNail.enableDrawPlaceholder(); + } else { + mTransition.applyBackground(this, view, mFadeOutTexture); + return; + } + } } protected void renderChild(GLCanvas canvas, GLView component) { diff --git a/src/com/android/gallery3d/ui/PositionController.java b/src/com/android/gallery3d/ui/PositionController.java index fffa7e038..0111847eb 100644 --- a/src/com/android/gallery3d/ui/PositionController.java +++ b/src/com/android/gallery3d/ui/PositionController.java @@ -67,7 +67,7 @@ class PositionController { SNAPBACK_ANIMATION_TIME, // ANIM_KIND_SNAPBACK 400, // ANIM_KIND_SLIDE 300, // ANIM_KIND_ZOOM - PhotoPage.ANIM_TIME_OPENING, // ANIM_KIND_OPENING + GLView.ANIM_TIME_OPENING, // ANIM_KIND_OPENING 0, // ANIM_KIND_FLING (the duration is calculated dynamically) 0, // ANIM_KIND_FLING_X (see the comment above) 0, // ANIM_KIND_DELETE (the duration is calculated dynamically) diff --git a/src/com/android/gallery3d/ui/PreparePageFadeoutTexture.java b/src/com/android/gallery3d/ui/PreparePageFadeoutTexture.java index 812e831e1..7cab753c3 100644 --- a/src/com/android/gallery3d/ui/PreparePageFadeoutTexture.java +++ b/src/com/android/gallery3d/ui/PreparePageFadeoutTexture.java @@ -6,7 +6,7 @@ import com.android.gallery3d.app.AbstractGalleryActivity; import com.android.gallery3d.ui.GLRoot.OnGLIdleListener; public class PreparePageFadeoutTexture implements OnGLIdleListener { - private static final long TIMEOUT = FadeTexture.DURATION; + private static final long TIMEOUT = 500; public static final String KEY_FADE_TEXTURE = "fade_texture"; private RawTexture mTexture; |