From b9e6e7f1dffe3d4e4736ed67a323f11a174afbb1 Mon Sep 17 00:00:00 2001 From: Chih-Chung Chang Date: Tue, 22 May 2012 11:35:46 -0700 Subject: Unlock orientation only when action bar is needed. Bug: 6482079 Change-Id: I75d96ca7957f80e9c52f35edf74127f82f194f63 --- src/com/android/gallery3d/ui/PositionController.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'src/com/android/gallery3d/ui/PositionController.java') diff --git a/src/com/android/gallery3d/ui/PositionController.java b/src/com/android/gallery3d/ui/PositionController.java index bb2b83ecb..d085c4d49 100644 --- a/src/com/android/gallery3d/ui/PositionController.java +++ b/src/com/android/gallery3d/ui/PositionController.java @@ -209,8 +209,13 @@ class PositionController { } updateScaleAndGapLimit(); - startOpeningAnimationIfNeeded(); - snapAndRedraw(); + + // If we have the opening animation, do it. Otherwise go directly to the + // right position. + if (!startOpeningAnimationIfNeeded()) { + snapAndRedraw(); + skipAnimation(); + } } public void setConstrainedFrame(Rect f) { @@ -280,10 +285,10 @@ class PositionController { return true; } - private void startOpeningAnimationIfNeeded() { - if (mOpenAnimationRect == null) return; + private boolean startOpeningAnimationIfNeeded() { + if (mOpenAnimationRect == null) return false; Box b = mBoxes.get(0); - if (b.mUseViewSize) return; + if (b.mUseViewSize) return false; // Start animation from the saved rectangle if we have one. Rect r = mOpenAnimationRect; @@ -303,6 +308,8 @@ class PositionController { g.mCurrentGap = mViewW; g.doAnimation(g.mDefaultSize, ANIM_KIND_OPENING); } + + return true; } public void setFilmMode(boolean enabled) { -- cgit v1.2.3