diff --git a/app/src/main/kotlin/com/simplemobiletools/musicplayer/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/musicplayer/activities/MainActivity.kt index 84daaa36..a334bbc5 100644 --- a/app/src/main/kotlin/com/simplemobiletools/musicplayer/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/musicplayer/activities/MainActivity.kt @@ -249,11 +249,12 @@ class MainActivity : SimpleActivity(), SongListListener { dbHelper.getAllPlaylists { it.forEach { val playlist = it - val newPlaylistId = playlistDAO.insert(it).toInt() + val newPlaylistId = if (playlist.id == ALL_SONGS_PLAYLIST_ID) ALL_SONGS_PLAYLIST_ID else playlistDAO.insert(playlist.copy(id = 0)).toInt() val playlistSongPaths = songs.filter { it.playListId == newPlaylistId }.map { it.path } as ArrayList - RoomHelper(applicationContext).addSongsToPlaylist(playlistSongPaths, playlist.id) + RoomHelper(applicationContext).addSongsToPlaylist(playlistSongPaths, newPlaylistId) } + playlistChanged(ALL_SONGS_PLAYLIST_ID) config.wereSongsMigrated = true } }