[Android] Reserve space for previous and next buttons
Robert Stone
git at videolan.org
Fri Oct 16 07:38:30 CEST 2020
vlc-android | branch: master | Robert Stone <rhstone at gmail.com> | Wed Oct 14 21:13:02 2020 -0700| [6276f389198325e1e8c56e236fd9fb4a699cb765] | committer: Nicolas Pomepuy
Reserve space for previous and next buttons
Fixes #1509
> https://code.videolan.org/videolan/vlc-android/commit/6276f389198325e1e8c56e236fd9fb4a699cb765
---
.../resources/src/main/java/org/videolan/resources/Constants.kt | 2 ++
application/vlc-android/src/org/videolan/vlc/PlaybackService.kt | 4 ++++
2 files changed, 6 insertions(+)
diff --git a/application/resources/src/main/java/org/videolan/resources/Constants.kt b/application/resources/src/main/java/org/videolan/resources/Constants.kt
index 29dc08a79f..2ea7807170 100644
--- a/application/resources/src/main/java/org/videolan/resources/Constants.kt
+++ b/application/resources/src/main/java/org/videolan/resources/Constants.kt
@@ -60,6 +60,8 @@ const val ACTION_CAR_MODE_EXIT = "android.app.action.EXIT_CAR_MODE"
const val PLAYLIST_TYPE_AUDIO = 0
const val PLAYLIST_TYPE_VIDEO = 1
const val MEDIALIBRARY_PAGE_SIZE = 500
+const val PLAYBACK_SLOT_RESERVATION_SKIP_TO_NEXT = "android.media.playback.ALWAYS_RESERVE_SPACE_FOR.ACTION_SKIP_TO_NEXT"
+const val PLAYBACK_SLOT_RESERVATION_SKIP_TO_PREV = "android.media.playback.ALWAYS_RESERVE_SPACE_FOR.ACTION_SKIP_TO_PREVIOUS"
// MediaParsingService
const val ACTION_INIT = "medialibrary_init"
diff --git a/application/vlc-android/src/org/videolan/vlc/PlaybackService.kt b/application/vlc-android/src/org/videolan/vlc/PlaybackService.kt
index 327830c0bd..9ad19de37d 100644
--- a/application/vlc-android/src/org/videolan/vlc/PlaybackService.kt
+++ b/application/vlc-android/src/org/videolan/vlc/PlaybackService.kt
@@ -906,6 +906,10 @@ class PlaybackService : MediaBrowserServiceCompat(), LifecycleOwner {
if (playlistManager.canShuffle())
pscb.addCustomAction("shuffle", getString(R.string.shuffle_title), if (isShuffling) R.drawable.ic_auto_shuffle_pressed else R.drawable.ic_auto_shuffle_normal)
pscb.addCustomAction("repeat", getString(R.string.repeat_title), repeatResId)
+ mediaSession.setExtras(Bundle().apply {
+ putBoolean(PLAYBACK_SLOT_RESERVATION_SKIP_TO_NEXT, true)
+ putBoolean(PLAYBACK_SLOT_RESERVATION_SKIP_TO_PREV, true)
+ });
val mediaIsActive = state != PlaybackStateCompat.STATE_STOPPED
val update = mediaSession.isActive != mediaIsActive
More information about the Android
mailing list