Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ private void resetPostAdapter(ReaderPostListType postListType) {
mPostAdapter = null;
mRecyclerView.setAdapter(null);
mRecyclerView.setAdapter(getPostAdapter());
mRecyclerView.setSwipeToRefreshEnabled(isSwipeToRefreshSupported());
}

@SuppressWarnings("unused")
Expand Down Expand Up @@ -514,6 +515,8 @@ public void onShowCustomEmptyView (EmptyViewMessageType emptyViewMsgType) {
setupRecyclerToolbar();
}

mRecyclerView.setSwipeToRefreshEnabled(isSwipeToRefreshSupported());

// bar that appears at top after new posts are loaded
mNewPostsBar = rootView.findViewById(R.id.layout_new_posts);
mNewPostsBar.setVisibility(View.GONE);
Expand Down Expand Up @@ -1298,10 +1301,18 @@ private void setIsUpdating(boolean isUpdating, UpdateAction updateAction) {
// if swipe-to-refresh isn't active, keep it disabled during an update - this prevents
// doing a refresh while another update is already in progress
if (mRecyclerView != null && !mRecyclerView.isRefreshing()) {
mRecyclerView.setSwipeToRefreshEnabled(!isUpdating);
mRecyclerView.setSwipeToRefreshEnabled(!isUpdating && isSwipeToRefreshSupported());
}
}

/*
* swipe-to-refresh isn't supported for search results since they're really brief snapshots
* and are unlikely to show new posts due to the way they're sorted by score
*/
private boolean isSwipeToRefreshSupported() {
return getPostListType() != ReaderPostListType.SEARCH_RESULTS;
}

/*
* bar that appears at the top when new posts have been retrieved
*/
Expand Down