OSDN Git Service

If the focused box was at minimal scale, we try to make it the
authorChih-Chung Chang <chihchung@google.com>
Thu, 31 May 2012 00:10:32 +0000 (17:10 -0700)
committerChih-Chung Chang <chihchung@google.com>
Thu, 31 May 2012 00:10:55 +0000 (17:10 -0700)
minimal scale under the new view size.

Bug: 6584425
Change-Id: I7dcc748cb3659a06f2ca4d8550d075fdda2949fa

src/com/android/gallery3d/ui/PositionController.java

index ae0df34..b673722 100644 (file)
@@ -200,6 +200,8 @@ class PositionController {
     public void setViewSize(int viewW, int viewH) {
         if (viewW == mViewW && viewH == mViewH) return;
 
+        boolean wasMinimal = isAtMinimalScale();
+
         mViewW = viewW;
         mViewH = viewH;
         initPlatform();
@@ -210,6 +212,13 @@ class PositionController {
 
         updateScaleAndGapLimit();
 
+        // If the focused box was at minimal scale, we try to make it the
+        // minimal scale under the new view size.
+        if (wasMinimal) {
+            Box b = mBoxes.get(0);
+            b.mCurrentScale = b.mScaleMin;
+        }
+
         // If we have the opening animation, do it. Otherwise go directly to the
         // right position.
         if (!startOpeningAnimationIfNeeded()) {