CymChad / CymChad/BaseRecyclerViewAdapterHelper
BaseQuickAdapter继承传入泛型VH,以便使用RecyclerView重载方法onViewAttachedToWindow、onViewRecycled等
Nobody has claimed this yet.
- Dominant language
- Kotlin
- Stars
- 24.6k
- Forks
- 5.2k
- PR merge metrics
- No merged PRs in 30d
Description
目前源码中BaseQuickAdapter中实现:
abstract class BaseQuickAdapter<T : Any, VH : RecyclerView.ViewHolder>(
open var items: List = emptyList()
) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
}
adapter重载onViewRecycled方法时:
override fun onViewRecycled(holder: RecyclerView.ViewHolder) {
super.onViewRecycled()
}
这样需要对holder进行转换才能得到对应的ViewBinding,建议继承RecyclerView.Adapter和之前版本实现一样传入泛型VH,改成:
abstract class BaseQuickAdapter<T : Any, VH : RecyclerView.ViewHolder>(
open var items: List = emptyList()
) : RecyclerView.Adapter() {
}
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 inspecting the BaseQuickAdapter declaration and its RecyclerView.Adapter inheritance. Check how lifecycle callbacks such as onViewAttachedToWindow and onViewRecycled currently receive holders. Done means the adapter accepts the VH generic and those callbacks can use the typed holder without a cast; no test file is mentioned in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, kotlin
- Domain
- mobile-dev
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100