diff options
author | Bobby Georgescu <georgescu@google.com> | 2012-10-15 13:48:08 -0700 |
---|---|---|
committer | Bobby Georgescu <georgescu@google.com> | 2012-10-16 16:30:17 -0700 |
commit | 641b838e49a445592b17e56b11374d92f99789f2 (patch) | |
tree | 1663518062277bad145c2f5d55a907728d51c244 /src/com/android/gallery3d/app/ActivityState.java | |
parent | c057d64b701fc2de9f0d5fec7dbd34779647a442 (diff) | |
download | android_packages_apps_Snap-641b838e49a445592b17e56b11374d92f99789f2.tar.gz android_packages_apps_Snap-641b838e49a445592b17e56b11374d92f99789f2.tar.bz2 android_packages_apps_Snap-641b838e49a445592b17e56b11374d92f99789f2.zip |
Consistent animations & up button behavior in Gallery
Bug: 7302857
Bug: 7295464
This CL makes all of the transition animations throughout
the Gallery app consistent. The animation is the previous
view shrinking and fading out while the new view starts out
bigger than the view port and is coming in to the viewport
size as it fades in. Having consistent animations allows us
to not keep PhotoPage/AlbumPage instances around in certain
cases, making it possible to have consistent up button
behavior when switching between the grid and filmstrip.
Finally, this also makes the transitions in the camera app
filmstrip/grid switching consistent with those in the
gallery app.
Change-Id: I77bac6a0cde1e439738c78f9e16ab15ed5910cfb
Diffstat (limited to 'src/com/android/gallery3d/app/ActivityState.java')
-rw-r--r-- | src/com/android/gallery3d/app/ActivityState.java | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/src/com/android/gallery3d/app/ActivityState.java b/src/com/android/gallery3d/app/ActivityState.java index 75327e477..3ea6896cb 100644 --- a/src/com/android/gallery3d/app/ActivityState.java +++ b/src/com/android/gallery3d/app/ActivityState.java @@ -36,6 +36,8 @@ import android.view.WindowManager; import com.android.gallery3d.R; import com.android.gallery3d.ui.GLView; +import com.android.gallery3d.ui.PreparePageFadeoutTexture; +import com.android.gallery3d.ui.RawTexture; import com.android.gallery3d.util.GalleryUtils; abstract public class ActivityState { @@ -66,11 +68,24 @@ abstract public class ActivityState { private boolean mPlugged = false; boolean mIsFinishing = false; + private static final String KEY_TRANSITION_IN = "transition-in"; + + private RawTexture mFadeOutTexture; + private GLView mContentPane; + private boolean mWantFadeOut = false; + private boolean mTransitionIn; + protected ActivityState() { } protected void setContentPane(GLView content) { - mActivity.getGLRoot().setContentPane(content); + mContentPane = content; + if (mTransitionIn) { + mContentPane.setFadeOutTexture(mFadeOutTexture); + mFadeOutTexture = null; + } + mContentPane.setBackgroundColor(getBackgroundColor()); + mActivity.getGLRoot().setContentPane(mContentPane); } void initialize(AbstractGalleryActivity activity, Bundle data) { @@ -84,6 +99,9 @@ abstract public class ActivityState { } protected void onBackPressed() { + if (mActivity.getStateManager().getStateCount() > 1) { + fadeOutOnNextPause(); + } mActivity.getStateManager().finishState(this); } @@ -157,10 +175,19 @@ abstract public class ActivityState { win.setAttributes(params); } + protected void fadeOutOnNextPause() { + mWantFadeOut = true; + } + protected void onPause() { if (0 != (mFlags & FLAG_SCREEN_ON_WHEN_PLUGGED)) { ((Activity) mActivity).unregisterReceiver(mPowerIntentReceiver); } + if (mWantFadeOut) { + mWantFadeOut = false; + mActivity.getTransitionStore().put(KEY_TRANSITION_IN, true); + PreparePageFadeoutTexture.prepareFadeOutTexture(mActivity, mContentPane); + } } // should only be called by StateManager @@ -214,6 +241,9 @@ abstract public class ActivityState { // a subclass of ActivityState should override the method to resume itself protected void onResume() { + mFadeOutTexture = mActivity.getTransitionStore().get( + PreparePageFadeoutTexture.KEY_FADE_TEXTURE); + mTransitionIn = mActivity.getTransitionStore().get(KEY_TRANSITION_IN, false); } protected boolean onCreateActionBar(Menu menu) { |