Skip to content

Commit

Permalink
Replace the IS_REFRESHING bundle state with CURRENT_UPDATE_ACTIONS
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Horta committed Jan 30, 2024
1 parent 62a1ee7 commit dfde3f8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public class ReaderConstants {
static final String KEY_FIRST_LOAD = "first_load";
static final String KEY_ACTIVITY_TITLE = "activity_title";
static final String KEY_TRACKED_POSITIONS = "tracked_positions";
static final String KEY_IS_REFRESHING = "is_refreshing";
static final String KEY_CURRENT_UPDATE_ACTIONS = "current_update_actions";
static final String KEY_ACTIVE_SEARCH_TAB = "active_search_tab";
static final String KEY_SITE_ID = "site_id";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@
import org.wordpress.android.widgets.RecyclerItemDecoration;
import org.wordpress.android.widgets.WPSnackbar;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.HashSet;
Expand Down Expand Up @@ -213,7 +214,7 @@ public class ReaderPostListFragment extends ViewPagerFragment
private int mSearchTabsPos = NO_POSITION;
private boolean mIsFilterableScreen;
private boolean mIsFiltered = false;
@NonNull private final HashSet<UpdateAction> mCurrentUpdateActions = new HashSet<>();
@NonNull private HashSet<UpdateAction> mCurrentUpdateActions = new HashSet<>();
/*
* called by post adapter to load older posts when user scrolls to the last post
*/
Expand Down Expand Up @@ -958,8 +959,8 @@ public void onSaveInstanceState(@NonNull Bundle outState) {
outState.putBoolean(ReaderConstants.KEY_ALREADY_REQUESTED, mHasRequestedPosts);
outState.putBoolean(ReaderConstants.KEY_ALREADY_UPDATED, mHasUpdatedPosts);
outState.putBoolean(ReaderConstants.KEY_FIRST_LOAD, mFirstLoad);
outState.putSerializable(ReaderConstants.KEY_CURRENT_UPDATE_ACTIONS, mCurrentUpdateActions);
if (mRecyclerView != null) {
outState.putBoolean(ReaderConstants.KEY_IS_REFRESHING, mRecyclerView.isRefreshing());
outState.putInt(ReaderConstants.KEY_RESTORE_POSITION, getCurrentPosition());
}
outState.putSerializable(ReaderConstants.ARG_POST_LIST_TYPE, getPostListType());
Expand Down Expand Up @@ -1181,8 +1182,12 @@ public void onShowCustomEmptyView(EmptyViewMessageType emptyViewMsgType) {
}
}

if (savedInstanceState != null && savedInstanceState.getBoolean(ReaderConstants.KEY_IS_REFRESHING)) {
setIsUpdating(true, UpdateAction.REQUEST_NEWER);
if (savedInstanceState != null) {
Serializable actions = savedInstanceState.getSerializable(ReaderConstants.KEY_CURRENT_UPDATE_ACTIONS);
if (actions instanceof HashSet<?>) {
mCurrentUpdateActions = (HashSet<UpdateAction>) actions;
updateProgressIndicators();
}
}

return rootView;
Expand Down

0 comments on commit dfde3f8

Please sign in to comment.