fix a glitch at removing the currently playing song from playlist
This commit is contained in:
parent
ae0d7aaf81
commit
444f4685a1
4 changed files with 13 additions and 1 deletions
|
@ -117,6 +117,7 @@
|
|||
<action android:name="com.simplemobiletools.musicplayer.action.SET_PROGRESS"/>
|
||||
<action android:name="com.simplemobiletools.musicplayer.action.SKIP_BACKWARD"/>
|
||||
<action android:name="com.simplemobiletools.musicplayer.action.SKIP_FORWARD"/>
|
||||
<action android:name="com.simplemobiletools.musicplayer.action.REMOVE_CURRENT_SONG"/>
|
||||
</intent-filter>
|
||||
</service>
|
||||
|
||||
|
|
|
@ -246,7 +246,11 @@ class SongAdapter(activity: SimpleActivity, var songs: ArrayList<Song>, val list
|
|||
paths.add(song.path)
|
||||
removeSongs.add(song)
|
||||
if (song == MusicService.mCurrSong) {
|
||||
activity.sendIntent(NEXT)
|
||||
if (songs.size == removeSongs.size) {
|
||||
activity.sendIntent(REMOVE_CURRENT_SONG)
|
||||
} else {
|
||||
activity.sendIntent(NEXT)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ const val SET_PROGRESS = PATH + "SET_PROGRESS"
|
|||
const val SET_EQUALIZER = PATH + "SET_EQUALIZER"
|
||||
const val SKIP_BACKWARD = PATH + "SKIP_BACKWARD"
|
||||
const val SKIP_FORWARD = PATH + "SKIP_FORWARD"
|
||||
const val REMOVE_CURRENT_SONG = PATH + "REMOVE_CURRENT_SONG"
|
||||
|
||||
// shared preferences
|
||||
const val SHUFFLE = "shuffle"
|
||||
|
|
|
@ -220,6 +220,12 @@ class MusicService : Service(), MediaPlayer.OnPreparedListener, MediaPlayer.OnEr
|
|||
}
|
||||
SKIP_BACKWARD -> skipBackward()
|
||||
SKIP_FORWARD -> skipForward()
|
||||
REMOVE_CURRENT_SONG -> {
|
||||
pauseSong()
|
||||
mCurrSong = null
|
||||
songChanged(null)
|
||||
setupNotification()
|
||||
}
|
||||
}
|
||||
|
||||
return START_NOT_STICKY
|
||||
|
|
Loading…
Reference in a new issue