If the focused box was at minimal scale, we try to make it the
minimal scale under the new view size.
Bug: 6584425
Change-Id: I7dcc748cb3659a06f2ca4d8550d075fdda2949fa
diff --git a/src/com/android/gallery3d/ui/PositionController.java b/src/com/android/gallery3d/ui/PositionController.java
index ae0df34..b673722 100644
--- a/src/com/android/gallery3d/ui/PositionController.java
+++ b/src/com/android/gallery3d/ui/PositionController.java
@@ -200,6 +200,8 @@
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 @@
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()) {