diff options
-rw-r--r-- | res/values/strings.xml | 4 | ||||
-rw-r--r-- | res/xml/sound_settings.xml | 6 | ||||
-rw-r--r-- | src/com/android/settings/SoundSettings.java | 12 |
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; |