Pārlūkot izejas kodu

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 gadi atpakaļ
vecāks
revīzija
da931e44dc

+ 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