[Android] Add an option to disable remote ctrl shortcuts
Geoffrey Métais
git at videolan.org
Wed Feb 14 17:36:40 CET 2018
vlc-android | branch: 3.0.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Feb 14 17:31:02 2018 +0100| [2360517f2e7244bf27e3d5c81562b75ca1d78d77] | committer: Geoffrey Métais
Add an option to disable remote ctrl shortcuts
(cherry picked from commit 5a714e40bfb41546df1cdcb70f6960d64d323506)
> https://code.videolan.org/videolan/vlc-android/commit/2360517f2e7244bf27e3d5c81562b75ca1d78d77
---
vlc-android/res/values/strings.xml | 2 ++
vlc-android/res/xml/preferences_audio.xml | 5 +++++
vlc-android/src/org/videolan/vlc/PlaybackService.java | 7 +++----
.../src/org/videolan/vlc/gui/tv/preferences/PreferencesAudio.java | 1 +
4 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/vlc-android/res/values/strings.xml b/vlc-android/res/values/strings.xml
index 06dca9855..3c2fcd918 100644
--- a/vlc-android/res/values/strings.xml
+++ b/vlc-android/res/values/strings.xml
@@ -359,6 +359,8 @@
<string name="headset_prefs_category">Headset</string>
<string name="enable_headset_detection">Detect headset</string>
<string name="enable_headset_detection_summary">Detect headset insertion and removal</string>
+ <string name="enable_headset_actions_title">Remote Control shortcuts</string>
+ <string name="enable_headset_actions_summary">Double press on \'Play\' to skip to next and long press on it to skip to previous track</string>
<string name="enable_play_on_headset_insertion">Resume on headset insertion</string>
<string name="enable_play_on_headset_insertion_summary">Pause otherwise</string>
<string name="enable_steal_remote_control">Exclusive headset remote control</string>
diff --git a/vlc-android/res/xml/preferences_audio.xml b/vlc-android/res/xml/preferences_audio.xml
index 0ec2ec699..336638ea6 100644
--- a/vlc-android/res/xml/preferences_audio.xml
+++ b/vlc-android/res/xml/preferences_audio.xml
@@ -31,6 +31,11 @@
<PreferenceCategory
android:title="@string/headset_prefs_category"
android:key="headset_prefs_category">
+ <CheckBoxPreference
+ android:defaultValue="true"
+ android:key="enable_headset_actions"
+ android:summary="@string/enable_headset_actions_summary"
+ android:title="@string/enable_headset_actions_title" />
<CheckBoxPreference
android:defaultValue="true"
android:key="enable_headset_detection"
diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.java b/vlc-android/src/org/videolan/vlc/PlaybackService.java
index bc04fd5c6..bde6cc665 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -779,6 +779,7 @@ public class PlaybackService extends MediaBrowserServiceCompat{
@Override
public boolean onMediaButtonEvent(Intent mediaButtonEvent) {
+ if (!mSettings.getBoolean("enable_headset_actions", true) || VLCApplication.showTvUi()) return false;
final KeyEvent event = mediaButtonEvent.getParcelableExtra(Intent.EXTRA_KEY_EVENT);
if (event != null && !isVideoPlaying()) {
final int keyCode = event.getKeyCode();
@@ -828,10 +829,8 @@ public class PlaybackService extends MediaBrowserServiceCompat{
@Override
public void onPlay() {
- if (hasMedia())
- play();
- else
- loadLastAudioPlaylist();
+ if (hasMedia()) play();
+ else loadLastAudioPlaylist();
}
@Override
diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/preferences/PreferencesAudio.java b/vlc-android/src/org/videolan/vlc/gui/tv/preferences/PreferencesAudio.java
index f7377e87c..de8cf5806 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/preferences/PreferencesAudio.java
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/preferences/PreferencesAudio.java
@@ -53,6 +53,7 @@ public class PreferencesAudio extends BasePreferenceFragment implements SharedPr
findPreference("enable_steal_remote_control").setVisible(false);
findPreference("headset_prefs_category").setVisible(false);
findPreference("lockscreen_cover").setVisible(false);
+ findPreference("enable_headset_actions").setVisible(false);
findPreference("audio_ducking").setVisible(!AndroidUtil.isOOrLater);
final HWDecoderUtil.AudioOutput aout = HWDecoderUtil.getAudioOutputFromDevice();
More information about the Android
mailing list