diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index b1614dcb..9729fcd8 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -117,6 +117,7 @@ + diff --git a/app/src/main/kotlin/com/simplemobiletools/musicplayer/adapters/SongAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/musicplayer/adapters/SongAdapter.kt index 00238d38..0521da86 100644 --- a/app/src/main/kotlin/com/simplemobiletools/musicplayer/adapters/SongAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/musicplayer/adapters/SongAdapter.kt @@ -246,7 +246,11 @@ class SongAdapter(activity: SimpleActivity, var songs: ArrayList, 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) + } } } diff --git a/app/src/main/kotlin/com/simplemobiletools/musicplayer/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/musicplayer/helpers/Constants.kt index d982c18d..07e76f20 100644 --- a/app/src/main/kotlin/com/simplemobiletools/musicplayer/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/musicplayer/helpers/Constants.kt @@ -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" diff --git a/app/src/main/kotlin/com/simplemobiletools/musicplayer/services/MusicService.kt b/app/src/main/kotlin/com/simplemobiletools/musicplayer/services/MusicService.kt index 77543e1b..463fd226 100644 --- a/app/src/main/kotlin/com/simplemobiletools/musicplayer/services/MusicService.kt +++ b/app/src/main/kotlin/com/simplemobiletools/musicplayer/services/MusicService.kt @@ -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