Skip to content

Instantly share code, notes, and snippets.

@longv
Last active February 1, 2021 22:28
Show Gist options
  • Save longv/8b4e159c3dd552c67af438531777cf8f to your computer and use it in GitHub Desktop.
Save longv/8b4e159c3dd552c67af438531777cf8f to your computer and use it in GitHub Desktop.
DataBindingViewHolder for data binding RecyclerView
class DataBindingViewHolder(private val viewBinding: ViewDataBinding): RecyclerView.ViewHolder(viewBinding.root) {
fun bind(bindingEntry: DataBindingEntry) {
viewBinding.apply {
bindingEntry.bindings.forEach { setVariable(it.key, it.value) }
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment