Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Adapter utilizando PagingV3
class MyAdapter : PagingDataAdapter<MyModel, MyAdapter.MyViewHolder>(DiffUtilCallback()) {
// a implementação do corpo do adapter permanece a mesma
}
class DiffUtilCallBack : DiffUtil.ItemCallback<MyModel>() {
override fun areItemsTheSame(oldItem: MyModel, newItem: MyModel): Boolean {
return oldItem.id == newItem.id
}
override fun areContentsTheSame(oldItem: MyModel, newItem: MyModel): Boolean {
return oldItem == newItem
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment