summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoman Birg <romanbirg@gmail.com>2013-01-15 23:52:33 +0100
committerDvTonder <david.vantonder@gmail.com>2013-01-31 21:15:42 -0500
commitc02fc9e13630e9a47719692178ed5a36ebc9a23e (patch)
treefeffe3c4e3e3ade2763421864aef0102289cf132
parent1f1d510ea3dd6a7430e5c45b3301fd3e3082397e (diff)
downloadpackages_apps_settings-c02fc9e13630e9a47719692178ed5a36ebc9a23e.zip
packages_apps_settings-c02fc9e13630e9a47719692178ed5a36ebc9a23e.tar.gz
packages_apps_settings-c02fc9e13630e9a47719692178ed5a36ebc9a23e.tar.bz2
Notification sound-to-vibration conversion toggle
Allows to change the new feature of AOSP 4.2, where all notification are changed to vibrations on vibrate mode. Instead, allow the old behaviour to silence sound notifications and to only play vibrations if desired. Alle credits go to romanbb from AOKP, I just ported it, changed the position in the menu and the label. Original AOKP-Commit: https://github.com/AOKP/packages_apps_Settings/commit/e92446576c2dfbe51089287c43c3f799b5cc0057 Patch set 1-6 : Initial commits Patch set 7 : Better wording of the summary string Patch set 8 : Lower case app Change-Id: I267fc4b62ff045f305cf29c1b4f365e91f7cf1db
-rw-r--r--res/values/strings.xml4
-rw-r--r--res/xml/sound_settings.xml6
-rw-r--r--src/com/android/settings/SoundSettings.java12
3 files changed, 22 insertions, 0 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 56c2bc0..38ada94 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -4472,6 +4472,10 @@
<string name="start_time_title">Start</string>
<string name="end_time_title">End</string>
+ <!-- convert sound to vibration toggle -->
+ <string name="notification_convert_sound_to_vibration_title">Vibrate on notification</string>
+ <string name="notification_convert_sound_to_vibration_summary">In vibrate mode, all notifications will vibrate regardless of individual app settings</string>
+
<!-- Hostname setting -->
<string name="device_hostname">Device hostname</string>
diff --git a/res/xml/sound_settings.xml b/res/xml/sound_settings.xml
index 4ab2f71..687a843 100644
--- a/res/xml/sound_settings.xml
+++ b/res/xml/sound_settings.xml
@@ -116,6 +116,12 @@
android:entries="@array/emergency_tone_entries"
android:entryValues="@array/emergency_tone_values" />
+ <CheckBoxPreference
+ android:key="notification_convert_sound_to_vibration"
+ android:title="@string/notification_convert_sound_to_vibration_title"
+ android:summary="@string/notification_convert_sound_to_vibration_summary"
+ android:defaultValue="true" />
+
<!-- Dock -->
<PreferenceCategory
android:key="dock_category"
diff --git a/src/com/android/settings/SoundSettings.java b/src/com/android/settings/SoundSettings.java
index 8de9707..9757b63 100644
--- a/src/com/android/settings/SoundSettings.java
+++ b/src/com/android/settings/SoundSettings.java
@@ -85,6 +85,7 @@ public class SoundSettings extends SettingsPreferenceFragment implements
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 KEY_CONVERT_SOUND_TO_VIBRATE = "notification_convert_sound_to_vibration";
private static final String RING_MODE_NORMAL = "normal";
private static final String RING_MODE_VIBRATE = "vibrate";
@@ -108,6 +109,7 @@ public class SoundSettings extends SettingsPreferenceFragment implements
private CheckBoxPreference mLockSounds;
private CheckBoxPreference mVolBtnMusicCtrl;
private CheckBoxPreference mHeadsetConnectPlayer;
+ private CheckBoxPreference mConvertSoundToVibration;
private Preference mRingtonePreference;
private Preference mNotificationPreference;
private PreferenceScreen mQuietHours;
@@ -218,6 +220,12 @@ public class SoundSettings extends SettingsPreferenceFragment implements
mHeadsetConnectPlayer.setChecked(Settings.System.getInt(resolver,
Settings.System.HEADSET_CONNECT_PLAYER, 0) != 0);
+ mConvertSoundToVibration = (CheckBoxPreference) findPreference(KEY_CONVERT_SOUND_TO_VIBRATE);
+
+ mConvertSoundToVibration.setPersistent(false);
+ mConvertSoundToVibration.setChecked(Settings.System.getInt(resolver,
+ Settings.System.NOTIFICATION_CONVERT_SOUND_TO_VIBRATION, 1) != 0);
+
mRingtonePreference = findPreference(KEY_RINGTONE);
mNotificationPreference = findPreference(KEY_NOTIFICATION_SOUND);
@@ -397,6 +405,10 @@ public class SoundSettings extends SettingsPreferenceFragment implements
Settings.System.putInt(getContentResolver(), Settings.System.LOCKSCREEN_SOUNDS_ENABLED,
mLockSounds.isChecked() ? 1 : 0);
+ } else if (preference == mConvertSoundToVibration) {
+ Settings.System.putInt(getContentResolver(), Settings.System.NOTIFICATION_CONVERT_SOUND_TO_VIBRATION,
+ mConvertSoundToVibration.isChecked() ? 1 : 0);
+
} else if (preference == mMusicFx) {
// let the framework fire off the intent
return false;