Commit bf92cc3e authored by Alexandre Perraud's avatar Alexandre Perraud

Preferences : Modify headset behaviour preference

parent 3a3a1c52
......@@ -285,7 +285,9 @@
<string name="force_list_portrait_summary">Show videos in list instead of grid in portrait mode</string>
<string name="audio_title_alignment">Audio title alignment</string>
<string name="enable_headset_detection">Detect headset</string>
<string name="enable_headset_detection_summary">Pause on headset removal; resume on headset insertion</string>
<string name="enable_headset_detection_summary">Detect headset insertion and removal</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>
<string name="enable_steal_remote_control_summary">Avoid conflicts by stealing the remote control from other apps. This prevents dialing on double click on HTC phones.</string>
<string name="audio_title_alignment_default">Default</string>
......
......@@ -73,6 +73,11 @@
android:key="enable_headset_detection"
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: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"
......
......@@ -511,7 +511,7 @@ public class PlaybackService extends Service implements IVLCVout.Callback {
pause();
} else if (action.equalsIgnoreCase(Intent.ACTION_HEADSET_PLUG) && state != 0) {
Log.i(TAG, "Headset Inserted.");
if (wasPlaying && hasCurrentMedia())
if (wasPlaying && hasCurrentMedia() && mSettings.getBoolean("enable_play_on_headset_insertion", false))
play();
}
}
......
......@@ -57,6 +57,7 @@ public class PreferencesUi extends BasePreferenceFragment implements SharedPrefe
findPreference("tv_ui").setVisible(AndroidUtil.isJellyBeanMR1OrLater());
findPreference("languages_download_list").setVisible(AndroidUtil.isHoneycombOrLater());
findPreference("enable_play_on_headset_insertion").setVisible(((TwoStatePreference) findPreference("enable_headset_detection")).isChecked());
}
@Override
......@@ -81,6 +82,7 @@ public class PreferencesUi extends BasePreferenceFragment implements SharedPrefe
return true;
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());
......
......@@ -53,6 +53,7 @@ public class PreferencesUi extends BasePreferenceFragment {
findPreference("enable_clone_mode").setVisible(false);
findPreference("force_list_portrait").setVisible(false);
findPreference("enable_headset_detection").setVisible(false);
findPreference("enable_play_on_headset_insertion").setVisible(false);
findPreference("enable_steal_remote_control").setVisible(false);
findPreference("enable_volume_gesture").setVisible(AndroidDevices.hasTsp());
findPreference("enable_brightness_gesture").setVisible(AndroidDevices.hasTsp());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment