From 77e25ae9a71f66981731c0f57eea2f940253cc36 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 23 May 2016 22:51:43 +0200 Subject: [PATCH] save the gridview state when maximizing an image --- .../gallery/activities/PhotosActivity.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/src/main/java/com/simplemobiletools/gallery/activities/PhotosActivity.java b/app/src/main/java/com/simplemobiletools/gallery/activities/PhotosActivity.java index 9acfc5268..b8bb7fae5 100644 --- a/app/src/main/java/com/simplemobiletools/gallery/activities/PhotosActivity.java +++ b/app/src/main/java/com/simplemobiletools/gallery/activities/PhotosActivity.java @@ -9,6 +9,7 @@ import android.graphics.Color; import android.media.MediaScannerConnection; import android.net.Uri; import android.os.Bundle; +import android.os.Parcelable; import android.provider.MediaStore; import android.support.design.widget.CoordinatorLayout; import android.support.design.widget.Snackbar; @@ -47,6 +48,7 @@ public class PhotosActivity extends AppCompatActivity private Snackbar snackbar; private boolean isSnackbarShown; private List toBeDeleted; + private Parcelable state; @Override protected void onCreate(Bundle savedInstanceState) { @@ -58,12 +60,16 @@ public class PhotosActivity extends AppCompatActivity protected void onResume() { super.onResume(); tryloadGallery(); + if (state != null && gridView != null) + gridView.onRestoreInstanceState(state); } @Override protected void onPause() { super.onPause(); deleteFiles(); + if (gridView != null) + state = gridView.onSaveInstanceState(); } private void tryloadGallery() {