Created
January 18, 2020 22:14
-
-
Save CostaFot/8f59528637ec5ea8b7b00a15013e5e3f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | |
super.onViewCreated(view, savedInstanceState) | |
viewModelpost.stateData.observe(viewLifecycleOwner, Observer { state -> | |
when (state) { | |
State.Loading -> button.text = "Loading" | |
is State.Post -> button.text = state.text | |
} | |
}) | |
button.setOnClickListener { | |
viewModelpost.getRedditPost() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment