mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 06:28:00 +01:00
save the gridview state when maximizing an image
This commit is contained in:
parent
1d27226520
commit
77e25ae9a7
1 changed files with 6 additions and 0 deletions
|
@ -9,6 +9,7 @@ import android.graphics.Color;
|
||||||
import android.media.MediaScannerConnection;
|
import android.media.MediaScannerConnection;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.Parcelable;
|
||||||
import android.provider.MediaStore;
|
import android.provider.MediaStore;
|
||||||
import android.support.design.widget.CoordinatorLayout;
|
import android.support.design.widget.CoordinatorLayout;
|
||||||
import android.support.design.widget.Snackbar;
|
import android.support.design.widget.Snackbar;
|
||||||
|
@ -47,6 +48,7 @@ public class PhotosActivity extends AppCompatActivity
|
||||||
private Snackbar snackbar;
|
private Snackbar snackbar;
|
||||||
private boolean isSnackbarShown;
|
private boolean isSnackbarShown;
|
||||||
private List<String> toBeDeleted;
|
private List<String> toBeDeleted;
|
||||||
|
private Parcelable state;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
@ -58,12 +60,16 @@ public class PhotosActivity extends AppCompatActivity
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
tryloadGallery();
|
tryloadGallery();
|
||||||
|
if (state != null && gridView != null)
|
||||||
|
gridView.onRestoreInstanceState(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPause() {
|
protected void onPause() {
|
||||||
super.onPause();
|
super.onPause();
|
||||||
deleteFiles();
|
deleteFiles();
|
||||||
|
if (gridView != null)
|
||||||
|
state = gridView.onSaveInstanceState();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void tryloadGallery() {
|
private void tryloadGallery() {
|
||||||
|
|
Loading…
Reference in a new issue