From e0e82563de27293c79995d5709a8b3f795945b2f Mon Sep 17 00:00:00 2001 From: huiyan Date: Thu, 28 Apr 2016 14:19:11 +0800 Subject: Gallery2: Fix picture is different when changes font size when change the system font size, photopage destroy. when re-start it, the photopage restore from stack. But the current photo index is not saved. So photopage display the original photo not the current photo. In onSaveState the current photo index is saved. In onCreate that current index is restored if the photopage restore from stack. Change-Id: I9a0e4ff1d13773a976c197e96fef570c173b3b8d CRs-Fixed: 1004545 --- src/com/android/gallery3d/app/PhotoPage.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/com/android/gallery3d') diff --git a/src/com/android/gallery3d/app/PhotoPage.java b/src/com/android/gallery3d/app/PhotoPage.java index 9f7a054d8..287df66b7 100644 --- a/src/com/android/gallery3d/app/PhotoPage.java +++ b/src/com/android/gallery3d/app/PhotoPage.java @@ -425,7 +425,13 @@ public abstract class PhotoPage extends ActivityState implements mIsFromWidget = data.getBoolean(KEY_IS_FROM_WIDGET, false); mStartInFilmstrip = data.getBoolean(KEY_START_IN_FILMSTRIP, false); boolean inCameraRoll = data.getBoolean(KEY_IN_CAMERA_ROLL, false); - mCurrentIndex = data.getInt(KEY_INDEX_HINT, 0); + if (restoreState == null || mSetPathString == null) { + mCurrentIndex = data.getInt(KEY_INDEX_HINT, 0); + } else { + mCurrentIndex = restoreState.getInt(KEY_INDEX_HINT, 0); + //we only save index in onSaveState, set itemPath to null to get the right path later + itemPath = null; + } if (mSetPathString != null) { mShowSpinner = true; mAppBridge = (AppBridge) data.getParcelable(KEY_APP_BRIDGE); @@ -613,6 +619,12 @@ public abstract class PhotoPage extends ActivityState implements }); } + @Override + protected void onSaveState(Bundle outState) { + outState.putInt(KEY_INDEX_HINT,mCurrentIndex); + super.onSaveState(outState); + } + @Override public void onPictureCenter(boolean isCamera) { isCamera = isCamera || (mHasCameraScreennailOrPlaceholder && mAppBridge == null); -- cgit v1.2.3