diff --git a/app/src/main/kotlin/it/vfsfitvnm/vimusic/ui/components/themed/MediaItemMenu.kt b/app/src/main/kotlin/it/vfsfitvnm/vimusic/ui/components/themed/MediaItemMenu.kt index 3c80429..ea9fe82 100644 --- a/app/src/main/kotlin/it/vfsfitvnm/vimusic/ui/components/themed/MediaItemMenu.kt +++ b/app/src/main/kotlin/it/vfsfitvnm/vimusic/ui/components/themed/MediaItemMenu.kt @@ -175,13 +175,7 @@ fun NonQueuedMediaItemMenu( ) ) }, - onPlaySingle = { - binder?.stopRadio() - binder?.player?.forcePlay(mediaItem) - }, - onPlayNext = { - binder?.player?.addNext(mediaItem) - }, + onPlayNext = { binder?.player?.addNext(mediaItem) }, onEnqueue = { binder?.player?.enqueue(mediaItem) }, onRemoveFromPlaylist = onRemoveFromPlaylist, onHideFromDatabase = onHideFromDatabase, @@ -222,7 +216,6 @@ fun BaseMediaItemMenu( onGoToEqualizer: (() -> Unit)? = null, onSetSleepTimer: (() -> Unit)? = null, onStartRadio: (() -> Unit)? = null, - onPlaySingle: (() -> Unit)? = null, onPlayNext: (() -> Unit)? = null, onEnqueue: (() -> Unit)? = null, onRemoveFromQueue: (() -> Unit)? = null, @@ -240,7 +233,6 @@ fun BaseMediaItemMenu( onSetSleepTimer = onSetSleepTimer, onStartRadio = onStartRadio, onPlayNext = onPlayNext, - onPlaySingle = onPlaySingle, onEnqueue = onEnqueue, onAddToPlaylist = { playlist, position -> transaction { @@ -277,7 +269,6 @@ fun MediaItemMenu( onGoToEqualizer: (() -> Unit)? = null, onSetSleepTimer: (() -> Unit)? = null, onStartRadio: (() -> Unit)? = null, - onPlaySingle: (() -> Unit)? = null, onPlayNext: (() -> Unit)? = null, onEnqueue: (() -> Unit)? = null, onHideFromDatabase: (() -> Unit)? = null, @@ -395,17 +386,6 @@ fun MediaItemMenu( ) } - onPlaySingle?.let { onPlaySingle -> - MenuEntry( - icon = R.drawable.play, - text = "Play single", - onClick = { - onDismiss() - onPlaySingle() - } - ) - } - onPlayNext?.let { onPlayNext -> MenuEntry( icon = R.drawable.play_skip_forward, diff --git a/app/src/main/kotlin/it/vfsfitvnm/vimusic/utils/Player.kt b/app/src/main/kotlin/it/vfsfitvnm/vimusic/utils/Player.kt index 4331a80..8600a1b 100644 --- a/app/src/main/kotlin/it/vfsfitvnm/vimusic/utils/Player.kt +++ b/app/src/main/kotlin/it/vfsfitvnm/vimusic/utils/Player.kt @@ -52,7 +52,7 @@ fun Player.forcePlayFromBeginning(mediaItems: List) = forcePlayAtIndex(mediaItems, 0) fun Player.addNext(mediaItem: MediaItem) { - if (playbackState == Player.STATE_IDLE) { + if (playbackState == Player.STATE_IDLE || playbackState == Player.STATE_ENDED) { forcePlay(mediaItem) } else { addMediaItem(currentMediaItemIndex + 1, mediaItem) @@ -60,7 +60,7 @@ fun Player.addNext(mediaItem: MediaItem) { } fun Player.enqueue(mediaItem: MediaItem) { - if (playbackState == Player.STATE_IDLE) { + if (playbackState == Player.STATE_IDLE || playbackState == Player.STATE_ENDED) { forcePlay(mediaItem) } else { addMediaItem(mediaItemCount, mediaItem) @@ -68,7 +68,7 @@ fun Player.enqueue(mediaItem: MediaItem) { } fun Player.enqueue(mediaItems: List) { - if (playbackState == Player.STATE_IDLE) { + if (playbackState == Player.STATE_IDLE || playbackState == Player.STATE_ENDED) { forcePlayFromBeginning(mediaItems) } else { addMediaItems(mediaItemCount, mediaItems)