66 lines
2.5 KiB
Java
66 lines
2.5 KiB
Java
package androidx.recyclerview.widget;
|
|
|
|
import androidx.annotation.NonNull;
|
|
import androidx.annotation.Nullable;
|
|
import androidx.recyclerview.widget.AsyncDifferConfig;
|
|
import androidx.recyclerview.widget.AsyncListDiffer;
|
|
import androidx.recyclerview.widget.DiffUtil;
|
|
import androidx.recyclerview.widget.RecyclerView;
|
|
import androidx.recyclerview.widget.RecyclerView.ViewHolder;
|
|
import java.util.List;
|
|
public abstract class ListAdapter<T, VH extends RecyclerView.ViewHolder> extends RecyclerView.Adapter<VH> {
|
|
public final AsyncListDiffer<T> mDiffer;
|
|
private final AsyncListDiffer.ListListener<T> mListener;
|
|
|
|
/* renamed from: androidx.recyclerview.widget.ListAdapter$1 reason: invalid class name */
|
|
public class AnonymousClass1 implements AsyncListDiffer.ListListener<T> {
|
|
public AnonymousClass1() {
|
|
}
|
|
|
|
@Override // androidx.recyclerview.widget.AsyncListDiffer.ListListener
|
|
public void onCurrentListChanged(@NonNull List<T> list, @NonNull List<T> list2) {
|
|
ListAdapter.this.onCurrentListChanged(list, list2);
|
|
}
|
|
}
|
|
|
|
public ListAdapter(@NonNull AsyncDifferConfig<T> asyncDifferConfig) {
|
|
AnonymousClass1 r0 = new AnonymousClass1();
|
|
this.mListener = r0;
|
|
AsyncListDiffer<T> asyncListDiffer = new AsyncListDiffer<>(new AdapterListUpdateCallback(this), asyncDifferConfig);
|
|
this.mDiffer = asyncListDiffer;
|
|
asyncListDiffer.addListListener(r0);
|
|
}
|
|
|
|
public ListAdapter(@NonNull DiffUtil.ItemCallback<T> itemCallback) {
|
|
AnonymousClass1 r0 = new AnonymousClass1();
|
|
this.mListener = r0;
|
|
AsyncListDiffer<T> asyncListDiffer = new AsyncListDiffer<>(new AdapterListUpdateCallback(this), new AsyncDifferConfig.Builder(itemCallback).build());
|
|
this.mDiffer = asyncListDiffer;
|
|
asyncListDiffer.addListListener(r0);
|
|
}
|
|
|
|
@NonNull
|
|
public List<T> getCurrentList() {
|
|
return this.mDiffer.getCurrentList();
|
|
}
|
|
|
|
public T getItem(int i) {
|
|
return this.mDiffer.getCurrentList().get(i);
|
|
}
|
|
|
|
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
|
public int getItemCount() {
|
|
return this.mDiffer.getCurrentList().size();
|
|
}
|
|
|
|
public void onCurrentListChanged(@NonNull List<T> list, @NonNull List<T> list2) {
|
|
}
|
|
|
|
public void submitList(@Nullable List<T> list) {
|
|
this.mDiffer.submitList(list);
|
|
}
|
|
|
|
public void submitList(@Nullable List<T> list, @Nullable Runnable runnable) {
|
|
this.mDiffer.submitList(list, runnable);
|
|
}
|
|
}
|