Skip to content

Instantly share code, notes, and snippets.

View wenqin-231's full-sized avatar
💤

Lewis wenqin-231

💤
View GitHub Profile
@wenqin-231
wenqin-231 / viewbinding.kt
Last active April 14, 2020 08:53
BindingAdapter
open class BindViewHolder<VB : ViewBinding, T> : RecyclerView.ViewHolder {
private val vb: VB
private constructor(vb: VB) : super(vb.root) {
this.vb = vb
}
constructor(parent: ViewGroup, callback: (LayoutInflater, ViewGroup, Boolean) -> VB) :
this(parent.run { callback.invoke(LayoutInflater.from(context), this, false) })