Created
October 15, 2017 02:05
-
-
Save ar-android/570bbfd8ab6fbc0d6a7bdadf5cd38d3d 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
| class HomeActivity : AppCompatActivity(), LifecycleOwner{ | |
| private var viewModel = HomeViewModel() | |
| override fun onCreate(savedInstanceState: Bundle?) { | |
| super.onCreate(savedInstanceState) | |
| setContentView(R.layout.activity_home) | |
| viewModel = ViewModelProviders.of(this).get(HomeViewModel::class.java) | |
| viewModel.loading.observe(this, Observer { displayLoading(it ?: false) }) | |
| viewModel.message.observe(this, Observer { displayMessage( it ) }) | |
| viewModel.jadwal.observe(this, Observer { displayData(it) }) | |
| } | |
| private fun displayData(jadwal: JadwalSholatApi.Jadwal?) { | |
| // Display UI | |
| } | |
| private fun displayMessage(messages: String?) { | |
| // Display UI | |
| } | |
| private fun displayLoading(loading: Boolean) { | |
| // Display UI | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment