SmartAdapterBuilder

interface SmartAdapterBuilder<T>

Author

Ayvytr 's GitHub

Since

0.3.0

Functions

build
Link copied to clipboard
abstract fun build(): SmartAdapter<T>
diff
Link copied to clipboard
abstract fun diff(smartDiffCallback: SmartDiffCallback<T> = SmartDiffCallback(), detectMovies: Boolean = true)

设置diff callback,SmartDiffCallback做了包装,SmartAdapter内部还是使用了DiffUtil.Callback.

Properties

itemClick
Link copied to clipboard
abstract var itemClick: (T, position: Int) -> Unit

点击事件.

itemLongClick
Link copied to clipboard
abstract var itemLongClick: (T, position: Int) -> Unit

长按点击事件.

items
Link copied to clipboard
abstract var items: List<T>
itemViewOf
Link copied to clipboard
abstract var itemViewOf: SmartContainer<T>

设置一个类型的item view,等于设置一个SmartContainer,包含layout id, view type, 初始化view的SmartContainer.bind方法, 不管是不是同时设置了itemViewOf,multiItemViewOf,只要view type不重复,有多少个不同的view type就有 多少个item view type.

multiItemViewOf
Link copied to clipboard
abstract var multiItemViewOf: List<SmartContainer<T>>

设置多个类型的item view,等于设置多个SmartContainer. 不管是不是同时设置了itemViewOf,multiItemViewOf,只要view type不重复,有多少个不同的view type就有 多少个item view type.

type
Link copied to clipboard
abstract var type: (T) -> Int

通过当前item获取view type,和typePosition功能相同,但会相互覆盖.

typePosition
Link copied to clipboard
abstract var typePosition: (T, position: Int) -> Int

通过当前item和position获取view type,和type功能相同,但会相互覆盖.