diff --git a/app/src/main/java/com/lxj/easyadapter/sample/MainActivity.kt b/app/src/main/java/com/lxj/easyadapter/sample/MainActivity.kt index 41139d1..b461186 100644 --- a/app/src/main/java/com/lxj/easyadapter/sample/MainActivity.kt +++ b/app/src/main/java/com/lxj/easyadapter/sample/MainActivity.kt @@ -100,6 +100,7 @@ class MainActivity : AppCompatActivity() { setText(R.id.tv_age, "age: " + user.age) } } + }.apply { setOnItemClickListener(object : MultiItemTypeAdapter.SimpleOnItemClickListener() { override fun onItemClick(view: View, holder: RecyclerView.ViewHolder, position: Int) { diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 5b906d1..e8328f0 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -1,7 +1,7 @@ diff --git a/easy-adapter/src/main/java/com/lxj/easyadapter/EasyAdapter.kt b/easy-adapter/src/main/java/com/lxj/easyadapter/EasyAdapter.kt index 2d5a391..f73bd75 100644 --- a/easy-adapter/src/main/java/com/lxj/easyadapter/EasyAdapter.kt +++ b/easy-adapter/src/main/java/com/lxj/easyadapter/EasyAdapter.kt @@ -16,10 +16,19 @@ abstract class EasyAdapter(data: List, protected var mLayoutId: Int) : Mul this@EasyAdapter.bind(holder, t, position) } + override fun bindWithPayloads(holder: ViewHolder, t: T, + position: Int, payloads: List) { + this@EasyAdapter.bindWithPayloads(holder, t, position, payloads) + } + override fun getLayoutId() = mLayoutId }) } protected abstract fun bind(holder: ViewHolder, t: T, position: Int) + protected open fun bindWithPayloads(holder: ViewHolder, t: T, position: Int, payloads: List) { + bind(holder, t, position) + } + }