-
public abstract class BaseDifferAdapter<T extends Object, VH extends RecyclerView.ViewHolder> extends BaseQuickAdapter<T, VH>
Base differ adapter
使用 Differ 的父类
-
-
Field Summary
Fields Modifier and Type Field Description private List<T>itemsprivate final RecyclerViewrecyclerViewprivate final Contextcontextprivate final BooleanisEmptyViewHolderprivate BooleanisEmptyViewEnableprivate ViewemptyViewprivate BooleananimationEnableprivate BooleanisAnimationFirstOnlyprivate ItemAnimatoritemAnimation
-
Constructor Summary
Constructors Constructor Description BaseDifferAdapter(DiffUtil.ItemCallback<T> diffCallback)BaseDifferAdapter(DiffUtil.ItemCallback<T> diffCallback, List<T> items)BaseDifferAdapter(AsyncDifferConfig<T> config)BaseDifferAdapter(AsyncDifferConfig<T> config, List<T> items)
-
Method Summary
Modifier and Type Method Description final List<T>getItems()final UnitsetItems(List<T> items)final RecyclerViewgetRecyclerView()final ContextgetContext()final BooleangetIsEmptyViewHolder(RecyclerView.ViewHolder $self)final BooleangetIsEmptyViewEnable()是否使用空布局 Whether to use empty layout. final UnitsetIsEmptyViewEnable(Boolean isEmptyViewEnable)final ViewgetEmptyView()Empty view. final UnitsetEmptyView(View emptyView)final BooleangetAnimationEnable()Whether enable animation. final UnitsetAnimationEnable(Boolean animationEnable)Whether enable animation. final BooleangetIsAnimationFirstOnly()Whether the animation executed only the first time. final UnitsetIsAnimationFirstOnly(Boolean isAnimationFirstOnly)Whether the animation executed only the first time. final ItemAnimatorgetItemAnimation()Set custom animation. final UnitsetItemAnimation(ItemAnimator itemAnimation)UnitonCurrentListChanged(List<T> previousList, List<T> currentList)(Optional) Override this method to monitor changes in the dataset before and after.. UnitsubmitList(List<T> list)Submit List 提交数据集 final UnitsubmitList(List<T> list, Runnable commitCallback)Unitset(Integer position, T data)change data 改变某一位置数据 Unitadd(T data)add one new data,not null. Unitadd(Integer position, T data)add one new data in to certain location 在指定位置添加一条新数据 UnitaddAll(Collection<T> collection)添加一组数据,不可为 null。 UnitaddAll(Integer position, Collection<T> collection)add new data in to certain location 在指定位置添加数据 UnitremoveAt(Integer position)remove the item associated with the specified position of adapter 删除指定位置的数据 Unitremove(T data)删除数据 Unitswap(Integer fromPosition, Integer toPosition)Item swap 数据位置交换 -
Methods inherited from class com.chad.library.adapter.base.BaseDifferAdapter
addOnItemChildClickListener, addOnItemChildLongClickListener, addOnViewAttachStateChangeListener, clearOnViewAttachStateChangeListener, displayEmptyView, getItem, getItemCount, getItemId, getItemPosition, getItemViewType, getOnItemClickListener, getOnItemLongClickListener, isFullSpanItem, onAttachedToRecyclerView, onBindViewHolder, onBindViewHolder, onCreateViewHolder, onDetachedFromRecyclerView, onViewAttachedToWindow, onViewDetachedFromWindow, removeOnItemChildClickListener, removeOnItemChildLongClickListener, removeOnViewAttachStateChangeListener, setEmptyViewLayout, setItemAnimation, setOnItemClickListener, setOnItemLongClickListener -
Methods inherited from class com.chad.library.adapter.base.BaseQuickAdapter
bindViewHolder, canRestoreState, createViewHolder, findRelativeAdapterPositionIn, getStateRestorationPolicy, hasObservers, hasStableIds, notifyDataSetChanged, notifyItemChanged, notifyItemChanged, notifyItemInserted, notifyItemMoved, notifyItemRangeChanged, notifyItemRangeChanged, notifyItemRangeInserted, notifyItemRangeRemoved, notifyItemRemoved, onFailedToRecycleView, onViewRecycled, registerAdapterDataObserver, setHasStableIds, setStateRestorationPolicy, unregisterAdapterDataObserver -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
BaseDifferAdapter
BaseDifferAdapter(DiffUtil.ItemCallback<T> diffCallback)
-
BaseDifferAdapter
BaseDifferAdapter(DiffUtil.ItemCallback<T> diffCallback, List<T> items)
-
BaseDifferAdapter
BaseDifferAdapter(AsyncDifferConfig<T> config)
-
BaseDifferAdapter
BaseDifferAdapter(AsyncDifferConfig<T> config, List<T> items)
-
-
Method Detail
-
getRecyclerView
final RecyclerView getRecyclerView()
-
getContext
final Context getContext()
-
getIsEmptyViewHolder
final Boolean getIsEmptyViewHolder(RecyclerView.ViewHolder $self)
-
getIsEmptyViewEnable
final Boolean getIsEmptyViewEnable()
是否使用空布局 Whether to use empty layout.
-
setIsEmptyViewEnable
final Unit setIsEmptyViewEnable(Boolean isEmptyViewEnable)
-
getEmptyView
final View getEmptyView()
-
setEmptyView
final Unit setEmptyView(View emptyView)
-
getAnimationEnable
final Boolean getAnimationEnable()
Whether enable animation. 是否打开动画
-
setAnimationEnable
final Unit setAnimationEnable(Boolean animationEnable)
Whether enable animation. 是否打开动画
-
getIsAnimationFirstOnly
final Boolean getIsAnimationFirstOnly()
Whether the animation executed only the first time. 动画是否仅第一次执行
-
setIsAnimationFirstOnly
final Unit setIsAnimationFirstOnly(Boolean isAnimationFirstOnly)
Whether the animation executed only the first time. 动画是否仅第一次执行
-
getItemAnimation
final ItemAnimator getItemAnimation()
Set custom animation. 设置自定义动画
-
setItemAnimation
final Unit setItemAnimation(ItemAnimator itemAnimation)
-
onCurrentListChanged
Unit onCurrentListChanged(List<T> previousList, List<T> currentList)
(Optional) Override this method to monitor changes in the dataset before and after.. (可选)重写此方法,监听前后数据集变化
- Parameters:
previousList- 原数据集currentList- 当前数据集
-
submitList
Unit submitList(List<T> list)
Submit List 提交数据集
-
submitList
final Unit submitList(List<T> list, Runnable commitCallback)
-
addAll
Unit addAll(Collection<T> collection)
添加一组数据,不可为 null。
-
addAll
Unit addAll(Integer position, Collection<T> collection)
add new data in to certain location 在指定位置添加数据
- Parameters:
position- the insert positioncollection- the new data collection
-
removeAt
Unit removeAt(Integer position)
remove the item associated with the specified position of adapter 删除指定位置的数据
-
-
-
-