Created
November 13, 2021 10:44
-
-
Save seoft/d236fef96bba3c4f63e638b1f699e01f 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
private val recyclerViewState = SubmittableRecyclerViewState( | |
object : DiffUtil.ItemCallback<AntonioUiModel>() { | |
override fun areItemsTheSame(oldItem: AntonioUiModel, newItem: AntonioUiModel) = | |
oldItem.id == newItem.id | |
override fun areContentsTheSame(oldItem: AntonioUiModel, newItem: AntonioUiModel) = | |
oldItem == newItem | |
}) | |
override fun onCreate(savedInstanceState: Bundle?) { | |
binding.recyclerView.setState( | |
recyclerViewState, | |
additionalVariables = mapOf(BR.onAntonioListener to onAntonioListener) | |
) | |
viewModel.uiModels.observe(this) { | |
recyclerViewState.submitList(it) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment