Skip to content

Commit

Permalink
docs: 更新开发文档
Browse files Browse the repository at this point in the history
  • Loading branch information
liangjingkanji committed Aug 7, 2023
1 parent 9b466ba commit 50ad5b2
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<p align="center">
<a href="https://jitpack.io/#liangjingkanji/BRV"><img src="https://jitpack.io/v/liangjingkanji/BRV.svg"/></a>
<img src="https://img.shields.io/badge/language-kotlin-orange.svg"/>
<img src="https://img.shields.io/badge/license-Apache-blue"/>
<img src="https://img.shields.io/badge/license-MIT-blue"/>
<a href="http://liangjingkanji.github.io/BRV/updates"><img src="https://img.shields.io/badge/changed-%E6%9B%B4%E6%96%B0%E6%97%A5%E5%BF%97-brightgreen"/></a>
<a href="http://liangjingkanji.github.io/BRV/api"><img src="https://img.shields.io/badge/api-%E5%87%BD%E6%95%B0%E6%96%87%E6%A1%A3-red"/></a>
<a href="https://raw.githubusercontent.com/liangjingkanji/liangjingkanji/master/img/group-qrcode.png"><img src="https://raw.githubusercontent.com/liangjingkanji/liangjingkanji/master/img/group.svg"/></a>
Expand Down
25 changes: 22 additions & 3 deletions docs/divider-customize.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
1. 扩展函数`divider`为简化创建`DefaultDecoration`
2.`DefaultDecoration`不满足需求可以继承`RecyclerView.ItemDecoration`实现
!!! note "列表间隔"
有时在布局中使用`layout_margin_bottom`等属性更简单

## 组合间距

Expand All @@ -22,6 +22,8 @@ binding.rv.grid(3).divider { // 水平间距

## 方法

函数`divider`简化创建`DefaultDecoration`, 其实现接口`ItemDecoration`

| 函数 | 描述 |
|-|-|
| onEnabled | 根据回调返回值是否绘制分隔线 |
Expand All @@ -44,4 +46,21 @@ data class Edge(
)
```

`left`为true表示指定position位于列表左侧, `top`为true表示位于列表顶部, 类推
`left`为true表示指定position位于列表左侧, `top`为true表示位于列表顶部, 类推

## 超复杂分隔物
超复杂分隔物建议在列表布局中绘制, 可根据`Edge.computeEdge()`禁止绘制四周

```kotlin hl_lines="5"
binding.rv.linear().divider(R.drawable.divider_horizontal).setup {
addType<DividerModel>(R.layout.item_divider_vertical)
onBind {
layoutManager = binding.rv.layoutManager!!
val edge = DefaultDecoration.Edge.computeEdge(layoutPosition, layoutManager, false)
if (edge.bottom) {
// 列表结尾不绘制分隔物
return@onBind
}
}
}.models = getData()
```
3 changes: 1 addition & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

本框架在不影响RecyclerView的任何函数组件使用基础上开发, 本项目将一直保持社区维护
BRV为快速构建RV列表工具, 以开源分享来完善, 将一直保持社区维护

<br>
<p align="center"><strong>STAR/分享可以让更多人参与到本开源项目</strong></p>
Expand Down

0 comments on commit 50ad5b2

Please sign in to comment.