aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2021-06-11 11:53:21 +0000
committerAlex Ning <chineseperson5@gmail.com>2021-06-11 11:53:21 +0000
commit761217a87f282c9dfb34d25450abdceb5b6bc217 (patch)
tree6b2e1f3e005aa3c71429ff84b871bbfec901b230 /app/src/main/java
parent7c388ebd5270933a8afdefea3f951c63a406dfc0 (diff)
downloadinfinity-for-reddit-761217a87f282c9dfb34d25450abdceb5b6bc217.tar
infinity-for-reddit-761217a87f282c9dfb34d25450abdceb5b6bc217.tar.gz
infinity-for-reddit-761217a87f282c9dfb34d25450abdceb5b6bc217.tar.bz2
infinity-for-reddit-761217a87f282c9dfb34d25450abdceb5b6bc217.tar.lz
infinity-for-reddit-761217a87f282c9dfb34d25450abdceb5b6bc217.tar.xz
infinity-for-reddit-761217a87f282c9dfb34d25450abdceb5b6bc217.tar.zst
infinity-for-reddit-761217a87f282c9dfb34d25450abdceb5b6bc217.zip
Use PagingDataAdapter instead of deprecated PagedListAdapter.
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java11
1 files changed, 5 insertions, 6 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java
index 65d24bd8..5142704b 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java
@@ -5,7 +5,6 @@ import android.content.SharedPreferences;
import android.content.res.ColorStateList;
import android.content.res.Configuration;
import android.content.res.Resources;
-import android.graphics.Color;
import android.graphics.ColorFilter;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
@@ -31,7 +30,7 @@ import androidx.constraintlayout.widget.Barrier;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.constraintlayout.widget.ConstraintSet;
import androidx.core.graphics.drawable.DrawableCompat;
-import androidx.paging.PagedListAdapter;
+import androidx.paging.PagingDataAdapter;
import androidx.recyclerview.widget.DiffUtil;
import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.RecyclerView;
@@ -105,7 +104,7 @@ import retrofit2.Retrofit;
* Created by alex on 2/25/18.
*/
-public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView.ViewHolder> implements CacheManager {
+public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerView.ViewHolder> implements CacheManager {
private static final int VIEW_TYPE_POST_CARD_VIDEO_AUTOPLAY_TYPE = 1;
private static final int VIEW_TYPE_POST_CARD_VIDEO_AND_GIF_PREVIEW_TYPE = 2;
private static final int VIEW_TYPE_POST_CARD_IMAGE_AND_GIF_AUTOPLAY_TYPE = 3;
@@ -1988,14 +1987,14 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
if (super.getItemCount() <= 0 || order >= super.getItemCount()) {
return null;
}
- return getItem(order);
+ return order;
}
@Nullable
@Override
public Integer getOrderForKey(@NonNull Object key) {
- if (getCurrentList() != null && key instanceof Post) {
- return getCurrentList().indexOf(key);
+ if (key instanceof Integer) {
+ return (Integer) key;
}
return null;