aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/ml
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/ml')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/post/PostPagingSource.java6
1 files changed, 6 insertions, 0 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 bd2b51e8..86216dcb 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/post/PostPagingSource.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/post/PostPagingSource.java
@@ -58,6 +58,7 @@ public class PostPagingSource extends ListenableFuturePagingSource<String, Post>
private String userWhere;
private String multiRedditPath;
private LinkedHashSet<Post> postLinkedHashSet;
+ private String previousLastItem;
PostPagingSource(Executor executor, Retrofit retrofit, String accessToken, String accountName,
SharedPreferences sharedPreferences,
@@ -188,6 +189,11 @@ public class PostPagingSource extends ListenableFuturePagingSource<String, Post>
return new LoadResult.Error<>(new Exception("Error parsing posts"));
} else {
int currentPostsSize = postLinkedHashSet.size();
+ if (lastItem != null && lastItem.equals(previousLastItem)) {
+ lastItem = null;
+ }
+ previousLastItem = lastItem;
+
postLinkedHashSet.addAll(newPosts);
if (currentPostsSize == postLinkedHashSet.size()) {
return new LoadResult.Page<>(new ArrayList<>(), null, lastItem);