-
public abstract class BaseItemBinder<T extends Object, VH extends BaseViewHolder>Binder 的基类
-
-
Constructor Summary
Constructors Constructor Description BaseItemBinder()
-
Method Summary
Modifier and Type Method Description final BaseBinderAdaptergetAdapter()final ContextgetContext()final List<Object>getData()abstract VHonCreateViewHolder(ViewGroup parent, Integer viewType)abstract Unitconvert(VH holder, T data)在此处对设置item数据 Unitconvert(VH holder, T data, List<Object> payloads)使用局部刷新时候,会调用此方法 BooleanonFailedToRecycleView(VH holder)UnitonViewAttachedToWindow(VH holder)Called when a view created by this BaseItemBinder has been attached to a window. UnitonViewDetachedFromWindow(VH holder)Called when a view created by this BaseItemBinder has been detached from its window. UnitonClick(VH holder, View view, T data, Integer position)item 若想实现条目点击事件则重写该方法 BooleanonLongClick(VH holder, View view, T data, Integer position)item 若想实现条目长按事件则重写该方法 UnitonChildClick(VH holder, View view, T data, Integer position)item 子控件的点击事件 BooleanonChildLongClick(VH holder, View view, T data, Integer position)item 子控件的长按事件 final UnitaddChildClickViewIds(@IdRes() Integer ids)final <ERROR CLASS>getChildClickViewIds()final UnitaddChildLongClickViewIds(@IdRes() Integer ids)final <ERROR CLASS>getChildLongClickViewIds()-
-
Method Detail
-
getAdapter
final BaseBinderAdapter getAdapter()
-
getContext
final Context getContext()
-
onCreateViewHolder
abstract VH onCreateViewHolder(ViewGroup parent, Integer viewType)
-
convert
Unit convert(VH holder, T data, List<Object> payloads)
使用局部刷新时候,会调用此方法
- Parameters:
holder- VHdata- Tpayloads- List<Any>
-
onFailedToRecycleView
Boolean onFailedToRecycleView(VH holder)
-
onViewAttachedToWindow
Unit onViewAttachedToWindow(VH holder)
Called when a view created by this BaseItemBinder has been attached to a window. 当此BaseItemBinder出现在屏幕上的时候,会调用此方法
This can be used as a reasonable signal that the view is about to be seen by the user. If the BaseItemBinder previously freed any resources in .onViewDetachedFromWindow those resources should be restored here.
- Parameters:
holder- Holder of the view being attached
-
onViewDetachedFromWindow
Unit onViewDetachedFromWindow(VH holder)
Called when a view created by this BaseItemBinder has been detached from its window. 当此BaseItemBinder从屏幕上移除的时候,会调用此方法
Becoming detached from the window is not necessarily a permanent condition; the consumer of an Adapter's views may choose to cache views offscreen while they are not visible, attaching and detaching them as appropriate.
- Parameters:
holder- Holder of the view being detached
-
onClick
Unit onClick(VH holder, View view, T data, Integer position)
item 若想实现条目点击事件则重写该方法
- Parameters:
holder- VHdata- Tposition- Int
-
onLongClick
Boolean onLongClick(VH holder, View view, T data, Integer position)
item 若想实现条目长按事件则重写该方法
- Parameters:
holder- VHdata- Tposition- Int
-
onChildClick
Unit onChildClick(VH holder, View view, T data, Integer position)
item 子控件的点击事件
- Parameters:
holder- VHview- Viewdata- Tposition- Int
-
onChildLongClick
Boolean onChildLongClick(VH holder, View view, T data, Integer position)
item 子控件的长按事件
- Parameters:
holder- VHview- Viewdata- Tposition- Int
-
addChildClickViewIds
final Unit addChildClickViewIds(@IdRes() Integer ids)
-
getChildClickViewIds
final <ERROR CLASS> getChildClickViewIds()
-
addChildLongClickViewIds
final Unit addChildLongClickViewIds(@IdRes() Integer ids)
-
getChildLongClickViewIds
final <ERROR CLASS> getChildLongClickViewIds()
-
-
-
-