Created
July 19, 2020 15:32
-
-
Save 1jGabriel/23186f69f6271c82d7530c5c767ccebe to your computer and use it in GitHub Desktop.
Adapter utilizando PagingV3
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
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