Package com.drake.brv.utils

Types

BRV
Link copied to clipboard
object BRV

Functions

addModels
Link copied to clipboard
fun RecyclerView.addModels(models: List<Any?>?, animation: Boolean = true, @IntRange(from = -1.toLong()index: Int = -1)
添加新的数据
divider
Link copied to clipboard
fun RecyclerView.divider(block: DefaultDecoration.() -> Unit): RecyclerView
函数配置分割线 具体配置参数查看DefaultDecoration
fun RecyclerView.divider(@DrawableRes() drawable: Int, orientation: DividerOrientation = DividerOrientation.HORIZONTAL): RecyclerView
指定Drawable资源为分割线, 分割线的间距和宽度应在资源文件中配置
dividerSpace
Link copied to clipboard
fun RecyclerView.dividerSpace(space: Int, orientation: DividerOrientation = DividerOrientation.HORIZONTAL): RecyclerView
设置空白间距分割
grid
Link copied to clipboard
fun RecyclerView.grid(spanCount: Int = 1, orientation: Int = VERTICAL, reverseLayout: Boolean = false, scrollEnabled: Boolean = true): RecyclerView
创建HoverGridLayoutManager 网格列表
linear
Link copied to clipboard
fun RecyclerView.linear(orientation: Int = VERTICAL, reverseLayout: Boolean = false, scrollEnabled: Boolean = true, stackFromEnd: Boolean = false): RecyclerView
创建HoverLinearLayoutManager 线性列表
pageCreate
Link copied to clipboard
fun View.pageCreate(loadMoreEnabled: Boolean = true, stateEnabled: Boolean = true): PageRefreshLayout
创建一个PageRefreshLayout来包裹视图 但是更建议在XML布局中创建PageRefreshLayout, 可保持代码可读性且避免不必要的问题发生, 性能也更优
setDifferModels
Link copied to clipboard
fun RecyclerView.setDifferModels(newModels: List<Any?>?, detectMoves: Boolean = true, commitCallback: Runnable? = null)
对比数据, 根据数据差异自动刷新列表 数据对比默认使用equals函数对比, 你可以为数据手动实现equals函数来修改对比逻辑.
setup
Link copied to clipboard
fun Dialog.setup(block: BindingAdapter.(RecyclerView) -> Unit): Dialog
快速为对话框创建一个列表
fun RecyclerView.setup(block: BindingAdapter.(RecyclerView) -> Unit): BindingAdapter
设置适配器
staggered
Link copied to clipboard
fun RecyclerView.staggered(spanCount: Int, orientation: Int = VERTICAL, reverseLayout: Boolean = false, scrollEnabled: Boolean = true): RecyclerView

Properties

bindingAdapter
Link copied to clipboard
val RecyclerView.bindingAdapter: BindingAdapter
如果Adapter是BindingAdapter则返回对象, 否则抛出异常
models
Link copied to clipboard
var RecyclerView.models: List<Any?>?
数据模型集合 如果赋值的是List不可变集合将会自动被替换成MutableList, 将无法保持为同一个集合对象引用
mutable
Link copied to clipboard
var RecyclerView.mutable: Nothing
可增删的数据模型集合, 本质上就是返回可变的models.