Last active
October 18, 2020 09:46
-
-
Save makorowy/e3af1ef994f57bf8171797f7a8819caf to your computer and use it in GitHub Desktop.
Example of not handling interactions via ViewModel, part 8
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 Fragment : Fragment() { | |
@Inject | |
lateinit var viewModel: ViewModel | |
@Inject | |
lateinit var interactor: Interactor | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
viewModel.liveData.observe(this, Observer { data -> /* update the view */ }) | |
backButton.setOnClickListener { interactor.onInteraction(Interaction.BackButtonClick) } | |
skipButton.setOnClickListener { interactor.onInteraction(Interaction.SkipButtonClick) } | |
//... | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment