summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/ui/GLView.java
diff options
context:
space:
mode:
authorBobby Georgescu <georgescu@google.com>2012-10-17 14:50:47 -0700
committerBobby Georgescu <georgescu@google.com>2012-10-17 17:14:22 -0700
commit4831c7494373c360062a7becac820eba3bc39287 (patch)
treefe63ed1fa41f35d8ecf630d65f7ce440ed91dbe4 /src/com/android/gallery3d/ui/GLView.java
parent43b906d81caa4379eae1a1643194c8b3d34b1ad5 (diff)
downloadandroid_packages_apps_Gallery2-4831c7494373c360062a7becac820eba3bc39287.tar.gz
android_packages_apps_Gallery2-4831c7494373c360062a7becac820eba3bc39287.tar.bz2
android_packages_apps_Gallery2-4831c7494373c360062a7becac820eba3bc39287.zip
Big refactor, additions to state transition animations
Bug: 7362944 Refactored a lot of the state transitions code, adding support for definable transition animations and defining distinct outgoing and incoming animations. Change-Id: I31a69057ea1b72dd3185cec656e59b11fdb528c1
Diffstat (limited to 'src/com/android/gallery3d/ui/GLView.java')
-rw-r--r--src/com/android/gallery3d/ui/GLView.java40
1 files changed, 19 insertions, 21 deletions
diff --git a/src/com/android/gallery3d/ui/GLView.java b/src/com/android/gallery3d/ui/GLView.java
index b91b71212..664012c5a 100644
--- a/src/com/android/gallery3d/ui/GLView.java
+++ b/src/com/android/gallery3d/ui/GLView.java
@@ -78,10 +78,8 @@ 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);
+ private StateTransitionAnimation mTransition;
public void startAnimation(CanvasAnimation animation) {
GLRoot root = getGLRoot();
@@ -223,22 +221,28 @@ public class GLView {
}
protected void render(GLCanvas canvas) {
- if (mTransition.calculate(AnimationTime.get())) invalidate();
- canvas.save();
+ boolean transitionActive = false;
+ if (mTransition != null && mTransition.calculate(AnimationTime.get())) {
+ invalidate();
+ transitionActive = mTransition.isActive();
+ }
renderBackground(canvas);
- if (mTransition.isActive()) mTransition.applyForegroundTransformation(this, canvas);
+ canvas.save();
+ if (transitionActive) {
+ mTransition.applyContentTransform(this, canvas);
+ }
for (int i = 0, n = getComponentCount(); i < n; ++i) {
renderChild(canvas, getComponent(i));
}
canvas.restore();
+ if (transitionActive) {
+ mTransition.applyOverlay(this, canvas);
+ }
}
- public void setFadeOutTexture(RawTexture texture) {
- mFadeOutTexture = texture;
- if (mFadeOutTexture != null) {
- TiledScreenNail.disableDrawPlaceholder();
- }
- mTransition.start();
+ public void setIntroAnimation(StateTransitionAnimation intro) {
+ mTransition = intro;
+ if (mTransition != null) mTransition.start();
}
public float [] getBackgroundColor() {
@@ -253,15 +257,9 @@ public class GLView {
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;
- }
+ if (mTransition != null && mTransition.isActive()) {
+ mTransition.applyBackground(this, view);
+ return;
}
}