diff options
Diffstat (limited to 'src/com/android/gallery3d/ui')
-rw-r--r-- | src/com/android/gallery3d/ui/BitmapScreenNail.java | 13 | ||||
-rw-r--r-- | src/com/android/gallery3d/ui/PositionController.java | 3 | ||||
-rw-r--r-- | src/com/android/gallery3d/ui/PreparePageFadeoutTexture.java | 37 |
3 files changed, 51 insertions, 2 deletions
diff --git a/src/com/android/gallery3d/ui/BitmapScreenNail.java b/src/com/android/gallery3d/ui/BitmapScreenNail.java index 6cb36b092..57685e8e5 100644 --- a/src/com/android/gallery3d/ui/BitmapScreenNail.java +++ b/src/com/android/gallery3d/ui/BitmapScreenNail.java @@ -36,6 +36,7 @@ public class BitmapScreenNail implements ScreenNail { private static final int PLACEHOLDER_COLOR = 0xFF222222; // The duration of the fading animation in milliseconds private static final int DURATION = 180; + private static boolean mDrawPlaceholder = true; private static final int MAX_SIDE = 640; @@ -139,13 +140,23 @@ public class BitmapScreenNail implements ScreenNail { mBitmap = null; } + public static void disableDrawPlaceholder() { + mDrawPlaceholder = false; + } + + public static void enableDrawPlaceholder() { + mDrawPlaceholder = true; + } + @Override public void draw(GLCanvas canvas, int x, int y, int width, int height) { if (mBitmap == null) { if (mAnimationStartTime == ANIMATION_NOT_NEEDED) { mAnimationStartTime = ANIMATION_NEEDED; } - canvas.fillRect(x, y, width, height, PLACEHOLDER_COLOR); + if(mDrawPlaceholder) { + canvas.fillRect(x, y, width, height, PLACEHOLDER_COLOR); + } return; } diff --git a/src/com/android/gallery3d/ui/PositionController.java b/src/com/android/gallery3d/ui/PositionController.java index 9b77d6814..b1b3c37ab 100644 --- a/src/com/android/gallery3d/ui/PositionController.java +++ b/src/com/android/gallery3d/ui/PositionController.java @@ -20,6 +20,7 @@ import android.content.Context; import android.graphics.Rect; import android.util.Log; +import com.android.gallery3d.app.PhotoPage; import com.android.gallery3d.common.OverScroller; import com.android.gallery3d.common.Utils; import com.android.gallery3d.util.GalleryUtils; @@ -66,7 +67,7 @@ class PositionController { SNAPBACK_ANIMATION_TIME, // ANIM_KIND_SNAPBACK 400, // ANIM_KIND_SLIDE 300, // ANIM_KIND_ZOOM - 400, // ANIM_KIND_OPENING + PhotoPage.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 new file mode 100644 index 000000000..475906c81 --- /dev/null +++ b/src/com/android/gallery3d/ui/PreparePageFadeoutTexture.java @@ -0,0 +1,37 @@ +package com.android.gallery3d.ui; + +import com.android.gallery3d.ui.GLRoot.OnGLIdleListener; + +public class PreparePageFadeoutTexture implements OnGLIdleListener { + private RawTexture mTexture; + private boolean mResultReady = false; + private GLView mRootPane; + + public PreparePageFadeoutTexture(int w, int h, GLView rootPane) { + mTexture = new RawTexture(w, h, true); + mRootPane = rootPane; + } + + public synchronized RawTexture get() { + try { + while (!mResultReady) { + wait(); + } + } catch (InterruptedException e) { + // Since this is just used for a transition, not that important + } + return mTexture; + } + + @Override + public boolean onGLIdle(GLCanvas canvas, boolean renderRequested) { + canvas.beginRenderTarget(mTexture); + mRootPane.render(canvas); + canvas.endRenderTarget(); + synchronized (this) { + mResultReady = true; + notifyAll(); + } + return false; + } +} |