[Android] Add resume playback after a call preference

Alexandre Perraud git at videolan.org
Fri Jan 20 18:46:41 CET 2017


vlc-android | branch: master | Alexandre Perraud <4leyx4ndre at gmail.com> | Fri Jan 20 18:39:42 2017 +0100| [9287d44607a5ab2bb6b11c0d4fb8b92e70d10ec0] | committer: Alexandre Perraud

Add resume playback after a call preference

> https://code.videolan.org/videolan/vlc-android/commit/9287d44607a5ab2bb6b11c0d4fb8b92e70d10ec0
---

 vlc-android/res/values/strings.xml                    | 2 ++
 vlc-android/res/xml/preferences_ui.xml                | 6 ++++++
 vlc-android/src/org/videolan/vlc/PlaybackService.java | 2 +-
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/vlc-android/res/values/strings.xml b/vlc-android/res/values/strings.xml
index 2755d6c..e4b9ca1 100644
--- a/vlc-android/res/values/strings.xml
+++ b/vlc-android/res/values/strings.xml
@@ -364,6 +364,8 @@
     <string name="set_locale_popup">Quit and restart VLC for changes to take effect.</string>
     <string name="network_caching">Network caching value</string>
     <string name="network_caching_summary">The amount of time to buffer network media (in ms). Does not work with hardware decoding. Leave blank to reset.</string>
+    <string name="resume_playback_title">Resume playback after a call</string>
+    <string name="resume_playback_summary">Stay in pause otherwise</string>
     <string name="network_caching_popup">This value have to be between 0 and 6000 ms</string>
     <string name="quit">Quit and restart application</string>
 
diff --git a/vlc-android/res/xml/preferences_ui.xml b/vlc-android/res/xml/preferences_ui.xml
index c4847e0..266688c 100644
--- a/vlc-android/res/xml/preferences_ui.xml
+++ b/vlc-android/res/xml/preferences_ui.xml
@@ -35,6 +35,12 @@
         android:summary="@string/set_locale_detail"
         android:title="@string/set_locale" />
 
+    <CheckBoxPreference
+        android:defaultValue="true"
+        android:key="resume_playback"
+        android:summary="@string/resume_playback_summary"
+        android:title="@string/resume_playback_title" />
+
     <PreferenceCategory
         android:title="@string/interface_secondary_display_category_title"
         android:key="secondary_display_category">
diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.java b/vlc-android/src/org/videolan/vlc/PlaybackService.java
index 2e6cbc6..f24dd09 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -375,7 +375,7 @@ public class PlaybackService extends MediaBrowserServiceCompat implements IVLCVo
                         Log.i(TAG, "AUDIOFOCUS_GAIN: ");
                         // Resume playback
                         if (mLossTransient) {
-                            if (wasPlaying)
+                            if (wasPlaying && mSettings.getBoolean("resume_playback", true))
                                 mMediaPlayer.play();
                             mLossTransient = false;
                         }



More information about the Android mailing list