fix #152, make sure we dont skip any song at deleting current song

This commit is contained in:
tibbi 2018-07-16 13:20:35 +02:00
parent 6388f5a352
commit d3fdcfb58c
4 changed files with 10 additions and 1 deletions

View file

@ -110,6 +110,7 @@
<action android:name="com.simplemobiletools.musicplayer.action.PAUSE"/>
<action android:name="com.simplemobiletools.musicplayer.action.PLAYPAUSE"/>
<action android:name="com.simplemobiletools.musicplayer.action.NEXT"/>
<action android:name="com.simplemobiletools.musicplayer.action.RESET"/>
<action android:name="com.simplemobiletools.musicplayer.action.EDIT"/>
<action android:name="com.simplemobiletools.musicplayer.action.PLAYPOS"/>
<action android:name="com.simplemobiletools.musicplayer.action.REFRESH_LIST"/>

View file

@ -216,7 +216,7 @@ class SongAdapter(activity: SimpleActivity, var songs: ArrayList<Song>, val list
removeSongs.add(song)
activity.songsDAO.removeSongPath(song.path)
if (song == MusicService.mCurrSong) {
activity.sendIntent(NEXT)
activity.sendIntent(RESET)
}
}
@ -311,6 +311,7 @@ class SongAdapter(activity: SimpleActivity, var songs: ArrayList<Song>, val list
selectedPositions.clear()
if (songs.isNotEmpty()) {
selectedPositions.add(currentSongIndex - positionOffset)
activity.sendIntent(NEXT)
Thread {
deleteSongs()
selectedPositions.clear()

View file

@ -16,6 +16,7 @@ const val PREVIOUS = PATH + "PREVIOUS"
const val PAUSE = PATH + "PAUSE"
const val PLAYPAUSE = PATH + "PLAYPAUSE"
const val NEXT = PATH + "NEXT"
const val RESET = PATH + "RESET"
const val EDIT = PATH + "EDIT"
const val PLAYPOS = PATH + "PLAYPOS"
const val REFRESH_LIST = PATH + "REFRESH_LIST"

View file

@ -174,6 +174,12 @@ class MusicService : Service(), MediaPlayer.OnPreparedListener, MediaPlayer.OnEr
mPlayOnPrepare = true
setupNextSong()
}
RESET -> {
if (mPlayedSongIndexes.size - 1 != -1) {
mPlayOnPrepare = true
setSong(mPlayedSongIndexes[mPlayedSongIndexes.size - 1], false)
}
}
PLAYPOS -> playSong(intent)
EDIT -> {
mCurrSong = intent.getSerializableExtra(EDITED_SONG) as Song