CymChad / CymChad/BaseRecyclerViewAdapterHelper
使用ConcatAdapter时,设置的itemType无效报错
Nobody has claimed this yet.
- Dominant language
- Kotlin
- Stars
- 24.6k
- Forks
- 5.2k
- PR merge metrics
- No merged PRs in 30d
Description
使用ConcatAdapter包裹两个这个adapter时,在显示时,拿到的itemType并不是设置的值,导致找不到provider,报空指针错误
Process: com.donkingliang.consecutivescroller, PID: 13316
kotlin.KotlinNullPointerException
at com.chad.library.adapter.base.BaseProviderMultiAdapter.convert(BaseProviderMultiAdapter.kt:57)
at com.chad.library.adapter.base.BaseQuickAdapter.onBindViewHolder(BaseQuickAdapter.kt:376)
at com.chad.library.adapter.base.BaseQuickAdapter.onBindViewHolder(BaseQuickAdapter.kt:382)
at com.chad.library.adapter.base.BaseQuickAdapter.onBindViewHolder(BaseQuickAdapter.kt:75)
at androidx.recyclerview.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:7258)
at androidx.recyclerview.widget.NestedAdapterWrapper.onBindViewHolder(NestedAdapterWrapper.java:157)
at androidx.recyclerview.widget.ConcatAdapterController.onBindViewHolder(ConcatAdapterController.java:368)
at androidx.recyclerview.widget.ConcatAdapter.onBindViewHolder(ConcatAdapter.java:188)
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 reproducing the issue with two adapters wrapped in AndroidX ConcatAdapter, then inspect BaseProviderMultiAdapter.convert and the BaseQuickAdapter.onBindViewHolder paths named in the stack trace. Done means the configured itemType is preserved during binding, the correct provider is found, and the null-pointer failure no longer occurs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, kotlin
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100