Skip to content

Instantly share code, notes, and snippets.

@joecks
Last active August 20, 2017 22:32
Show Gist options
  • Save joecks/0ea0ed899f726768b672261d08a19e30 to your computer and use it in GitHub Desktop.
Save joecks/0ea0ed899f726768b672261d08a19e30 to your computer and use it in GitHub Desktop.
// BaseReacteFragment method which auto listenes to viewData updates
override fun applyViewData(viewData: TasksViewData) {
mTasksFragBinding.viewmodel = viewData
mListAdapter.tasks = viewData.items
SnackbarUtils.showMessage(view, viewData.message)
}
...
// Bind the TasksViewItemActions to the adapter (onItemClick, onItemCheck)
mListAdapter = TasksAdapter(
ArrayList<Task>(0),
viewModel
)
...
// Bind onTaskClicked to viewModel
mTasksFragBinding.listener = viewModel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment