summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanesh Mondegarian <daneshm90@gmail.com>2013-01-07 13:07:47 -0500
committerGerrit Code Review <gerrit@review.cyanogenmod.com>2013-01-08 12:38:35 -0800
commit9dabc59653e1ff995471046ccd579268da061cbf (patch)
tree2e91e0eb2c948cc412e6cc8b6c475509f20c5cc7
parentafbd026c9ef742609b13394f912bfdc65dd8ae8c (diff)
downloadpackages_apps_settings-9dabc59653e1ff995471046ccd579268da061cbf.zip
packages_apps_settings-9dabc59653e1ff995471046ccd579268da061cbf.tar.gz
packages_apps_settings-9dabc59653e1ff995471046ccd579268da061cbf.tar.bz2
Launch music player on headset connect
Launches the default music player when a headset is connected Patchset 2 - Add headset category Patchset 3 - Remove summary Change-Id: I1ee973bec35d95285a646b86213ced3dd15852ed
-rw-r--r--res/values/strings.xml5
-rw-r--r--res/xml/sound_settings.xml7
-rw-r--r--src/com/android/settings/SoundSettings.java10
3 files changed, 21 insertions, 1 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 1aa66bf..c4df32c 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -3663,6 +3663,10 @@
[CHAR LIMIT=40] -->
<string name="sound_category_system_title">System</string>
+ <!-- Category title for headset specific Settings.
+ [CHAR LIMIT=40] -->
+ <string name="headset_category_title">Headset</string>
+
<!-- Wifi Setup For Setup Wizard with XL screen -->
<!-- Title shown in Wifi Setup Wizard with XL screen -->
<string name="wifi_setup_title">Wi-Fi setup</string>
@@ -4855,6 +4859,7 @@
<string name="volume_overlay_title">Volume panel style</string>
<string name="volbtn_music_controls_title">Volume rocker music controls</string>
<string name="volbtn_music_controls_summary">When screen off, long-pressing the volume rockers will seek music tracks</string>
+ <string name="headset_connect_player_title">Launch music app on connect</string>
<string name="volume_ring_only_description">Ringtone</string>
<string name="ring_mode_title">Ring mode</string>
<string name="ring_mode_normal">Normal</string>
diff --git a/res/xml/sound_settings.xml b/res/xml/sound_settings.xml
index 31783e5..4ab2f71 100644
--- a/res/xml/sound_settings.xml
+++ b/res/xml/sound_settings.xml
@@ -137,4 +137,11 @@
android:title="@string/dock_sounds_enable_title"
android:defaultValue="false" />
+ <PreferenceCategory
+ android:title="@string/headset_category_title"/>
+
+ <CheckBoxPreference
+ android:key="headset_connect_player"
+ android:title="@string/headset_connect_player_title"
+ android:persistent="false" />
</PreferenceScreen>
diff --git a/src/com/android/settings/SoundSettings.java b/src/com/android/settings/SoundSettings.java
index 2f7192f..8de9707 100644
--- a/src/com/android/settings/SoundSettings.java
+++ b/src/com/android/settings/SoundSettings.java
@@ -84,6 +84,7 @@ public class SoundSettings extends SettingsPreferenceFragment implements
private static final String KEY_DOCK_AUDIO_MEDIA_ENABLED = "dock_audio_media_enabled";
private static final String KEY_QUIET_HOURS = "quiet_hours";
private static final String KEY_VOLBTN_MUSIC_CTRL = "volbtn_music_controls";
+ private static final String KEY_HEADSET_CONNECT_PLAYER = "headset_connect_player";
private static final String RING_MODE_NORMAL = "normal";
private static final String RING_MODE_VIBRATE = "vibrate";
@@ -106,6 +107,7 @@ public class SoundSettings extends SettingsPreferenceFragment implements
private Preference mMusicFx;
private CheckBoxPreference mLockSounds;
private CheckBoxPreference mVolBtnMusicCtrl;
+ private CheckBoxPreference mHeadsetConnectPlayer;
private Preference mRingtonePreference;
private Preference mNotificationPreference;
private PreferenceScreen mQuietHours;
@@ -212,6 +214,10 @@ public class SoundSettings extends SettingsPreferenceFragment implements
mVolBtnMusicCtrl.setChecked(Settings.System.getInt(resolver,
Settings.System.VOLBTN_MUSIC_CONTROLS, 1) != 0);
+ mHeadsetConnectPlayer = (CheckBoxPreference) findPreference(KEY_HEADSET_CONNECT_PLAYER);
+ mHeadsetConnectPlayer.setChecked(Settings.System.getInt(resolver,
+ Settings.System.HEADSET_CONNECT_PLAYER, 0) != 0);
+
mRingtonePreference = findPreference(KEY_RINGTONE);
mNotificationPreference = findPreference(KEY_NOTIFICATION_SOUND);
@@ -430,7 +436,9 @@ public class SoundSettings extends SettingsPreferenceFragment implements
} else if (preference == mVolBtnMusicCtrl) {
Settings.System.putInt(getContentResolver(), Settings.System.VOLBTN_MUSIC_CONTROLS,
mVolBtnMusicCtrl.isChecked() ? 1 : 0);
-
+ } else if (preference == mHeadsetConnectPlayer) {
+ Settings.System.putInt(getContentResolver(), Settings.System.HEADSET_CONNECT_PLAYER,
+ mHeadsetConnectPlayer.isChecked() ? 1 : 0);
} else {
// If we didn't handle it, let preferences handle it.
return super.onPreferenceTreeClick(preferenceScreen, preference);