mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-11-10 20:57:25 +01:00
Use PagingDataAdapter instead of deprecated PagedListAdapter.
This commit is contained in:
parent
7c388ebd52
commit
761217a87f
@ -5,7 +5,6 @@ import android.content.SharedPreferences;
|
|||||||
import android.content.res.ColorStateList;
|
import android.content.res.ColorStateList;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.graphics.Color;
|
|
||||||
import android.graphics.ColorFilter;
|
import android.graphics.ColorFilter;
|
||||||
import android.graphics.PorterDuff;
|
import android.graphics.PorterDuff;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
@ -31,7 +30,7 @@ import androidx.constraintlayout.widget.Barrier;
|
|||||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||||
import androidx.constraintlayout.widget.ConstraintSet;
|
import androidx.constraintlayout.widget.ConstraintSet;
|
||||||
import androidx.core.graphics.drawable.DrawableCompat;
|
import androidx.core.graphics.drawable.DrawableCompat;
|
||||||
import androidx.paging.PagedListAdapter;
|
import androidx.paging.PagingDataAdapter;
|
||||||
import androidx.recyclerview.widget.DiffUtil;
|
import androidx.recyclerview.widget.DiffUtil;
|
||||||
import androidx.recyclerview.widget.ItemTouchHelper;
|
import androidx.recyclerview.widget.ItemTouchHelper;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
@ -105,7 +104,7 @@ import retrofit2.Retrofit;
|
|||||||
* Created by alex on 2/25/18.
|
* 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_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_VIDEO_AND_GIF_PREVIEW_TYPE = 2;
|
||||||
private static final int VIEW_TYPE_POST_CARD_IMAGE_AND_GIF_AUTOPLAY_TYPE = 3;
|
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()) {
|
if (super.getItemCount() <= 0 || order >= super.getItemCount()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return getItem(order);
|
return order;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public Integer getOrderForKey(@NonNull Object key) {
|
public Integer getOrderForKey(@NonNull Object key) {
|
||||||
if (getCurrentList() != null && key instanceof Post) {
|
if (key instanceof Integer) {
|
||||||
return getCurrentList().indexOf(key);
|
return (Integer) key;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -709,7 +709,7 @@ https://play.google.com/store/apps/details?id=ml.docilealligator.infinityforredd
|
|||||||
Она не больна или что-то вроде того, но определённо может поправиться."</string>
|
Она не больна или что-то вроде того, но определённо может поправиться."</string>
|
||||||
<string name="edit_multi_reddit">"Изменить МультиРеддит"</string>
|
<string name="edit_multi_reddit">"Изменить МультиРеддит"</string>
|
||||||
<string name="delete_multi_reddit">"Удалить мультиреддит"</string>
|
<string name="delete_multi_reddit">"Удалить мультиреддит"</string>
|
||||||
<string name="n_awards">"наград"</string>
|
<string name="n_awards">%1$d наград</string>
|
||||||
<string name="one_award">"1 награда"</string>
|
<string name="one_award">"1 награда"</string>
|
||||||
<string name="report">"Отчёт"</string>
|
<string name="report">"Отчёт"</string>
|
||||||
<string name="reporting">"Отчёт отправляется"</string>
|
<string name="reporting">"Отчёт отправляется"</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user