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 = { onPlayNext = { binder?.player?.addNext(mediaItem) },
binder?.stopRadio()
binder?.player?.forcePlay(mediaItem)
},
onPlayNext = {
binder?.player?.addNext(mediaItem)
},
onEnqueue = { binder?.player?.enqueue(mediaItem) }, onEnqueue = { binder?.player?.enqueue(mediaItem) },
onRemoveFromPlaylist = onRemoveFromPlaylist, onRemoveFromPlaylist = onRemoveFromPlaylist,
onHideFromDatabase = onHideFromDatabase, onHideFromDatabase = onHideFromDatabase,
@ -222,7 +216,6 @@ fun BaseMediaItemMenu(
onGoToEqualizer: (() -> Unit)? = null, onGoToEqualizer: (() -> Unit)? = null,
onSetSleepTimer: (() -> Unit)? = null, onSetSleepTimer: (() -> Unit)? = null,
onStartRadio: (() -> Unit)? = null, onStartRadio: (() -> Unit)? = null,
onPlaySingle: (() -> Unit)? = null,
onPlayNext: (() -> Unit)? = null, onPlayNext: (() -> Unit)? = null,
onEnqueue: (() -> Unit)? = null, onEnqueue: (() -> Unit)? = null,
onRemoveFromQueue: (() -> Unit)? = null, onRemoveFromQueue: (() -> Unit)? = null,
@ -240,7 +233,6 @@ fun BaseMediaItemMenu(
onSetSleepTimer = onSetSleepTimer, onSetSleepTimer = onSetSleepTimer,
onStartRadio = onStartRadio, onStartRadio = onStartRadio,
onPlayNext = onPlayNext, onPlayNext = onPlayNext,
onPlaySingle = onPlaySingle,
onEnqueue = onEnqueue, onEnqueue = onEnqueue,
onAddToPlaylist = { playlist, position -> onAddToPlaylist = { playlist, position ->
transaction { transaction {
@ -277,7 +269,6 @@ fun MediaItemMenu(
onGoToEqualizer: (() -> Unit)? = null, onGoToEqualizer: (() -> Unit)? = null,
onSetSleepTimer: (() -> Unit)? = null, onSetSleepTimer: (() -> Unit)? = null,
onStartRadio: (() -> Unit)? = null, onStartRadio: (() -> Unit)? = null,
onPlaySingle: (() -> Unit)? = null,
onPlayNext: (() -> Unit)? = null, onPlayNext: (() -> Unit)? = null,
onEnqueue: (() -> Unit)? = null, onEnqueue: (() -> Unit)? = null,
onHideFromDatabase: (() -> 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 -> onPlayNext?.let { onPlayNext ->
MenuEntry( MenuEntry(
icon = R.drawable.play_skip_forward, icon = R.drawable.play_skip_forward,

View file

@ -52,7 +52,7 @@ fun Player.forcePlayFromBeginning(mediaItems: List<MediaItem>) =
forcePlayAtIndex(mediaItems, 0) forcePlayAtIndex(mediaItems, 0)
fun Player.addNext(mediaItem: MediaItem) { fun Player.addNext(mediaItem: MediaItem) {
if (playbackState == Player.STATE_IDLE) { if (playbackState == Player.STATE_IDLE || playbackState == Player.STATE_ENDED) {
forcePlay(mediaItem) forcePlay(mediaItem)
} else { } else {
addMediaItem(currentMediaItemIndex + 1, mediaItem) addMediaItem(currentMediaItemIndex + 1, mediaItem)
@ -60,7 +60,7 @@ fun Player.addNext(mediaItem: MediaItem) {
} }
fun Player.enqueue(mediaItem: MediaItem) { fun Player.enqueue(mediaItem: MediaItem) {
if (playbackState == Player.STATE_IDLE) { if (playbackState == Player.STATE_IDLE || playbackState == Player.STATE_ENDED) {
forcePlay(mediaItem) forcePlay(mediaItem)
} else { } else {
addMediaItem(mediaItemCount, mediaItem) addMediaItem(mediaItemCount, mediaItem)
@ -68,7 +68,7 @@ fun Player.enqueue(mediaItem: MediaItem) {
} }
fun Player.enqueue(mediaItems: List<MediaItem>) { fun Player.enqueue(mediaItems: List<MediaItem>) {
if (playbackState == Player.STATE_IDLE) { if (playbackState == Player.STATE_IDLE || playbackState == Player.STATE_ENDED) {
forcePlayFromBeginning(mediaItems) forcePlayFromBeginning(mediaItems)
} else { } else {
addMediaItems(mediaItemCount, mediaItems) addMediaItems(mediaItemCount, mediaItems)