From 31100a3afe42f66ac3022233f0d536b6024e894f Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 20 Jul 2016 23:23:43 +0200 Subject: [PATCH] properly handle orientation changes --- .../gallery/activities/MediaActivity.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/simplemobiletools/gallery/activities/MediaActivity.java b/app/src/main/java/com/simplemobiletools/gallery/activities/MediaActivity.java index bbc8ec51a..67d0e3359 100644 --- a/app/src/main/java/com/simplemobiletools/gallery/activities/MediaActivity.java +++ b/app/src/main/java/com/simplemobiletools/gallery/activities/MediaActivity.java @@ -79,16 +79,20 @@ public class MediaActivity extends SimpleActivity protected void onResume() { super.onResume(); tryloadGallery(); - if (mState != null && mGridView != null) + if (mState != null && mGridView != null) { mGridView.onRestoreInstanceState(mState); + } } @Override protected void onPause() { super.onPause(); deleteFiles(); - if (mGridView != null) + if (mGridView != null && isChangingConfigurations()) { mState = mGridView.onSaveInstanceState(); + } else { + mState = null; + } } private void tryloadGallery() {