save/restore stack object

Signed-off-by: parneet-guraya <gurayaparneet@gmail.com>
This commit is contained in:
parneet-guraya 2023-09-12 18:30:41 +05:30
parent 09b8f48bcf
commit 5973c6be0d
No known key found for this signature in database
GPG key ID: 26DB680F1EE174D5

View file

@ -192,6 +192,7 @@ public class FileDisplayActivity extends FileActivity
public static final String KEY_FILE_ID = "KEY_FILE_ID"; public static final String KEY_FILE_ID = "KEY_FILE_ID";
public static final String KEY_FILE_PATH = "KEY_FILE_PATH"; public static final String KEY_FILE_PATH = "KEY_FILE_PATH";
public static final String KEY_ACCOUNT = "KEY_ACCOUNT"; public static final String KEY_ACCOUNT = "KEY_ACCOUNT";
public static final String KEY_SORT_GROUP_STATE = "KEY_SORT_GROUP_STATE";
private static final String KEY_WAITING_TO_PREVIEW = "WAITING_TO_PREVIEW"; private static final String KEY_WAITING_TO_PREVIEW = "WAITING_TO_PREVIEW";
@ -283,14 +284,17 @@ public class FileDisplayActivity extends FileActivity
initSyncBroadcastReceiver(); initSyncBroadcastReceiver();
} }
@SuppressWarnings("unchecked")
private void loadSavedInstanceState(Bundle savedInstanceState) { private void loadSavedInstanceState(Bundle savedInstanceState) {
if (savedInstanceState != null) { if (savedInstanceState != null) {
previousSortGroupState = (Stack<Boolean>) savedInstanceState.getSerializable(KEY_SORT_GROUP_STATE);
mWaitingToPreview = savedInstanceState.getParcelable(FileDisplayActivity.KEY_WAITING_TO_PREVIEW); mWaitingToPreview = savedInstanceState.getParcelable(FileDisplayActivity.KEY_WAITING_TO_PREVIEW);
mSyncInProgress = savedInstanceState.getBoolean(KEY_SYNC_IN_PROGRESS); mSyncInProgress = savedInstanceState.getBoolean(KEY_SYNC_IN_PROGRESS);
mWaitingToSend = savedInstanceState.getParcelable(FileDisplayActivity.KEY_WAITING_TO_SEND); mWaitingToSend = savedInstanceState.getParcelable(FileDisplayActivity.KEY_WAITING_TO_SEND);
searchQuery = savedInstanceState.getString(KEY_SEARCH_QUERY); searchQuery = savedInstanceState.getString(KEY_SEARCH_QUERY);
searchOpen = savedInstanceState.getBoolean(FileDisplayActivity.KEY_IS_SEARCH_OPEN, false); searchOpen = savedInstanceState.getBoolean(FileDisplayActivity.KEY_IS_SEARCH_OPEN, false);
} else { } else {
previousSortGroupState = new Stack<>();
mWaitingToPreview = null; mWaitingToPreview = null;
mSyncInProgress = false; mSyncInProgress = false;
mWaitingToSend = null; mWaitingToSend = null;
@ -1080,7 +1084,7 @@ public class FileDisplayActivity extends FileActivity
outState.putBoolean(KEY_IS_SEARCH_OPEN, !searchView.isIconified()); outState.putBoolean(KEY_IS_SEARCH_OPEN, !searchView.isIconified());
} }
outState.putString(KEY_SEARCH_QUERY, searchQuery); outState.putString(KEY_SEARCH_QUERY, searchQuery);
outState.putSerializable(KEY_SORT_GROUP_STATE, previousSortGroupState);
Log_OC.v(TAG, "onSaveInstanceState() end"); Log_OC.v(TAG, "onSaveInstanceState() end");
} }