[Android] Add preference to show seek buttons in the notification bar
Robert Stone
git at videolan.org
Thu Feb 3 09:01:34 UTC 2022
vlc-android | branch: master | Robert Stone <rhstone at gmail.com> | Fri Jan 14 22:49:06 2022 -0800| [ec4df3b75018ef4a31e50f6376226a1405aed53c] | committer: Nicolas Pomepuy
Add preference to show seek buttons in the notification bar
> https://code.videolan.org/videolan/vlc-android/commit/ec4df3b75018ef4a31e50f6376226a1405aed53c
---
application/resources/src/main/res/values/strings.xml | 2 ++
application/tools/src/main/java/org/videolan/tools/Settings.kt | 2 ++
application/vlc-android/res/xml/preferences_ui.xml | 6 ++++++
application/vlc-android/src/org/videolan/vlc/PlaybackService.kt | 5 +++--
4 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/application/resources/src/main/res/values/strings.xml b/application/resources/src/main/res/values/strings.xml
index d4893eb97..48d62cd0b 100644
--- a/application/resources/src/main/res/values/strings.xml
+++ b/application/resources/src/main/res/values/strings.xml
@@ -364,6 +364,8 @@
<string name="audio_prefs_category">Audio</string>
<string name="lockscreen_cover_title">Media cover on Lockscreen</string>
<string name="lockscreen_cover_summary">When available, set the current media cover art as lockscreen wallpaper</string>
+ <string name="show_seek_in_compact_notif_title">Seek buttons in notification panel</string>
+ <string name="show_seek_in_compact_notif_summary">Show rewind and fast forward buttons in compact media controls</string>
<string name="list_title_ellipsize">Single line list title ellipsize</string>
<string name="list_title_ellipsize_default">Default</string>
<string name="list_title_ellipsize_left">Left</string>
diff --git a/application/tools/src/main/java/org/videolan/tools/Settings.kt b/application/tools/src/main/java/org/videolan/tools/Settings.kt
index b809a4dc3..627b3f552 100644
--- a/application/tools/src/main/java/org/videolan/tools/Settings.kt
+++ b/application/tools/src/main/java/org/videolan/tools/Settings.kt
@@ -117,6 +117,8 @@ const val VIDEO_RESUME_TIME = "VideoResumeTime"
const val VIDEO_RESUME_URI = "VideoResumeUri"
const val AUDIO_BOOST = "audio_boost"
const val ENABLE_SEEK_BUTTONS = "enable_seek_buttons"
+const val SHOW_SEEK_IN_COMPACT_NOTIFICATION = "show_seek_in_compact_notification"
+const val LOCKSCREEN_COVER = "lockscreen_cover"
const val ENABLE_DOUBLE_TAP_SEEK = "enable_double_tap_seek"
const val ENABLE_SWIPE_SEEK = "enable_swipe_seek"
const val ENABLE_DOUBLE_TAP_PLAY = "enable_double_tap_play"
diff --git a/application/vlc-android/res/xml/preferences_ui.xml b/application/vlc-android/res/xml/preferences_ui.xml
index 588408b10..f2f61af97 100644
--- a/application/vlc-android/res/xml/preferences_ui.xml
+++ b/application/vlc-android/res/xml/preferences_ui.xml
@@ -88,5 +88,11 @@
android:key="lockscreen_cover"
android:summary="@string/lockscreen_cover_summary"
android:title="@string/lockscreen_cover_title"/>
+ <CheckBoxPreference
+ app:singleLineTitle="false"
+ android:defaultValue="false"
+ android:key="show_seek_in_compact_notification"
+ android:summary="@string/show_seek_in_compact_notif_summary"
+ android:title="@string/show_seek_in_compact_notif_title"/>
</PreferenceCategory>
</androidx.preference.PreferenceScreen>
diff --git a/application/vlc-android/src/org/videolan/vlc/PlaybackService.kt b/application/vlc-android/src/org/videolan/vlc/PlaybackService.kt
index 653288358..001a61ec2 100644
--- a/application/vlc-android/src/org/videolan/vlc/PlaybackService.kt
+++ b/application/vlc-android/src/org/videolan/vlc/PlaybackService.kt
@@ -837,7 +837,8 @@ class PlaybackService : MediaBrowserServiceCompat(), LifecycleOwner {
}
val mw = playlistManager.getCurrentMedia()
if (mw != null) {
- val coverOnLockscreen = settings.getBoolean("lockscreen_cover", true)
+ val coverOnLockscreen = settings.getBoolean(LOCKSCREEN_COVER, true)
+ val seekInCompactView = settings.getBoolean(SHOW_SEEK_IN_COMPACT_NOTIFICATION, false)
val playing = isPlaying
val sessionToken = mediaSession.sessionToken
val ctx = this
@@ -972,7 +973,7 @@ class PlaybackService : MediaBrowserServiceCompat(), LifecycleOwner {
val bob = withContext(Dispatchers.Default) {
val carMode = AndroidDevices.isCarMode(ctx)
val title = media.nowPlaying ?: media.title
- val coverOnLockscreen = settings.getBoolean("lockscreen_cover", true)
+ val coverOnLockscreen = settings.getBoolean(LOCKSCREEN_COVER, true)
val bob = MediaMetadataCompat.Builder().apply {
putString(MediaMetadataCompat.METADATA_KEY_TITLE, title)
putString(MediaMetadataCompat.METADATA_KEY_MEDIA_ID, MediaSessionBrowser.generateMediaId(media))
More information about the Android
mailing list