Created
April 20, 2020 08:06
-
-
Save hafizrahman/94d232e730050d8a5eab2c27f5af012b to your computer and use it in GitHub Desktop.
Observe the MediatorLiveData given by ViewModel, and update RecyclerViewAdapter accordingly.
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
mainViewModel = ViewModelProvider(activity!!).get(MainViewModel::class.java) | |
// New observer | |
mainViewModel.getAllData()?.observe(viewLifecycleOwner, | |
Observer { subjectsAndRemindersPair -> | |
view.sro_subject_list.adapter = SubjectRecyclerViewAdapter( | |
subjectsAndRemindersPair.first, | |
subjectsAndRemindersPair.second, | |
listener) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment