Code fixes
This commit is contained in:
parent
c23c56649e
commit
f02888113e
4 changed files with 10 additions and 14 deletions
|
@ -60,7 +60,7 @@ open class SongAdapter(
|
|||
}
|
||||
|
||||
override fun getItemId(position: Int): Long {
|
||||
return dataSet[position].id.toLong()
|
||||
return dataSet[position].id
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||
|
|
|
@ -14,14 +14,10 @@ class PlaylistDetailsViewModel(
|
|||
private var playlist: PlaylistWithSongs
|
||||
) : ViewModel(), IMusicServiceEventListener {
|
||||
|
||||
private val _playListSongs = MutableLiveData<List<Song>>()
|
||||
private val _playlist = MutableLiveData<PlaylistWithSongs>().apply {
|
||||
postValue(playlist)
|
||||
}
|
||||
private val playListSongs = MutableLiveData<List<Song>>()
|
||||
|
||||
fun getPlaylist(): LiveData<PlaylistWithSongs> = _playlist
|
||||
|
||||
fun getSongs(): LiveData<List<SongEntity>> = realRepository.playlistSongs(playlist.playlistEntity)
|
||||
fun getSongs(): LiveData<List<SongEntity>> =
|
||||
realRepository.playlistSongs(playlist.playlistEntity.playListId)
|
||||
|
||||
|
||||
override fun onMediaStoreChanged() {
|
||||
|
|
|
@ -42,7 +42,7 @@ interface Repository {
|
|||
fun favorites(): LiveData<List<SongEntity>>
|
||||
fun observableHistorySongs(): LiveData<List<Song>>
|
||||
fun albumById(albumId: Long): Album
|
||||
fun playlistSongs(playlistEntity: PlaylistEntity): LiveData<List<SongEntity>>
|
||||
fun playlistSongs(playListId: Long): LiveData<List<SongEntity>>
|
||||
suspend fun fetchAlbums(): List<Album>
|
||||
suspend fun albumByIdAsync(albumId: Long): Album
|
||||
suspend fun allSongs(): List<Song>
|
||||
|
@ -252,8 +252,8 @@ class RealRepository(
|
|||
it.toSong()
|
||||
}
|
||||
|
||||
override fun playlistSongs(playlistEntity: PlaylistEntity): LiveData<List<SongEntity>> =
|
||||
roomRepository.getSongs(playlistEntity)
|
||||
override fun playlistSongs(playListId: Long): LiveData<List<SongEntity>> =
|
||||
roomRepository.getSongs(playListId)
|
||||
|
||||
override suspend fun insertSongs(songs: List<SongEntity>) =
|
||||
roomRepository.insertSongs(songs)
|
||||
|
|
|
@ -11,7 +11,7 @@ interface RoomRepository {
|
|||
fun favoritePlaylistLiveData(favorite: String): LiveData<List<SongEntity>>
|
||||
fun insertBlacklistPath(blackListStoreEntity: BlackListStoreEntity)
|
||||
fun observableHistorySongs(): LiveData<List<HistoryEntity>>
|
||||
fun getSongs(playlistEntity: PlaylistEntity): LiveData<List<SongEntity>>
|
||||
fun getSongs(playListId: Long): LiveData<List<SongEntity>>
|
||||
suspend fun createPlaylist(playlistEntity: PlaylistEntity): Long
|
||||
suspend fun checkPlaylistExists(playlistName: String): List<PlaylistEntity>
|
||||
suspend fun playlists(): List<PlaylistEntity>
|
||||
|
@ -70,8 +70,8 @@ class RealRoomRepository(
|
|||
}
|
||||
|
||||
|
||||
override fun getSongs(playlistEntity: PlaylistEntity): LiveData<List<SongEntity>> =
|
||||
playlistDao.songsFromPlaylist(playlistEntity.playListId)
|
||||
override fun getSongs(playListId: Long): LiveData<List<SongEntity>> =
|
||||
playlistDao.songsFromPlaylist(playListId)
|
||||
|
||||
override suspend fun deletePlaylistEntities(playlistEntities: List<PlaylistEntity>) =
|
||||
playlistDao.deletePlaylists(playlistEntities)
|
||||
|
|
Loading…
Reference in a new issue