Setting in Sound & Display for trackball pulsing on notification. Bug #2238250
This commit is contained in:
21
res/values/bools.xml
Normal file
21
res/values/bools.xml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (C) 2009 The Android Open Source Project
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<resources>
|
||||||
|
<!-- Whether or not there is a notification led that is too intrusive to be pulsing
|
||||||
|
constantly -->
|
||||||
|
<bool name="has_intrusive_led">false</bool>
|
||||||
|
</resources>
|
@@ -877,6 +877,10 @@
|
|||||||
<string name="notification_sound_title">Notification ringtone</string>
|
<string name="notification_sound_title">Notification ringtone</string>
|
||||||
<!-- Sound settings screen, setting option summary text -->
|
<!-- Sound settings screen, setting option summary text -->
|
||||||
<string name="notification_sound_summary">Set your default notification ringtone</string>
|
<string name="notification_sound_summary">Set your default notification ringtone</string>
|
||||||
|
<!-- Sound settings screen, notification light repeat pulsing title -->
|
||||||
|
<string name="notification_pulse_title">Pulse notification light</string>
|
||||||
|
<!-- Sound settings screen, notification light repeat pulsing summary -->
|
||||||
|
<string name="notification_pulse_summary">Pulse trackball light repeatedly for new notifications</string>
|
||||||
<!-- Sound settings screen, the title of the volume bar to adjust the incoming call volume -->
|
<!-- Sound settings screen, the title of the volume bar to adjust the incoming call volume -->
|
||||||
<string name="incoming_call_volume_title">Incoming call volume</string>
|
<string name="incoming_call_volume_title">Incoming call volume</string>
|
||||||
<!-- Sound settings screen, the title of the volume bar to adjust the notification volume -->
|
<!-- Sound settings screen, the title of the volume bar to adjust the notification volume -->
|
||||||
|
@@ -17,7 +17,7 @@
|
|||||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
|
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
|
||||||
|
|
||||||
<PreferenceCategory
|
<PreferenceCategory android:key="sound_settings"
|
||||||
android:title="@string/sound_settings">
|
android:title="@string/sound_settings">
|
||||||
|
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
@@ -68,6 +68,12 @@
|
|||||||
android:persistent="false"
|
android:persistent="false"
|
||||||
android:ringtoneType="notification" />
|
android:ringtoneType="notification" />
|
||||||
|
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:key="notification_pulse"
|
||||||
|
android:title="@string/notification_pulse_title"
|
||||||
|
android:summary="@string/notification_pulse_summary"
|
||||||
|
android:persistent="false" />
|
||||||
|
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:key="dtmf_tone"
|
android:key="dtmf_tone"
|
||||||
android:title="@string/dtmf_tone_enable_title"
|
android:title="@string/dtmf_tone_enable_title"
|
||||||
|
@@ -17,8 +17,6 @@
|
|||||||
package com.android.settings;
|
package com.android.settings;
|
||||||
|
|
||||||
import static android.provider.Settings.System.SCREEN_OFF_TIMEOUT;
|
import static android.provider.Settings.System.SCREEN_OFF_TIMEOUT;
|
||||||
import static android.provider.Settings.System.COMPATIBILITY_MODE;
|
|
||||||
|
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
import android.content.ContentResolver;
|
import android.content.ContentResolver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -29,15 +27,17 @@ import android.os.Bundle;
|
|||||||
import android.os.IMountService;
|
import android.os.IMountService;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.os.ServiceManager;
|
import android.os.ServiceManager;
|
||||||
|
import android.preference.CheckBoxPreference;
|
||||||
import android.preference.ListPreference;
|
import android.preference.ListPreference;
|
||||||
import android.preference.Preference;
|
import android.preference.Preference;
|
||||||
import android.preference.PreferenceActivity;
|
import android.preference.PreferenceActivity;
|
||||||
|
import android.preference.PreferenceGroup;
|
||||||
import android.preference.PreferenceScreen;
|
import android.preference.PreferenceScreen;
|
||||||
import android.preference.CheckBoxPreference;
|
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
|
import android.provider.Settings.SettingNotFoundException;
|
||||||
|
import android.telephony.TelephonyManager;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.IWindowManager;
|
import android.view.IWindowManager;
|
||||||
import android.telephony.TelephonyManager;
|
|
||||||
|
|
||||||
public class SoundAndDisplaySettings extends PreferenceActivity implements
|
public class SoundAndDisplaySettings extends PreferenceActivity implements
|
||||||
Preference.OnPreferenceChangeListener {
|
Preference.OnPreferenceChangeListener {
|
||||||
@@ -55,8 +55,11 @@ public class SoundAndDisplaySettings extends PreferenceActivity implements
|
|||||||
private static final String KEY_HAPTIC_FEEDBACK = "haptic_feedback";
|
private static final String KEY_HAPTIC_FEEDBACK = "haptic_feedback";
|
||||||
private static final String KEY_ANIMATIONS = "animations";
|
private static final String KEY_ANIMATIONS = "animations";
|
||||||
private static final String KEY_ACCELEROMETER = "accelerometer";
|
private static final String KEY_ACCELEROMETER = "accelerometer";
|
||||||
private static final String KEY_PLAY_MEDIA_NOTIFICATION_SOUNDS = "play_media_notification_sounds";
|
private static final String KEY_PLAY_MEDIA_NOTIFICATION_SOUNDS =
|
||||||
private static final String KEY_EMERGENCY_TONE ="emergency_tone";
|
"play_media_notification_sounds";
|
||||||
|
private static final String KEY_EMERGENCY_TONE = "emergency_tone";
|
||||||
|
private static final String KEY_SOUND_SETTINGS = "sound_settings";
|
||||||
|
private static final String KEY_NOTIFICATION_PULSE = "notification_pulse";
|
||||||
|
|
||||||
private CheckBoxPreference mSilent;
|
private CheckBoxPreference mSilent;
|
||||||
|
|
||||||
@@ -77,6 +80,7 @@ public class SoundAndDisplaySettings extends PreferenceActivity implements
|
|||||||
private CheckBoxPreference mHapticFeedback;
|
private CheckBoxPreference mHapticFeedback;
|
||||||
private ListPreference mAnimations;
|
private ListPreference mAnimations;
|
||||||
private CheckBoxPreference mAccelerometer;
|
private CheckBoxPreference mAccelerometer;
|
||||||
|
private CheckBoxPreference mNotificationPulse;
|
||||||
private float[] mAnimationScales;
|
private float[] mAnimationScales;
|
||||||
|
|
||||||
private AudioManager mAudioManager;
|
private AudioManager mAudioManager;
|
||||||
@@ -142,6 +146,22 @@ public class SoundAndDisplaySettings extends PreferenceActivity implements
|
|||||||
resolver, Settings.System.EMERGENCY_TONE, FALLBACK_EMERGENCY_TONE_VALUE)));
|
resolver, Settings.System.EMERGENCY_TONE, FALLBACK_EMERGENCY_TONE_VALUE)));
|
||||||
emergencyTonePreference.setOnPreferenceChangeListener(this);
|
emergencyTonePreference.setOnPreferenceChangeListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PreferenceGroup soundSettings = (PreferenceGroup) findPreference(KEY_SOUND_SETTINGS);
|
||||||
|
mNotificationPulse = (CheckBoxPreference)
|
||||||
|
soundSettings.findPreference(KEY_NOTIFICATION_PULSE);
|
||||||
|
if (mNotificationPulse != null && soundSettings != null &&
|
||||||
|
getResources().getBoolean(R.bool.has_intrusive_led) == false) {
|
||||||
|
soundSettings.removePreference(mNotificationPulse);
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
mNotificationPulse.setChecked(Settings.System.getInt(resolver,
|
||||||
|
Settings.System.NOTIFICATION_LIGHT_PULSE) == 1);
|
||||||
|
mNotificationPulse.setOnPreferenceChangeListener(this);
|
||||||
|
} catch (SettingNotFoundException snfe) {
|
||||||
|
Log.e(TAG, Settings.System.NOTIFICATION_LIGHT_PULSE + " not found");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -279,12 +299,18 @@ public class SoundAndDisplaySettings extends PreferenceActivity implements
|
|||||||
Settings.System.putInt(getContentResolver(),
|
Settings.System.putInt(getContentResolver(),
|
||||||
Settings.System.ACCELEROMETER_ROTATION,
|
Settings.System.ACCELEROMETER_ROTATION,
|
||||||
mAccelerometer.isChecked() ? 1 : 0);
|
mAccelerometer.isChecked() ? 1 : 0);
|
||||||
|
} else if (preference == mNotificationPulse) {
|
||||||
|
boolean value = mNotificationPulse.isChecked();
|
||||||
|
Settings.System.putInt(getContentResolver(),
|
||||||
|
Settings.System.NOTIFICATION_LIGHT_PULSE, value ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onPreferenceChange(Preference preference, Object objValue) {
|
public boolean onPreferenceChange(Preference preference, Object objValue) {
|
||||||
if (KEY_ANIMATIONS.equals(preference.getKey())) {
|
final String key = preference.getKey();
|
||||||
|
if (KEY_ANIMATIONS.equals(key)) {
|
||||||
try {
|
try {
|
||||||
int value = Integer.parseInt((String) objValue);
|
int value = Integer.parseInt((String) objValue);
|
||||||
if (mAnimationScales.length >= 1) {
|
if (mAnimationScales.length >= 1) {
|
||||||
@@ -303,7 +329,7 @@ public class SoundAndDisplaySettings extends PreferenceActivity implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (KEY_SCREEN_TIMEOUT.equals(preference.getKey())) {
|
if (KEY_SCREEN_TIMEOUT.equals(key)) {
|
||||||
int value = Integer.parseInt((String) objValue);
|
int value = Integer.parseInt((String) objValue);
|
||||||
try {
|
try {
|
||||||
Settings.System.putInt(getContentResolver(),
|
Settings.System.putInt(getContentResolver(),
|
||||||
@@ -311,7 +337,7 @@ public class SoundAndDisplaySettings extends PreferenceActivity implements
|
|||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
Log.e(TAG, "could not persist screen timeout setting", e);
|
Log.e(TAG, "could not persist screen timeout setting", e);
|
||||||
}
|
}
|
||||||
} else if (KEY_EMERGENCY_TONE.equals(preference.getKey())) {
|
} else if (KEY_EMERGENCY_TONE.equals(key)) {
|
||||||
int value = Integer.parseInt((String) objValue);
|
int value = Integer.parseInt((String) objValue);
|
||||||
try {
|
try {
|
||||||
Settings.System.putInt(getContentResolver(),
|
Settings.System.putInt(getContentResolver(),
|
||||||
@@ -323,5 +349,4 @@ public class SoundAndDisplaySettings extends PreferenceActivity implements
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user