Merge "Introduce new "vibrate when ringing"" into jb-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
fc363380c2
@@ -1591,6 +1591,9 @@
|
||||
<string name="volume_notification_description">Notifications</string>
|
||||
<!-- Volume description for alarm volume -->
|
||||
<string name="volume_alarm_description">Alarms</string>
|
||||
<!-- Sound settings screen, setting option name checkbox. About vibration setting
|
||||
during incoming calls. [CHAR LIMIT=30] -->
|
||||
<string name="vibrate_when_ringing_title">Vibrate when ringing</string>
|
||||
|
||||
<!-- Dock settings title, top level -->
|
||||
<string name="dock_settings">Dock</string>
|
||||
|
@@ -58,6 +58,11 @@
|
||||
android:persistent="false"
|
||||
android:ringtoneType="notification" />
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="vibrate_when_ringing"
|
||||
android:title="@string/vibrate_when_ringing_title"
|
||||
android:persistent="false" />
|
||||
|
||||
<PreferenceCategory
|
||||
android:title="@string/sound_category_feedback_title"/>
|
||||
|
||||
|
@@ -56,7 +56,7 @@ public class SoundSettings extends SettingsPreferenceFragment implements
|
||||
private static final int FALLBACK_EMERGENCY_TONE_VALUE = 0;
|
||||
|
||||
private static final String KEY_SILENT_MODE = "silent_mode";
|
||||
private static final String KEY_VIBRATE = "vibrate_on_ring";
|
||||
private static final String KEY_VIBRATE = "vibrate_when_ringing";
|
||||
private static final String KEY_RING_VOLUME = "ring_volume";
|
||||
private static final String KEY_MUSICFX = "musicfx";
|
||||
private static final String KEY_DTMF_TONE = "dtmf_tone";
|
||||
@@ -81,6 +81,7 @@ public class SoundSettings extends SettingsPreferenceFragment implements
|
||||
private static final int MSG_UPDATE_RINGTONE_SUMMARY = 1;
|
||||
private static final int MSG_UPDATE_NOTIFICATION_SUMMARY = 2;
|
||||
|
||||
private CheckBoxPreference mVibrateWhenRinging;
|
||||
private ListPreference mSilentMode;
|
||||
private CheckBoxPreference mDtmfTone;
|
||||
private CheckBoxPreference mSoundEffects;
|
||||
@@ -141,6 +142,11 @@ public class SoundSettings extends SettingsPreferenceFragment implements
|
||||
mSilentMode.setOnPreferenceChangeListener(this);
|
||||
}
|
||||
|
||||
mVibrateWhenRinging = (CheckBoxPreference) findPreference(KEY_VIBRATE);
|
||||
mVibrateWhenRinging.setPersistent(false);
|
||||
mVibrateWhenRinging.setChecked(Settings.System.getInt(resolver,
|
||||
Settings.System.VIBRATE_WHEN_RINGING, 0) != 0);
|
||||
|
||||
mDtmfTone = (CheckBoxPreference) findPreference(KEY_DTMF_TONE);
|
||||
mDtmfTone.setPersistent(false);
|
||||
mDtmfTone.setChecked(Settings.System.getInt(resolver,
|
||||
@@ -161,7 +167,9 @@ public class SoundSettings extends SettingsPreferenceFragment implements
|
||||
mRingtonePreference = findPreference(KEY_RINGTONE);
|
||||
mNotificationPreference = findPreference(KEY_NOTIFICATION_SOUND);
|
||||
|
||||
if (!((Vibrator) getSystemService(Context.VIBRATOR_SERVICE)).hasVibrator()) {
|
||||
Vibrator vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
|
||||
if (vibrator == null || !vibrator.hasVibrator()) {
|
||||
getPreferenceScreen().removePreference(mVibrateWhenRinging);
|
||||
getPreferenceScreen().removePreference(mHapticFeedback);
|
||||
}
|
||||
|
||||
@@ -294,7 +302,10 @@ public class SoundSettings extends SettingsPreferenceFragment implements
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
|
||||
if (preference == mDtmfTone) {
|
||||
if (preference == mVibrateWhenRinging) {
|
||||
Settings.System.putInt(getContentResolver(), Settings.System.VIBRATE_WHEN_RINGING,
|
||||
mVibrateWhenRinging.isChecked() ? 1 : 0);
|
||||
} else if (preference == mDtmfTone) {
|
||||
Settings.System.putInt(getContentResolver(), Settings.System.DTMF_TONE_WHEN_DIALING,
|
||||
mDtmfTone.isChecked() ? 1 : 0);
|
||||
|
||||
|
Reference in New Issue
Block a user