CymChad / CymChad/BaseRecyclerViewAdapterHelper

BaseQuickAdapter能改成原来那种可以在参数里传递资源id的吗?

Open
#3,763 15 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Kotlin
Stars
24.6k
Forks
5.2k
PR merge metrics
No merged PRs in 30d

Description

这是我之前重写3.x版本的BaseQuickAdapter的adapter基类,这样就只需要在子类重写convert方法设置item数据就行了,不需要onCreateViewHolder回调

abstract class BaseAdapter<T>(@LayoutRes private val layoutResId: Int, data: MutableList<T>? = null) :
    BaseQuickAdapter<T, BaseViewHolder>(layoutResId, data)
class SimpleAdapter(dataList: MutableList<Response>) : BaseAdapter<Response>(R.layout.item_simple_list, dataList) {
override fun convert(holder: BaseViewHolder, item: Response) {
        ......
    }
}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the BaseQuickAdapter API and compare its current construction and onCreateViewHolder flow with the requested BaseAdapter example. The work is done when a subclass can pass an item layout resource ID and implement only convert, without needing an onCreateViewHolder callback.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.