Skip to content

Commit

Permalink
save the directory activities scroll state too
Browse files Browse the repository at this point in the history
  • Loading branch information
tibbi committed Jun 5, 2016
1 parent 399f9ee commit e206fa9
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
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;
Expand Down Expand Up @@ -55,6 +56,7 @@ public class MainActivity extends AppCompatActivity
private boolean isSnackbarShown;
private List<String> toBeDeleted;
private ActionMode actionMode;
private Parcelable state;

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand Down Expand Up @@ -86,12 +88,16 @@ public boolean onOptionsItemSelected(MenuItem item) {
protected void onResume() {
super.onResume();
tryloadGallery();
if (state != null && gridView != null)
gridView.onRestoreInstanceState(state);
}

@Override
protected void onPause() {
super.onPause();
deleteDirs();
if (gridView != null)
state = gridView.onSaveInstanceState();
}

private void tryloadGallery() {
Expand Down

0 comments on commit e206fa9

Please sign in to comment.