Remove "Play single" menu entry

This commit is contained in:
vfsfitvnm 2022-09-01 11:59:36 +02:00
parent ae220cc5ee
commit 6b26ad1fd9
2 changed files with 4 additions and 24 deletions

View file

@ -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,

View file

@ -52,7 +52,7 @@ fun Player.forcePlayFromBeginning(mediaItems: List<MediaItem>) =
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<MediaItem>) {
if (playbackState == Player.STATE_IDLE) {
if (playbackState == Player.STATE_IDLE || playbackState == Player.STATE_ENDED) {
forcePlayFromBeginning(mediaItems)
} else {
addMediaItems(mediaItemCount, mediaItems)