Skip to content

Instantly share code, notes, and snippets.

@alexsullivan114
Created April 29, 2019 23:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexsullivan114/3779601bc12c02ad1cd58b203a574fa5 to your computer and use it in GitHub Desktop.
Save alexsullivan114/3779601bc12c02ad1cd58b203a574fa5 to your computer and use it in GitHub Desktop.
class AddNoteActivity : BaseActivity<AddNoteViewModel>() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_add_note)
add_note_button.setOnClickListener { viewModel.addNoteClicked(note_text.text.toString()) }
observeTrigger(viewModel.setResultAndFinishStream, this::setResultAndFinish)
observeTrigger(viewModel.showAddNoteFailedErrorStream, this::showErrorMessage)
observe(viewModel.shouldEnableAddNoteButtonStream, add_note_button::setEnabled)
observe(viewModel.shouldShowLoadingIndicatorStream, swipe_refresh::setRefreshing)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment