-
Notifications
You must be signed in to change notification settings - Fork 7
26-27 lesson homework #39
base: main
Are you sure you want to change the base?
26-27 lesson homework #39
Conversation
| 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.
Плохая практика. MusicApi должен быть отдельным интерфейсом, его не нужно реализовывать.
Нужно создать второй интерфейс DataSource. Да, так больше кода дублируется, но это правильный подход.
|
|
||
| @Serializable | ||
| data class Tracks( | ||
| var artist: String, |
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.
Модели данных нужно делать immutable - var.
| @Serializable | ||
| data class TracksModel( | ||
| var album: Album , | ||
| var tracks: ArrayList<Tracks> |
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.
Нужно делать immutable - List
| private val _stateITunes = MutableStateFlow<List<AlbumModel>?>(null) | ||
| val stateITunes: StateFlow<List<AlbumModel>?> = _stateITunes | ||
|
|
||
| fun 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.
Стоит добавить обработку ошибок.
| holder.imageAlbum.clipToOutline = true | ||
| holder.imageAlbum.outlineProvider = object: ViewOutlineProvider() { | ||
| override fun getOutline(p0: View, p1: Outline) { | ||
| p1.setRoundRect(0, 0, p0.width, p0.height, 10.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
| holder.titleTrack.text = item.title | ||
| holder.textTrack.text = item.artist | ||
|
|
||
| holder.imageTrack.clipToOutline = true |
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.
Для этого можно отдельную функцию придумать, чтобы не дублировать


No description provided.