-
Notifications
You must be signed in to change notification settings - Fork 7
26 homework #41
base: main
Are you sure you want to change the base?
26 homework #41
Conversation
ElenaVeshtard
commented
May 22, 2022



18 Home work. Figma.
This reverts commit 9a04e30
|
Нужны рамки! |
| } | ||
| private val viewModelModule: Module | ||
| get() = module { | ||
| viewModel { AlbumsViewModel(get()) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
viewModelOf
| import retrofit2.Retrofit | ||
| import retrofit2.create | ||
|
|
||
| class ITunesRemoteDataSourceRetrofit : MusicApi { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Уже Коле писал для реализации нужен другой интерфейс. Этот должен быть только для retrofit, конечно работает и так, но надо, чтобы было чище.
|
|
||
| fun loadTracks() { | ||
| viewModelScope.launch(Dispatchers.IO) { | ||
| _stateITunes.emit(musicApi.getTracks(1)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
обработка ошибок?
| return START_NOT_STICKY | ||
| } | ||
|
|
||
| private suspend fun loadDataFake() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Это надо вынести в отдельный класс
| override fun onCreate() { | ||
| super.onCreate() | ||
|
|
||
| runBlocking { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Блокирует ui поток.
| holder.imageAlbum.clipToOutline = true | ||
| holder.imageAlbum.outlineProvider = object : ViewOutlineProvider() { | ||
| override fun getOutline(view: View, outline: Outline) { | ||
| outline.setRoundRect(0, 0, view.width, view.height, 24.0F) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dp -> px.
| val action = | ||
| LibraryMusicFragmentDirections.actionLibraryMusicFragmentToITunesMusicFragment() | ||
| navController.navigate(action) | ||
| navController.saveState() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Зачем? Наобор нужно clearState.
| navController.saveState() | ||
| } | ||
|
|
||
| viewModel.loadData() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Проверять savedInstanceState.
| import com.github.krottv.tmstemp.domain.AlbumModel | ||
| import com.github.krottv.tmstemp.domain.TracksModel | ||
|
|
||
| class LibraryMusicFragmentBinder(val fragment: LibraryMusicFragment) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Два фрагмента с одинаковым кодом.
|
|
||
| var data: List<Tracks> = data | ||
| set(value) { | ||
| field = value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
copy-paste