Skip to content

Instantly share code, notes, and snippets.

@fraggjkee
Last active May 17, 2020 15:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fraggjkee/981bf1924bf7bc9153578fedc7fb23d3 to your computer and use it in GitHub Desktop.
Save fraggjkee/981bf1924bf7bc9153578fedc7fb23d3 to your computer and use it in GitHub Desktop.
@BindingAdapter("items")
fun setRecyclerViewItems(
recyclerView: RecyclerView,
items: List<RecyclerItem>?
) {
var adapter = (recyclerView.adapter as? RecyclerViewAdapter)
if (adapter == null) {
adapter = RecyclerViewAdapter()
recyclerView.adapter = adapter
}
adapter.updateData(items.orEmpty())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment