Move "Pulse notification light" to Display settings.
Bug: 5242350 Change-Id: I91cb23ca8f49c1c053710031b0316b10d55fbab4
This commit is contained in:
@@ -33,6 +33,7 @@ import android.preference.ListPreference;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceScreen;
|
||||
import android.provider.Settings;
|
||||
import android.provider.Settings.SettingNotFoundException;
|
||||
import android.util.Log;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -47,9 +48,11 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
|
||||
private static final String KEY_SCREEN_TIMEOUT = "screen_timeout";
|
||||
private static final String KEY_ACCELEROMETER = "accelerometer";
|
||||
private static final String KEY_FONT_SIZE = "font_size";
|
||||
private static final String KEY_NOTIFICATION_PULSE = "notification_pulse";
|
||||
|
||||
private CheckBoxPreference mAccelerometer;
|
||||
private ListPreference mFontSizePref;
|
||||
private CheckBoxPreference mNotificationPulse;
|
||||
|
||||
private final Configuration mCurConfig = new Configuration();
|
||||
|
||||
@@ -82,6 +85,20 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
|
||||
|
||||
mFontSizePref = (ListPreference) findPreference(KEY_FONT_SIZE);
|
||||
mFontSizePref.setOnPreferenceChangeListener(this);
|
||||
mNotificationPulse = (CheckBoxPreference) findPreference(KEY_NOTIFICATION_PULSE);
|
||||
if (mNotificationPulse != null
|
||||
&& getResources().getBoolean(
|
||||
com.android.internal.R.bool.config_intrusiveNotificationLed) == false) {
|
||||
getPreferenceScreen().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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updateTimeoutPreferenceDescription(long currentTimeout) {
|
||||
@@ -209,13 +226,18 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
|
||||
Log.w(TAG, "Unable to save font size");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
|
||||
if (preference == mAccelerometer) {
|
||||
Settings.System.putInt(getContentResolver(),
|
||||
Settings.System.ACCELEROMETER_ROTATION,
|
||||
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 super.onPreferenceTreeClick(preferenceScreen, preference);
|
||||
}
|
||||
|
Reference in New Issue
Block a user