diff options
author | DvTonder <david.vantonder@gmail.com> | 2013-06-01 13:46:24 -0400 |
---|---|---|
committer | DvTonder <david.vantonder@gmail.com> | 2013-06-02 19:36:59 -0400 |
commit | 0724c8c742a3641f14eb143d0cf7fb8e90f8d8bb (patch) | |
tree | 29740aa4aa350eb2b92cf4a16b9118e351300aab | |
parent | ff42ec782a25e92135c0a362644c58b9ca0c210f (diff) | |
download | packages_apps_settings-0724c8c742a3641f14eb143d0cf7fb8e90f8d8bb.zip packages_apps_settings-0724c8c742a3641f14eb143d0cf7fb8e90f8d8bb.tar.gz packages_apps_settings-0724c8c742a3641f14eb143d0cf7fb8e90f8d8bb.tar.bz2 |
Settings: Add support to enable/disable Electron Beam (2/2)
Parts were brought over from CM9 but not all of it. This completes
the port.
Change-Id: I5ebfab22e68ea34e3babfaacd9c8103e25932d3d
-rw-r--r-- | res/values/cm_strings.xml | 5 | ||||
-rw-r--r-- | res/xml/display_settings.xml | 19 | ||||
-rw-r--r-- | src/com/android/settings/DisplaySettings.java | 15 |
3 files changed, 33 insertions, 6 deletions
diff --git a/res/values/cm_strings.xml b/res/values/cm_strings.xml index 787083f..d80f8d7 100644 --- a/res/values/cm_strings.xml +++ b/res/values/cm_strings.xml @@ -940,4 +940,9 @@ two in order to insert additional control points. \'Remove\' deletes the selecte <string name="power_notifications_ringtone_title">Notification sound</string> <!-- Sound settings, power notifications label for ringtone == none --> <string name="power_notifications_ringtone_silent">Silent</string> + + <!-- Display Screen-on and off Electron beam animations --> + <string name="screen_off_animation_title">Screen-off animation</string> + <string name="screen_off_animation_summary">Show the electron beam animation when the screen is turned off</string> + </resources> diff --git a/res/xml/display_settings.xml b/res/xml/display_settings.xml index ed88399..b0b92d1 100644 --- a/res/xml/display_settings.xml +++ b/res/xml/display_settings.xml @@ -59,14 +59,21 @@ android:title="@string/wifi_display_settings_title" android:fragment="com.android.settings.wfd.WifiDisplaySettings" /> + <CheckBoxPreference + android:key="screen_off_animation" + android:title="@string/screen_off_animation_title" + android:summary="@string/screen_off_animation_summary" + android:defaultValue="true" /> + <PreferenceCategory android:key="category_wakeup_options" - android:title="@string/display_category_wakeup_options_title"/> + android:title="@string/display_category_wakeup_options_title" > - <CheckBoxPreference - android:key="pref_volume_wake" - android:title="@string/pref_volume_wake_title" - android:summary="@string/pref_volume_wake_summary" - android:defaultValue="false" /> + <CheckBoxPreference + android:key="pref_volume_wake" + android:title="@string/pref_volume_wake_title" + android:summary="@string/pref_volume_wake_summary" + android:defaultValue="false" /> + </PreferenceCategory> </PreferenceScreen> diff --git a/src/com/android/settings/DisplaySettings.java b/src/com/android/settings/DisplaySettings.java index d88c2f1..f7ca7ea 100644 --- a/src/com/android/settings/DisplaySettings.java +++ b/src/com/android/settings/DisplaySettings.java @@ -63,6 +63,7 @@ public class DisplaySettings extends SettingsPreferenceFragment implements private static final String KEY_DISPLAY_ROTATION = "display_rotation"; private static final String KEY_WAKEUP_CATEGORY = "category_wakeup_options"; private static final String KEY_VOLUME_WAKE = "pref_volume_wake"; + private static final String KEY_SCREEN_OFF_ANIMATION = "screen_off_animation"; // Strings used for building the summary private static final String ROTATION_ANGLE_0 = "0"; @@ -86,6 +87,8 @@ public class DisplaySettings extends SettingsPreferenceFragment implements private WifiDisplayStatus mWifiDisplayStatus; private Preference mWifiDisplayPreference; + private CheckBoxPreference mScreenOffAnimation; + private ContentObserver mAccelerometerRotationObserver = new ContentObserver(new Handler()) { @Override @@ -153,6 +156,14 @@ public class DisplaySettings extends SettingsPreferenceFragment implements } } + mScreenOffAnimation = (CheckBoxPreference) findPreference(KEY_SCREEN_OFF_ANIMATION); + if(getResources().getBoolean(com.android.internal.R.bool.config_screenOffAnimation)) { + mScreenOffAnimation.setChecked(Settings.System.getInt(resolver, + Settings.System.SCREEN_OFF_ANIMATION, 1) == 1); + } else { + getPreferenceScreen().removePreference(mScreenOffAnimation); + } + } private void updateDisplayRotationPreferenceDescription() { @@ -388,6 +399,10 @@ public class DisplaySettings extends SettingsPreferenceFragment implements Settings.System.putInt(getContentResolver(), Settings.System.VOLUME_WAKE_SCREEN, mVolumeWake.isChecked() ? 1 : 0); return true; + } else if (preference == mScreenOffAnimation) { + Settings.System.putInt(getContentResolver(), Settings.System.SCREEN_OFF_ANIMATION, + mScreenOffAnimation.isChecked() ? 1 : 0); + return true; } return super.onPreferenceTreeClick(preferenceScreen, preference); |