From 3735cec70cb2152e85153942c8abc5670ffa8fd9 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Fri, 5 May 2017 14:42:08 +0200 Subject: [PATCH] prevent restoring latest fragment when rotating --- .../android/ui/fragment/ExtendedListFragment.java | 2 +- .../android/ui/fragment/OCFileListFragment.java | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/owncloud/android/ui/fragment/ExtendedListFragment.java b/src/main/java/com/owncloud/android/ui/fragment/ExtendedListFragment.java index d8c02dda3b..26f0a860c6 100644 --- a/src/main/java/com/owncloud/android/ui/fragment/ExtendedListFragment.java +++ b/src/main/java/com/owncloud/android/ui/fragment/ExtendedListFragment.java @@ -93,7 +93,7 @@ public class ExtendedListFragment extends Fragment private static final String KEY_IS_GRID_VISIBLE = "IS_GRID_VISIBLE"; protected SwipeRefreshLayout mRefreshListLayout; - private SwipeRefreshLayout mRefreshGridLayout; + protected SwipeRefreshLayout mRefreshGridLayout; protected SwipeRefreshLayout mRefreshEmptyLayout; protected LinearLayout mEmptyListContainer; protected TextView mEmptyListMessage; diff --git a/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java b/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java index 88268fbccc..64d7d1d772 100644 --- a/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java +++ b/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java @@ -666,7 +666,9 @@ public class OCFileListFragment extends ExtendedListFragment implements OCFileLi public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putParcelable(KEY_FILE, mFile); - outState.putParcelable(KEY_CURRENT_SEARCH_TYPE, Parcels.wrap(currentSearchType)); + if (searchFragment) { + outState.putParcelable(KEY_CURRENT_SEARCH_TYPE, Parcels.wrap(currentSearchType)); + } mMultiChoiceModeListener.storeStateIn(outState); } @@ -1242,6 +1244,9 @@ public class OCFileListFragment extends ExtendedListFragment implements OCFileLi setTitle(R.string.default_display_name_for_root_folder); } + getActivity().getIntent().removeExtra(OCFileListFragment.SEARCH_EVENT); + getArguments().putParcelable(OCFileListFragment.SEARCH_EVENT, null); + setFabEnabled(true); } @@ -1468,10 +1473,14 @@ public class OCFileListFragment extends ExtendedListFragment implements OCFileLi @Override public void onRefresh() { - super.onRefresh(); - if (searchEvent != null && searchFragment) { onMessageEvent(searchEvent); + + mRefreshListLayout.setRefreshing(false); + mRefreshGridLayout.setRefreshing(false); + mRefreshEmptyLayout.setRefreshing(false); + } else { + super.onRefresh(); } }