Closed Yashraj254 closed 11 months ago
@naveensingh please check if its ok
@Yashraj254 can you resolve the conflicts please
@Yashraj254 It crashes when I do Play next on Albums, Artists fragments. Do it in the background.
java.lang.IllegalStateException: Cannot access database on the main thread since it may potentially lock the UI for a long period of time.
at androidx.room.RoomDatabase.assertNotMainThread(RoomDatabase.kt:444)
at androidx.room.RoomDatabase.query(RoomDatabase.kt:485)
at androidx.room.util.DBUtil.query(DBUtil.kt:75)
at com.simplemobiletools.musicplayer.interfaces.AlbumsDao_Impl.getArtistAlbums(AlbumsDao_Impl.java:250)
at com.simplemobiletools.musicplayer.adapters.ArtistsAdapter.getAllSelectedTracks(ArtistsAdapter.kt:112)
at com.simplemobiletools.musicplayer.adapters.ArtistsAdapter.playNext(ArtistsAdapter.kt:102)
at com.simplemobiletools.musicplayer.adapters.ArtistsAdapter.actionItemPressed(ArtistsAdapter.kt:65)
at com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter$1.onActionItemClicked(MyRecyclerViewAdapter.kt:58)
...
@tibbi do you think Play next should be visible when albums/artists are selected? We could add all the tracks in/by the selected album/artist to be played next but most players don't seem to allow this (Play next is only visible with tracks).
@naveensingh should i remove this play next functionality for artists and albums and allow play next functionality for single selected track only..
@Yashraj254 probably yes but let's wait for @tibbi's view...
Play next is sort of a valid option for artists, albums if we wanna add it
It is working fine for single tracks so far, the option is crashing at artists, albums fragments. I'm looking for code issues now...
yeah, lets add it to tracks only
Edge cases:
If I do Play next on the track currently being played, it moves to the top in the queue. We should keep the original order in that case (or we could disable the option for currently playing track altogether)
Maybe we should synchronize access to MusicService.mTracks
, it could throw ConcurrentModificationException
in very rare situations.
Everything else looks good to me :+1:
so, should i disable the Play Next option for currently playing track
yes, it doesn't work anyway. Note that MusicService.mCurrentTrack
could be null in some cases
so it is ready now?
Yes, it is ready. There's some minor style issues I commented above.
Play next wont be visible if MusicService.mCurrentTrack is null
That's okay, otherwise, it'll probably crash something.
@tibbi this can be merged now, I'll fix any style issues in https://github.com/SimpleMobileTools/Simple-Music-Player/pull/559
fixed it myself to speed it up, thanks
Fix #426 : add a song next to the currently playing song in the queue...
https://github.com/SimpleMobileTools/Simple-Music-Player/assets/52420957/18caa448-7943-469a-94b7-373fde05131a