Skip to content

Instantly share code, notes, and snippets.

@pokk
Last active January 16, 2018 15:34
Show Gist options
  • Save pokk/f713b728802a32c96e943a7409c48a6a to your computer and use it in GitHub Desktop.
Save pokk/f713b728802a32c96e943a7409c48a6a to your computer and use it in GitHub Desktop.
the adapter was fixed.
artistAdapter = ArtistAdapter(this@ChartIndexFragment, R.layout.item_artist_type_1, artistRes) { holder, item, _ ->
// If a ViewModel doesn't exist, I will create a ViewModel.
if (null == holder.binding.avm)
holder.binding.avm = RecyclerViewSearchArtistChartViewModel(item)
// Otherwise, I just reset the data to the ViewModel.
else
holder.binding.avm?.setArtistItem(item)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment