Code refactor

This commit is contained in:
Hemanth S 2020-05-21 03:10:29 +05:30
parent a3cee7d5f4
commit 607d1722da
2 changed files with 4 additions and 4 deletions

View file

@ -48,7 +48,7 @@ import java.util.*
class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallbacks {
private lateinit var homeAdapter: HomeAdapter
lateinit var homeModel: HomeViewModel
private lateinit var homeModel: HomeViewModel
override fun onCreateView(
inflater: LayoutInflater,

View file

@ -17,7 +17,7 @@ class HomeViewModel(application: Application) : AndroidViewModel(application) {
loadHome()
}
fun loadHome() = viewModelScope.launch {
private fun loadHome() = viewModelScope.launch {
val list = mutableListOf<Home>()
val result = listOf(
repository.topArtists(),
@ -27,8 +27,8 @@ class HomeViewModel(application: Application) : AndroidViewModel(application) {
repository.favoritePlaylist()
)
for (r in result) {
when (r) {
is Result.Success -> list.add(r.data)
if (r is Result.Success) {
list.add(r.data)
}
}
sections.value = list