summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBobby Georgescu <georgescu@google.com>2012-10-16 18:17:16 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-10-16 18:17:17 -0700
commit74d5dfd662b92c9ce1aee225291b9d1775cfb49e (patch)
tree269e30d519f4643a95ec8059410f916ab320929a
parent2b543897e077ee4803fa60b6fd7a6a604835b0b3 (diff)
parent5585826e68c62c3719fb346d40fd1999438c6c6b (diff)
downloadandroid_packages_apps_Gallery2-74d5dfd662b92c9ce1aee225291b9d1775cfb49e.tar.gz
android_packages_apps_Gallery2-74d5dfd662b92c9ce1aee225291b9d1775cfb49e.tar.bz2
android_packages_apps_Gallery2-74d5dfd662b92c9ce1aee225291b9d1775cfb49e.zip
Merge "Consistent animations & up button behavior in Gallery" into gb-ub-photos-arches
-rw-r--r--src/com/android/gallery3d/anim/StateTransitionAnimation.java77
-rw-r--r--src/com/android/gallery3d/app/ActivityState.java32
-rw-r--r--src/com/android/gallery3d/app/AlbumPage.java27
-rw-r--r--src/com/android/gallery3d/app/AlbumSetPage.java7
-rw-r--r--src/com/android/gallery3d/app/PhotoPage.java64
-rw-r--r--src/com/android/gallery3d/app/StateManager.java6
-rw-r--r--src/com/android/gallery3d/ui/GLView.java39
-rw-r--r--src/com/android/gallery3d/ui/PositionController.java2
-rw-r--r--src/com/android/gallery3d/ui/PreparePageFadeoutTexture.java2
9 files changed, 168 insertions, 88 deletions
diff --git a/src/com/android/gallery3d/anim/StateTransitionAnimation.java b/src/com/android/gallery3d/anim/StateTransitionAnimation.java
new file mode 100644
index 000000000..ffe753db7
--- /dev/null
+++ b/src/com/android/gallery3d/anim/StateTransitionAnimation.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.gallery3d.anim;
+
+import android.view.animation.DecelerateInterpolator;
+
+import com.android.gallery3d.ui.GLCanvas;
+import com.android.gallery3d.ui.GLView;
+import com.android.gallery3d.ui.RawTexture;
+
+public class StateTransitionAnimation extends Animation {
+ private static final float BACKGROUND_ALPHA_FROM = 1f;
+ private static final float BACKGROUND_ALPHA_TO = 0f;
+ private static final float BACKGROUND_SCALE_FROM = 1f;
+ private static final float BACKGROUND_SCALE_TO = 0f;
+ private static final float FOREGROUND_ALPHA_FROM = 0.9f;
+ private static final float FOREGROUND_ALPHA_TO = 1f;
+ private static final float FOREGROUND_SCALE_FROM = 3f;
+ private static final float FOREGROUND_SCALE_TO = 1f;
+
+ private float mCurrentForegroundScale;
+ private float mCurrentBackgroundScale;
+ private float mCurrentBackgroundAlpha;
+ private float mCurrentForegroundAlpha;
+
+ public StateTransitionAnimation(int duration) {
+ setDuration(duration);
+ setInterpolator(new DecelerateInterpolator());
+ }
+
+ @Override
+ protected void onCalculate(float progress) {
+ mCurrentForegroundScale = FOREGROUND_SCALE_FROM
+ + (FOREGROUND_SCALE_TO - FOREGROUND_SCALE_FROM) * progress;
+ mCurrentForegroundAlpha = FOREGROUND_ALPHA_FROM
+ + (FOREGROUND_ALPHA_TO - FOREGROUND_ALPHA_FROM) * progress;
+ mCurrentBackgroundAlpha = BACKGROUND_ALPHA_FROM
+ + (BACKGROUND_ALPHA_TO - BACKGROUND_ALPHA_FROM) * progress;
+ mCurrentBackgroundScale = BACKGROUND_SCALE_FROM
+ + (BACKGROUND_SCALE_TO - BACKGROUND_SCALE_FROM) * progress;
+ }
+
+ public void applyBackground(GLView view, GLCanvas canvas, RawTexture fadeTexture) {
+ canvas.clearBuffer(view.getBackgroundColor());
+ canvas.save();
+ canvas.setAlpha(mCurrentBackgroundAlpha);
+ int xOffset = view.getWidth() / 2;
+ int yOffset = view.getHeight() / 2;
+ canvas.translate(xOffset, yOffset);
+ canvas.scale(mCurrentBackgroundScale, mCurrentBackgroundScale, 1);
+ fadeTexture.draw(canvas, -xOffset, -yOffset);
+ canvas.restore();
+ }
+
+ public void applyForegroundTransformation(GLView view, GLCanvas canvas) {
+ int xOffset = view.getWidth() / 2;
+ int yOffset = view.getHeight() / 2;
+ canvas.translate(xOffset, yOffset);
+ canvas.scale(mCurrentForegroundScale, mCurrentForegroundScale, 1);
+ canvas.translate(-xOffset, -yOffset);
+ canvas.setAlpha(mCurrentForegroundAlpha);
+ }
+}
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) {
diff --git a/src/com/android/gallery3d/app/AlbumPage.java b/src/com/android/gallery3d/app/AlbumPage.java
index c956bc969..edaf8caa7 100644
--- a/src/com/android/gallery3d/app/AlbumPage.java
+++ b/src/com/android/gallery3d/app/AlbumPage.java
@@ -47,7 +47,6 @@ import com.android.gallery3d.ui.GLCanvas;
import com.android.gallery3d.ui.GLRoot;
import com.android.gallery3d.ui.GLView;
import com.android.gallery3d.ui.PhotoFallbackEffect;
-import com.android.gallery3d.ui.PreparePageFadeoutTexture;
import com.android.gallery3d.ui.RelativePosition;
import com.android.gallery3d.ui.SelectionManager;
import com.android.gallery3d.ui.SlotView;
@@ -139,11 +138,6 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster
private final float mMatrix[] = new float[16];
@Override
- protected void renderBackground(GLCanvas view) {
- view.clearBuffer(getBackgroundColor());
- }
-
- @Override
protected void onLayout(
boolean changed, int left, int top, int right, int bottom) {
@@ -254,8 +248,6 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster
} else {
// Render transition in pressed state
mAlbumView.setPressedIndex(slotIndex);
- PreparePageFadeoutTexture.prepareFadeOutTexture(mActivity, mRootPane);
- mAlbumView.setPressedIndex(-1);
pickPhoto(slotIndex);
}
@@ -300,8 +292,12 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster
data.putBoolean(PhotoPage.KEY_START_IN_FILMSTRIP,
startInFilmstrip);
data.putBoolean(PhotoPage.KEY_IN_CAMERA_ROLL, mMediaSet.isCameraRoll());
- mActivity.getStateManager().startStateForResult(
- PhotoPage.class, REQUEST_PHOTO, data);
+ if (startInFilmstrip) {
+ mActivity.getStateManager().switchState(this, PhotoPage.class, data);
+ } else {
+ mActivity.getStateManager().startStateForResult(
+ PhotoPage.class, REQUEST_PHOTO, data);
+ }
}
}
@@ -373,15 +369,6 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster
mLaunchedFromPhotoPage =
mActivity.getStateManager().hasStateClass(PhotoPage.class);
mInCameraApp = data.getBoolean(PhotoPage.KEY_APP_BRIDGE, false);
-
- // Don't show animation if it is restored or switched from filmstrip
- if (!mLaunchedFromPhotoPage && restoreState == null && data != null) {
- int[] center = data.getIntArray(KEY_SET_CENTER);
- if (center != null) {
- mOpenCenter.setAbsolutePosition(center[0], center[1]);
- mSlotView.startScatteringAnimation(mOpenCenter);
- }
- }
}
@Override
@@ -411,6 +398,7 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster
mAlbumDataAdapter.resume();
mAlbumView.resume();
+ mAlbumView.setPressedIndex(-1);
mActionModeHandler.resume();
if (!mInitialSynced) {
setLoadingBit(BIT_LOADING_SYNC);
@@ -561,7 +549,6 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster
if (mAlbumDataAdapter == null || !mAlbumDataAdapter.isActive(slotIndex)) return;
MediaItem item = mAlbumDataAdapter.get(slotIndex);
if (item == null) return;
- PreparePageFadeoutTexture.prepareFadeOutTexture(mActivity, mRootPane);
TransitionStore transitions = mActivity.getTransitionStore();
transitions.put(PhotoPage.KEY_INDEX_HINT, slotIndex);
transitions.put(PhotoPage.KEY_OPEN_ANIMATION_RECT,
diff --git a/src/com/android/gallery3d/app/AlbumSetPage.java b/src/com/android/gallery3d/app/AlbumSetPage.java
index 2cb1ca2fa..49ab683be 100644
--- a/src/com/android/gallery3d/app/AlbumSetPage.java
+++ b/src/com/android/gallery3d/app/AlbumSetPage.java
@@ -52,7 +52,6 @@ import com.android.gallery3d.ui.FadeTexture;
import com.android.gallery3d.ui.GLCanvas;
import com.android.gallery3d.ui.GLRoot;
import com.android.gallery3d.ui.GLView;
-import com.android.gallery3d.ui.PreparePageFadeoutTexture;
import com.android.gallery3d.ui.SelectionManager;
import com.android.gallery3d.ui.SlotView;
import com.android.gallery3d.ui.SynchronizedHandler;
@@ -130,11 +129,6 @@ public class AlbumSetPage extends ActivityState implements
private final float mMatrix[] = new float[16];
@Override
- protected void renderBackground(GLCanvas view) {
- view.clearBuffer(getBackgroundColor());
- }
-
- @Override
protected void onLayout(
boolean changed, int left, int top, int right, int bottom) {
mEyePosition.resetPosition();
@@ -273,7 +267,6 @@ public class AlbumSetPage extends ActivityState implements
& MediaObject.SUPPORT_IMPORT) != 0) {
data.putBoolean(AlbumPage.KEY_AUTO_SELECT_ALL, true);
} else if (!mGetContent && albumShouldOpenInFilmstrip(targetSet)) {
- PreparePageFadeoutTexture.prepareFadeOutTexture(mActivity, mRootPane);
data.putParcelable(PhotoPage.KEY_OPEN_ANIMATION_RECT,
mSlotView.getSlotRect(slotIndex, mRootPane));
data.putInt(PhotoPage.KEY_INDEX_HINT, 0);
diff --git a/src/com/android/gallery3d/app/PhotoPage.java b/src/com/android/gallery3d/app/PhotoPage.java
index 8d6bc60ac..ba9bf8c42 100644
--- a/src/com/android/gallery3d/app/PhotoPage.java
+++ b/src/com/android/gallery3d/app/PhotoPage.java
@@ -34,12 +34,10 @@ import android.os.Message;
import android.os.SystemClock;
import android.view.Menu;
import android.view.MenuItem;
-import android.view.animation.AccelerateInterpolator;
import android.widget.RelativeLayout;
import android.widget.Toast;
import com.android.gallery3d.R;
-import com.android.gallery3d.anim.FloatAnimation;
import com.android.gallery3d.common.ApiHelper;
import com.android.gallery3d.common.Utils;
import com.android.gallery3d.data.ComboAlbum;
@@ -61,7 +59,6 @@ import com.android.gallery3d.data.SnailItem;
import com.android.gallery3d.data.SnailSource;
import com.android.gallery3d.picasasource.PicasaSource;
import com.android.gallery3d.ui.AnimationTime;
-import com.android.gallery3d.ui.TiledScreenNail;
import com.android.gallery3d.ui.DetailsHelper;
import com.android.gallery3d.ui.DetailsHelper.CloseListener;
import com.android.gallery3d.ui.DetailsHelper.DetailsSource;
@@ -73,8 +70,6 @@ import com.android.gallery3d.ui.ImportCompleteListener;
import com.android.gallery3d.ui.MenuExecutor;
import com.android.gallery3d.ui.PhotoFallbackEffect;
import com.android.gallery3d.ui.PhotoView;
-import com.android.gallery3d.ui.PreparePageFadeoutTexture;
-import com.android.gallery3d.ui.RawTexture;
import com.android.gallery3d.ui.SelectionManager;
import com.android.gallery3d.ui.SynchronizedHandler;
import com.android.gallery3d.util.GalleryUtils;
@@ -166,7 +161,6 @@ public class PhotoPage extends ActivityState implements
private boolean mTreatBackAsUp;
private boolean mStartInFilmstrip;
private boolean mInCameraRoll;
- private boolean mStartedFromAlbumPage;
private boolean mRecenterCameraOnResume = true;
private long mCameraSwitchCutoff = 0;
@@ -177,9 +171,7 @@ public class PhotoPage extends ActivityState implements
private boolean mDeferredUpdateWaiting = false;
private long mDeferUpdateUntil = Long.MAX_VALUE;
- private RawTexture mFadeOutTexture;
private Rect mOpenAnimationRect;
- public static final int ANIM_TIME_OPENING = 300;
// The item that is deleted (but it can still be undeleted before commiting)
private Path mDeletePath;
@@ -221,13 +213,6 @@ public class PhotoPage extends ActivityState implements
}
}
- private static class BackgroundFadeOut extends FloatAnimation {
- public BackgroundFadeOut() {
- super(1f, 0f, ANIM_TIME_OPENING);
- setInterpolator(new AccelerateInterpolator(2f));
- }
- }
-
private class UpdateProgressListener implements StitchingChangeListener {
@Override
@@ -254,8 +239,6 @@ public class PhotoPage extends ActivityState implements
}
};
- private final FloatAnimation mBackgroundFade = new BackgroundFadeOut();
-
@Override
protected int getBackgroundColorId() {
return R.color.photo_background;
@@ -263,28 +246,6 @@ public class PhotoPage extends ActivityState implements
private final GLView mRootPane = new GLView() {
@Override
- protected void renderBackground(GLCanvas view) {
- if (mFadeOutTexture != null) {
- if (mBackgroundFade.calculate(AnimationTime.get())) invalidate();
- if (!mBackgroundFade.isActive()) {
- mFadeOutTexture = null;
- mOpenAnimationRect = null;
- TiledScreenNail.enableDrawPlaceholder();
- } else {
- float fadeAlpha = mBackgroundFade.get();
- if (fadeAlpha < 1f) {
- view.clearBuffer(getBackgroundColor());
- view.setAlpha(fadeAlpha);
- }
- mFadeOutTexture.draw(view, 0, 0);
- view.setAlpha(1f - fadeAlpha);
- return;
- }
- }
- view.clearBuffer(getBackgroundColor());
- }
-
- @Override
protected void onLayout(
boolean changed, int left, int top, int right, int bottom) {
mPhotoView.layout(0, 0, right - left, bottom - top);
@@ -402,9 +363,6 @@ public class PhotoPage extends ActivityState implements
mTreatBackAsUp = data.getBoolean(KEY_TREAT_BACK_AS_UP, false);
mStartInFilmstrip = data.getBoolean(KEY_START_IN_FILMSTRIP, false);
mInCameraRoll = data.getBoolean(KEY_IN_CAMERA_ROLL, false);
- mStartedFromAlbumPage =
- data.getInt(KEY_ALBUMPAGE_TRANSITION,
- MSG_ALBUMPAGE_NONE) == MSG_ALBUMPAGE_STARTED;
mCurrentIndex = data.getInt(KEY_INDEX_HINT, 0);
if (mSetPathString != null) {
mShowSpinner = true;
@@ -970,11 +928,10 @@ public class PhotoPage extends ActivityState implements
};
private void switchToGrid() {
- if (mStartedFromAlbumPage) {
+ if (mActivity.getStateManager().hasStateClass(AlbumPage.class)) {
onUpPressed();
} else {
if (mOriginalSetPathString == null) return;
- preparePhotoFallbackView();
Bundle data = new Bundle(getData());
data.putString(AlbumPage.KEY_MEDIA_PATH, mOriginalSetPathString);
data.putString(AlbumPage.KEY_PARENT_MEDIA_PATH,
@@ -993,7 +950,11 @@ public class PhotoPage extends ActivityState implements
mActivity.getTransitionStore().put(KEY_RETURN_INDEX_HINT,
mAppBridge != null ? mCurrentIndex - 1 : mCurrentIndex);
- mActivity.getStateManager().startState(AlbumPage.class, data);
+ if (mInCameraRoll && mAppBridge != null) {
+ mActivity.getStateManager().startState(AlbumPage.class, data);
+ } else {
+ mActivity.getStateManager().switchState(this, AlbumPage.class, data);
+ }
}
}
@@ -1304,7 +1265,6 @@ public class PhotoPage extends ActivityState implements
// Hide the detail dialog on exit
if (mShowDetails) hideDetails();
if (mModel != null) {
- if (isFinishing()) preparePhotoFallbackView();
mModel.pause();
}
mPhotoView.pause();
@@ -1368,18 +1328,6 @@ public class PhotoPage extends ActivityState implements
} else if (albumPageTransition == MSG_ALBUMPAGE_PICKED) {
mPhotoView.setFilmMode(false);
}
-
- mFadeOutTexture = transitions.get(PreparePageFadeoutTexture.KEY_FADE_TEXTURE);
- if (mFadeOutTexture != null) {
- mBackgroundFade.start();
- TiledScreenNail.disableDrawPlaceholder();
- mOpenAnimationRect =
- albumPageTransition == MSG_ALBUMPAGE_NONE ?
- (Rect) mData.getParcelable(KEY_OPEN_ANIMATION_RECT) :
- (Rect) transitions.get(KEY_OPEN_ANIMATION_RECT);
- mPhotoView.setOpenAnimationRect(mOpenAnimationRect);
- mBackgroundFade.start();
- }
}
@Override
diff --git a/src/com/android/gallery3d/app/StateManager.java b/src/com/android/gallery3d/app/StateManager.java
index c041b0e6f..10de5d201 100644
--- a/src/com/android/gallery3d/app/StateManager.java
+++ b/src/com/android/gallery3d/app/StateManager.java
@@ -57,6 +57,7 @@ public class StateManager {
}
if (!mStack.isEmpty()) {
ActivityState top = getTopState();
+ top.fadeOutOnNextPause();
if (mIsResumed) top.onPause();
}
state.initialize(mActivity, data);
@@ -81,6 +82,7 @@ public class StateManager {
if (!mStack.isEmpty()) {
ActivityState as = getTopState();
+ as.fadeOutOnNextPause();
as.mReceivedResults = state.mResult;
if (mIsResumed) as.onPause();
} else {
@@ -207,6 +209,10 @@ public class StateManager {
}
// Remove the top state.
mStack.pop();
+ if (!data.containsKey(PhotoPage.KEY_APP_BRIDGE)) {
+ // Do not do the fade out stuff when we are switching camera modes
+ oldState.fadeOutOnNextPause();
+ }
if (mIsResumed) oldState.onPause();
oldState.onDestroy();
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;