[Android] Fix "resume on headset insertion" default value

Geoffrey Métais git at videolan.org
Tue Apr 11 16:47:42 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Apr 11 16:44:58 2017 +0200| [71eba63a8d1ec4797d441187a20795d39bd8daaf] | committer: Geoffrey Métais

Fix "resume on headset insertion" default value

And set settings dependency

> https://code.videolan.org/videolan/vlc-android/commit/71eba63a8d1ec4797d441187a20795d39bd8daaf
---

 vlc-android/res/xml/preferences_audio.xml                             | 4 +++-
 .../src/org/videolan/vlc/gui/preferences/PreferencesAudio.java        | 2 --
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/vlc-android/res/xml/preferences_audio.xml b/vlc-android/res/xml/preferences_audio.xml
index f2b0c52..3ed1aba 100644
--- a/vlc-android/res/xml/preferences_audio.xml
+++ b/vlc-android/res/xml/preferences_audio.xml
@@ -26,13 +26,15 @@
             android:summary="@string/enable_headset_detection_summary"
             android:title="@string/enable_headset_detection" />
         <CheckBoxPreference
-            android:defaultValue="true"
             android:key="enable_play_on_headset_insertion"
+            android:defaultValue="false"
+            android:dependency="enable_headset_detection"
             android:summary="@string/enable_play_on_headset_insertion_summary"
             android:title="@string/enable_play_on_headset_insertion" />
         <CheckBoxPreference
             android:defaultValue="false"
             android:key="enable_steal_remote_control"
+            android:dependency="enable_headset_detection"
             android:summary="@string/enable_steal_remote_control_summary"
             android:title="@string/enable_steal_remote_control" />
     </PreferenceCategory>
diff --git a/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesAudio.java b/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesAudio.java
index 423e055..b4450ec 100644
--- a/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesAudio.java
+++ b/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesAudio.java
@@ -53,7 +53,6 @@ public class PreferencesAudio extends BasePreferenceFragment implements SharedPr
     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
-        findPreference("enable_play_on_headset_insertion").setVisible(((TwoStatePreference) findPreference("enable_headset_detection")).isChecked());
         final HWDecoderUtil.AudioOutput aout = HWDecoderUtil.getAudioOutputFromDevice();
         if (aout != HWDecoderUtil.AudioOutput.ALL) {
             /* no AudioOutput choice */
@@ -68,7 +67,6 @@ public class PreferencesAudio extends BasePreferenceFragment implements SharedPr
         switch (preference.getKey()){
             case "enable_headset_detection":
                 ((PreferencesActivity)getActivity()).detectHeadset(((TwoStatePreference) preference).isChecked());
-                findPreference("enable_play_on_headset_insertion").setVisible(((TwoStatePreference) preference).isChecked());
                 return true;
             case "enable_steal_remote_control":
                 PlaybackService.Client.restartService(getActivity());



More information about the Android mailing list