-
-
Save nitrico/88d0e3c78e8a84951e110b3b7d63033c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val tweetType = Type<ItemTweetBinding>(R.layout.item_tweet) | |
// all these methods are optional: | |
.onCreate { println("Created #${it.adapterPosition}: ${it.binding.item}") } | |
.onBind { println("Bound #${it.adapterPosition}: ${it.binding.item}") } | |
.onRecycle { println("Recycled #${it.adapterPosition}: ${it.binding.item}") } | |
.onClick { toast("Clicked #${it.adapterPosition}: ${it.binding.item}") } | |
.onLongClick { toast("Long-clicked #${it.adapterPosition}: ${it.binding.item}") } | |
LastAdapter(items, BR.item) | |
.map<Tweet>(tweetType) | |
// you can also define the callbacks directly in the map call: | |
.map<User, ItemUserBinding>(R.layout.item_user) { | |
// again, all the methods are optional: | |
onCreate { println("Created #${it.adapterPosition}: ${it.binding.item}") } | |
onBind { println("Bound #${it.adapterPosition}: ${it.binding.item}") } | |
onRecycle { println("Recycled #${it.adapterPosition}: ${it.binding.item}") } | |
onClick { toast("Clicked #${it.adapterPosition}: ${it.binding.item}") } | |
onLongClick { toast("Long-clicked #${it.adapterPosition}: ${it.binding.item}") } | |
} | |
.into(list) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment