Code refactor
This commit is contained in:
parent
a3cee7d5f4
commit
607d1722da
2 changed files with 4 additions and 4 deletions
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue