Created
December 11, 2018 07:31
-
-
Save plusmobileapps/7d8de1f55f0176d037cdc9dcc2a0172f 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
class MainFragment : Fragment() { | |
val viewModel: MainViewModel by viewModel() | |
override fun onActivityCreated(savedInstanceState: Bundle?) { | |
super.onActivityCreated(savedInstanceState) | |
val adapter = RecyclerViewListAdapter( | |
carouselItemClickListener = { viewModel.onCarouselItemClicked(it) }, | |
cardClickListener = { viewModel.onCardClicked(it) }, | |
cardDeleteListener = { viewModel.onCardDeleted(it) }, | |
glide = Glide.with(this) | |
) | |
view?.findViewById<RecyclerView>(R.id.recyclerview).apply { | |
this?.adapter = adapter | |
} | |
viewModel.getData().observe(this@MainFragment, Observer { data -> | |
adapter.submitList(data) | |
}) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment