From 7f44b6a8de7de55fb0db04cc253c83a3709230a4 Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Thu, 16 Sep 2021 19:25:58 +0800 Subject: [PATCH] Fix the same value, null, was passed as the nextKey in two sequential Pages loaded from a PagingSource. --- .../infinityforreddit/post/PostPagingSource.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/post/PostPagingSource.java b/app/src/main/java/ml/docilealligator/infinityforreddit/post/PostPagingSource.java index 6a821d5c..cb60ae4b 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/post/PostPagingSource.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/post/PostPagingSource.java @@ -1,7 +1,6 @@ package ml.docilealligator.infinityforreddit.post; import android.content.SharedPreferences; -import android.util.Log; import androidx.annotation.NonNull; import androidx.paging.ListenableFuturePagingSource; @@ -157,7 +156,6 @@ public class PostPagingSource extends ListenableFuturePagingSource @Nullable @Override public String getRefreshKey(@NonNull PagingState pagingState) { - Log.i("asdfad", "asdf " + sortType.getType().value); return null; } @@ -192,7 +190,7 @@ public class PostPagingSource extends ListenableFuturePagingSource int currentPostsSize = postLinkedHashSet.size(); postLinkedHashSet.addAll(newPosts); if (currentPostsSize == postLinkedHashSet.size()) { - return new LoadResult.Page<>(new ArrayList<>(), null, lastItem); + return new LoadResult.Page<>(new ArrayList<>(), null, null); } else { return new LoadResult.Page<>(new ArrayList<>(postLinkedHashSet).subList(currentPostsSize, postLinkedHashSet.size()), null, lastItem); }