Fixed shuffle button not shuffling songs

This commit is contained in:
Prathamesh More 2022-03-27 14:36:35 +05:30
parent 97f93e09d6
commit ead8520333
2 changed files with 3 additions and 2 deletions

View file

@ -302,7 +302,7 @@ object MusicPlayerRemote : KoinComponent {
fun setShuffleMode(shuffleMode: Int): Boolean { fun setShuffleMode(shuffleMode: Int): Boolean {
if (musicService != null) { if (musicService != null) {
musicService!!.shuffleMode = shuffleMode musicService!!.setShuffleMode(shuffleMode)
return true return true
} }
return false return false

View file

@ -541,7 +541,7 @@ class MusicService : MediaBrowserServiceCompat(),
return shuffleMode return shuffleMode
} }
private fun setShuffleMode(shuffleMode: Int) { fun setShuffleMode(shuffleMode: Int) {
PreferenceManager.getDefaultSharedPreferences(this) PreferenceManager.getDefaultSharedPreferences(this)
.edit() .edit()
.putInt(SAVED_SHUFFLE_MODE, shuffleMode) .putInt(SAVED_SHUFFLE_MODE, shuffleMode)
@ -1224,6 +1224,7 @@ class MusicService : MediaBrowserServiceCompat(),
} }
META_CHANGED -> { META_CHANGED -> {
playingNotification?.updateMetadata(currentSong) { startForegroundOrNotify() } playingNotification?.updateMetadata(currentSong) { startForegroundOrNotify() }
playingNotification?.updateFavorite(currentSong) { startForegroundOrNotify() }
updateMediaSessionMetaData() updateMediaSessionMetaData()
updateMediaSessionPlaybackState() updateMediaSessionPlaybackState()
savePosition() savePosition()