public abstract class HelperRecyclerViewAdapter<T> extends BaseRecyclerViewAdapter<T> implements DataHelper<T>
描述:提供便捷操作的baseAdapter
作者: zhouyou
日期: 2016/8/25 10:29
版本: v2.0
BaseRecyclerViewAdapter.OnItemClickListener<T>, BaseRecyclerViewAdapter.OnItemLongClickListener<T>mContext, mLayoutIds, mLInflater, mList| 构造器和说明 |
|---|
HelperRecyclerViewAdapter(android.content.Context context,
int... layoutIds) |
HelperRecyclerViewAdapter(java.util.List<T> mList,
android.content.Context context)
已过时。
|
HelperRecyclerViewAdapter(java.util.List<T> data,
android.content.Context context,
int... layoutId) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
add(int startPosition,
T data)
添加单个数据到指定位置
|
boolean |
addAll(int startPosition,
java.util.List<T> datas)
添加数据集合到指定位置
|
boolean |
addAndNotifyItems(java.util.List<T> datas)
设置了item动画必须用notifyItemRangeInserted刷新适配器,否则没有动画效果
|
boolean |
addItemsToHead(java.util.List<T> datas)
添加数据集到列表头部
|
boolean |
addItemsToLast(java.util.List<T> datas)
添加数据集到列表尾部
|
void |
addItemToHead(T data)
添加单个数据到列表头部
|
boolean |
addItemToLast(T data)
添加单个数据到列表尾部
|
void |
alterObj(int index,
T data)
修改对应的位置的数据
|
void |
alterObj(T oldData,
T newData)
将某一个数据修改
|
void |
clear()
清除所有
|
boolean |
contains(T data)
判断数据集合中是否包含这个对象
|
protected BaseRecyclerViewHolder |
createViewHolder(android.view.View view,
int layoutId) |
T |
getData(int index)
获取index对于的数据
|
java.util.List<T> |
getList() |
protected abstract void |
HelperBindData(HelperRecyclerViewHolder viewHolder,
int position,
T item) |
boolean |
isEnabled(int position) |
protected void |
onBindData(BH viewHolder,
int position,
T item)
绑定数据到Item View上
|
boolean |
remove(T data)
删除对应的数据
|
void |
removeToIndex(int index)
删除对应位置的数据
|
void |
replaceAll(java.util.List<T> data)
替换所有数据
|
boolean |
setListAll(java.util.List<T> datas)
覆盖所有数据
|
protected void |
setListener(HelperRecyclerViewHolder viewHolder,
int position,
T item)
绑定相关事件,例如点击长按等,默认空实现
|
checkLayout, getItemCount, getItemViewType, inflateItemView, isEmpty, onBindItemClickListener, onBindViewHolder, onBindViewHolder, onCreateViewHolder, setOnItemClickListener, setOnItemLongClickListenerpublic HelperRecyclerViewAdapter(java.util.List<T> data, android.content.Context context, int... layoutId)
data - 数据源context - 上下文layoutId - 布局Idpublic HelperRecyclerViewAdapter(android.content.Context context,
int... layoutIds)
@Deprecated public HelperRecyclerViewAdapter(java.util.List<T> mList, android.content.Context context)
protected BaseRecyclerViewHolder createViewHolder(android.view.View view, int layoutId)
createViewHolder 在类中 BaseRecyclerViewAdapter<T>protected void onBindData(BH viewHolder, int position, T item)
BaseRecyclerViewAdapteronBindData 在类中 BaseRecyclerViewAdapter<T>position - 数据的位置item - 数据项protected abstract void HelperBindData(HelperRecyclerViewHolder viewHolder, int position, T item)
protected void setListener(HelperRecyclerViewHolder viewHolder, int position, T item)
viewHolder - position - 数据的位置item - 数据项public boolean isEnabled(int position)
isEnabled 在接口中 DataHelper<T>public void addItemToHead(T data)
DataHelperaddItemToHead 在接口中 DataHelper<T>public boolean addItemToLast(T data)
DataHelperaddItemToLast 在接口中 DataHelper<T>data - 数据public boolean addItemsToHead(java.util.List<T> datas)
DataHelperaddItemsToHead 在接口中 DataHelper<T>public boolean addItemsToLast(java.util.List<T> datas)
DataHelperaddItemsToLast 在接口中 DataHelper<T>public boolean addAndNotifyItems(java.util.List<T> datas)
datas - public boolean addAll(int startPosition,
java.util.List<T> datas)
DataHelperaddAll 在接口中 DataHelper<T>startPosition - 数据添加的位置datas - 数据集合public void add(int startPosition,
T data)
DataHelperadd 在接口中 DataHelper<T>startPosition - 数据添加的位置data - 数据public T getData(int index)
DataHelpergetData 在接口中 DataHelper<T>index - 数据座标public void alterObj(T oldData, T newData)
DataHelperalterObj 在接口中 DataHelper<T>oldData - 旧的数据newData - 新的数据public void alterObj(int index,
T data)
DataHelperalterObj 在接口中 DataHelper<T>index - 修改的位置data - 要代替的的数据public boolean remove(T data)
DataHelperremove 在接口中 DataHelper<T>public void removeToIndex(int index)
DataHelperremoveToIndex 在接口中 DataHelper<T>public void replaceAll(java.util.List<T> data)
DataHelperreplaceAll 在接口中 DataHelper<T>public boolean setListAll(java.util.List<T> datas)
DataHelpersetListAll 在接口中 DataHelper<T>public void clear()
DataHelperclear 在接口中 DataHelper<T>public boolean contains(T data)
DataHelpercontains 在接口中 DataHelper<T>data - 判断对象public java.util.List<T> getList()