CymChad / CymChad/BaseRecyclerViewAdapterHelper
建议BaseNodeAdapter中添加删除NodeFooter页脚的方法
Nobody has claimed this yet.
- Dominant language
- Kotlin
- Stars
- 24.6k
- Forks
- 5.2k
- PR merge metrics
- No merged PRs in 30d
Description
场景是这样的,二级评论,显示两条,然后我通过页脚,显示了展开的按钮,点击展开后,加载全部评论,但是页脚无法清除,源码中的removeAt方法,只适用于删除Node对象,如果传入的是页脚的对象,则会报错,
private fun removeNodesAt(position: Int): Int {
if (position >= data.size) {
return 0
}
// 记录被移除的item数量
var removeCount = 0
// 先移除子项
removeCount = #removeChildAt(position)
// 移除node自己
this.data.removeAt(position)
removeCount += 1
// 这里删除自己后,因为是也叫对象
val node = this.data[position] // 这里在通过position拿出来的,是下一级的item对象,就会产生数据混乱
// 移除脚部
if (node is NodeFooterImp && node.footerNode != null) {
this.data.removeAt(position)
removeCount += 1
}
return removeCount
}
我处理的方法是删除NodeFooter对象的父级,然后在从新加载需要展开的列表,这样动画就会有视觉问题
对了,没有提供通过页脚查找父级的方法,我自己写了一个~
希望整个问题,对该项目有所帮助~
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating BaseNodeAdapter and its removeNodesAt implementation, then inspect NodeFooterImp and the existing node-removal flow. Clarify how a footer maps to its parent and how positions are updated. Done means a footer can be removed directly without position confusion or requiring a full reload, while preserving the intended expanded-comment animation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin
- Domain
- mobile
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100