浏览代码

activities: Set nextPageUrl to null when manually refreshing activities.

When the user swipes the recycler view to refresh the list of activities we want the list to be cleared and populated with the newest activities without loading all the other paginated activities that might have been loaded up to that point. Therefore we set the nextPageUrl variable to null in the setOnRefreshListener for the swipeRefreshLayout.
ardevd 7 年之前
父节点
当前提交
da931e44dc
共有 1 个文件被更改,包括 6 次插入2 次删除
  1. 6 2
      src/main/java/com/owncloud/android/ui/activities/ActivitiesActivity.java

+ 6 - 2
src/main/java/com/owncloud/android/ui/activities/ActivitiesActivity.java

@@ -107,8 +107,12 @@ public class ActivitiesActivity extends FileActivity implements ActivityListInte
             ThemeUtils.setColoredTitle(actionBar, getString(R.string.drawer_item_activities), this);
         }
 
-        swipeListRefreshLayout.setOnRefreshListener(() -> mActionListener.loadActivities(null)
-        );
+        swipeListRefreshLayout.setOnRefreshListener(() -> {
+            // We set the nextPageUrl variable to null here since when manually refreshing
+            // activities data we want to clear the list and reset the pagination.
+            nextPageUrl = null;
+            mActionListener.loadActivities(nextPageUrl);
+        });
 
         // Since we use swipe-to-refresh for progress indication we can hide the inherited
         // progressBar, message and headline