Last active
June 6, 2021 10:01
-
-
Save annchar/b33c19ffa3eb02f3b68137671bb27bcb to your computer and use it in GitHub Desktop.
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
private val cryptoListAdapter by lazy { | |
CryptoListAdapter { | |
showToastMessage(getString(R.string.item_clicked, it.symbol)) | |
} | |
} | |
private fun initView() { | |
... | |
// initial recyclerView | |
binding.rcCryptoList.addItemDecoration(itemDecorator) | |
binding.rcCryptoList.adapter = cryptoListAdapter | |
} | |
private fun initObservers() { | |
viewLifecycleOwner.lifecycleScope.launch { | |
viewModel.getCryptoList().observe(viewLifecycleOwner, { | |
cryptoListAdapter.submitData(lifecycle, it) | |
}) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment