mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-12-28 11:58:23 +01:00
Fix the same value, null, was passed as the nextKey in two sequential Pages loaded from a PagingSource.
This commit is contained in:
parent
8a10733d8c
commit
7f44b6a8de
@ -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<String, Post>
|
||||
@Nullable
|
||||
@Override
|
||||
public String getRefreshKey(@NonNull PagingState<String, Post> pagingState) {
|
||||
Log.i("asdfad", "asdf " + sortType.getType().value);
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -192,7 +190,7 @@ public class PostPagingSource extends ListenableFuturePagingSource<String, Post>
|
||||
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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user