Skip to content

Commit

Permalink
代码完善
Browse files Browse the repository at this point in the history
  • Loading branch information
junixapp committed Jan 14, 2022
1 parent 20577d4 commit 2af287e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical">


Expand Down
9 changes: 9 additions & 0 deletions easy-adapter/src/main/java/com/lxj/easyadapter/EasyAdapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,19 @@ abstract class EasyAdapter<T>(data: List<T>, protected var mLayoutId: Int) : Mul
this@EasyAdapter.bind(holder, t, position)
}

override fun bindWithPayloads(holder: ViewHolder, t: T,
position: Int, payloads: List<Any>) {
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<Any>) {
bind(holder, t, position)
}

}

0 comments on commit 2af287e

Please sign in to comment.