adapter¶
1.2.0(Latest)🥳🥳🥳¶
-
更新:
- 将 Adapter 基类都重命名为 BaseXXXAdapter 。 #199311a
- 列表项点击事件应该仅关注数据部分,例如
fun onItemClick(view: View, pos: Int, data: ItemWrapper<T>)更新为fun onItemClick(view: View, pos: Int, item: T?)。 #3575589 -
BaseAdapter 和 BaseBindAdapter 新增以下方法:
fun add(item: T, @LayoutRes layout: Int, position: Int, scope: ItemWrapper<T>.() -> Unit)fun add(items: List<T>, @LayoutRes layout: Int, position: Int, scope: ItemWrapper<T>.() -> Unit)fun add(item: ItemWrapper<T>, position: Int)fun add(items: List<ItemWrapper<T>>, position: Int)update(item: T, @LayoutRes layout: Int, position: Int, scope: ItemWrapper<T>.() -> Unit)update(item: ItemWrapper<T>, position: Int)fun removeAt(position: Int): T?fun clear()fun setEmptyView(@LayoutRes id: Int?, scope: ItemWrapper<T>.() -> Unit)
-
BaseListAdapter 和 BaseBindListAdapter 新增以下方法:
fun submitList(items: List<T>, @LayoutRes id: Int? = null, commitCallback: Runnable? = null, scope: ItemWrapper<T>.() -> Unit)submitListWithLoading()fun setEmptyView(@LayoutRes id: Int?, scope: ItemWrapper<T>.() -> Unit)fun setLoadingView(@LayoutRes id: Int?, scope: ItemWrapper<T>.() -> Unit)
-
BaseListAdapter 和 BaseBindListAdapter 重写了以下方法:
fun submitList(list: List<ItemWrapper<T>>?)fun submitList(list: List<ItemWrapper<T>>?, commitCallback: Runnable?)
-
BasePagingAdapter 和 BaseBindPagingAdapter 新增以下方法:
suspend fun submitData(pagingData: PagingData<T>, @LayoutRes id: Int, scope: ItemWrapper<T>.() -> Unit)fun submitData(lifecycle: Lifecycle, pagingData: PagingData<T>, @LayoutRes id: Int, scope: ItemWrapper<T>.() -> Unit)
-
修复:
- 修复 ItemDiffUtil 判断错误的问题。 #3ba979a
1.1.1¶
-
更新:
- 删除了原有的所有不合理逻辑。