playback: more coherent notif action setup
This commit is contained in:
parent
e1e1e63dbb
commit
d21a7eee93
3 changed files with 5 additions and 38 deletions
|
@ -76,6 +76,10 @@ constructor(
|
|||
.setNotificationId(IntegerTable.PLAYBACK_NOTIFICATION_CODE)
|
||||
.setChannelId(BuildConfig.APPLICATION_ID + ".channel.PLAYBACK")
|
||||
.setChannelName(R.string.lbl_playback)
|
||||
.setPlayDrawableResourceId(R.drawable.ic_play_24)
|
||||
.setPauseDrawableResourceId(R.drawable.ic_pause_24)
|
||||
.setSkipNextDrawableResourceId(R.drawable.ic_skip_next_24)
|
||||
.setSkipPrevDrawableResourceId(R.drawable.ic_skip_prev_24)
|
||||
.build()
|
||||
.also { it.setSmallIcon(R.drawable.ic_auxio_24) }
|
||||
private var foregroundListener: ForegroundListener? = null
|
||||
|
|
|
@ -27,7 +27,6 @@ import android.os.Bundle
|
|||
import androidx.core.content.ContextCompat
|
||||
import androidx.media3.common.Player
|
||||
import androidx.media3.session.CommandButton
|
||||
import androidx.media3.session.DefaultMediaNotificationProvider
|
||||
import androidx.media3.session.SessionCommand
|
||||
import androidx.media3.session.SessionCommands
|
||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||
|
@ -106,12 +105,6 @@ constructor(
|
|||
.setSessionCommand(
|
||||
SessionCommand(PlaybackActions.ACTION_INC_REPEAT_MODE, Bundle()))
|
||||
.setEnabled(true)
|
||||
.setExtras(
|
||||
Bundle().apply {
|
||||
putInt(
|
||||
DefaultMediaNotificationProvider.COMMAND_KEY_COMPACT_VIEW_INDEX,
|
||||
0)
|
||||
})
|
||||
.build())
|
||||
}
|
||||
ActionMode.SHUFFLE -> {
|
||||
|
@ -135,36 +128,6 @@ constructor(
|
|||
.setDisplayName(context.getString(R.string.desc_skip_prev))
|
||||
.setPlayerCommand(Player.COMMAND_SEEK_TO_PREVIOUS)
|
||||
.setEnabled(true)
|
||||
.setExtras(
|
||||
Bundle().apply {
|
||||
putInt(DefaultMediaNotificationProvider.COMMAND_KEY_COMPACT_VIEW_INDEX, 1)
|
||||
})
|
||||
.build())
|
||||
|
||||
actions.add(
|
||||
CommandButton.Builder()
|
||||
.setIconResId(
|
||||
if (playbackManager.progression.isPlaying) R.drawable.ic_pause_24
|
||||
else R.drawable.ic_play_24)
|
||||
.setDisplayName(context.getString(R.string.desc_play_pause))
|
||||
.setPlayerCommand(Player.COMMAND_PLAY_PAUSE)
|
||||
.setEnabled(true)
|
||||
.setExtras(
|
||||
Bundle().apply {
|
||||
putInt(DefaultMediaNotificationProvider.COMMAND_KEY_COMPACT_VIEW_INDEX, 2)
|
||||
})
|
||||
.build())
|
||||
|
||||
actions.add(
|
||||
CommandButton.Builder()
|
||||
.setIconResId(R.drawable.ic_skip_next_24)
|
||||
.setDisplayName(context.getString(R.string.desc_skip_next))
|
||||
.setPlayerCommand(Player.COMMAND_SEEK_TO_NEXT)
|
||||
.setEnabled(true)
|
||||
.setExtras(
|
||||
Bundle().apply {
|
||||
putInt(DefaultMediaNotificationProvider.COMMAND_KEY_COMPACT_VIEW_INDEX, 3)
|
||||
})
|
||||
.build())
|
||||
|
||||
actions.add(
|
||||
|
|
2
media
2
media
|
@ -1 +1 @@
|
|||
Subproject commit 1d58171e16107d73ec3c842319663a8a06bfd23a
|
||||
Subproject commit 9d84bc2351a21b768a9649bb40a45412259e2cda
|
Loading…
Reference in a new issue