From 2fca3a9d030d85ebd20a4902b15a365c471b9219 Mon Sep 17 00:00:00 2001 From: maxwen Date: Thu, 13 Sep 2018 00:51:16 +0530 Subject: [PATCH] [SQUASHED]Screen Off Animation config & make screen off animation selection logical[2/2] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Hưng Phan --- res/values/cherish_arrays.xml | 15 +++++++++++++++ res/values/cherish_strings.xml | 7 +++++++ res/xml/cherish_settings_animations.xml | 8 ++++++++ .../settings/fragments/AnimationsSettings.java | 15 +++++++++++++++ 4 files changed, 45 insertions(+) diff --git a/res/values/cherish_arrays.xml b/res/values/cherish_arrays.xml index c85691c..fa12b51 100644 --- a/res/values/cherish_arrays.xml +++ b/res/values/cherish_arrays.xml @@ -554,4 +554,19 @@ 2 3 + + + + @string/screen_off_animation_fade + @string/screen_off_animation_color + @string/screen_off_animation_crt + @string/screen_off_animation_scale + + + + 0 + 1 + 2 + 3 + diff --git a/res/values/cherish_strings.xml b/res/values/cherish_strings.xml index 116ae5d..4b60284 100644 --- a/res/values/cherish_strings.xml +++ b/res/values/cherish_strings.xml @@ -616,4 +616,11 @@ Disable transition animations Force disable all transition animations + + + Simple fade + Color fade + CRT + Scale + Screen off animation diff --git a/res/xml/cherish_settings_animations.xml b/res/xml/cherish_settings_animations.xml index 8704bb6..178cba7 100644 --- a/res/xml/cherish_settings_animations.xml +++ b/res/xml/cherish_settings_animations.xml @@ -114,4 +114,12 @@ android:entries="@array/listview_interpolator_entries" android:entryValues="@array/listview_interpolator_values" android:defaultValue="0" /> + + diff --git a/src/com/cherish/settings/fragments/AnimationsSettings.java b/src/com/cherish/settings/fragments/AnimationsSettings.java index 10b0e87..ffbf323 100644 --- a/src/com/cherish/settings/fragments/AnimationsSettings.java +++ b/src/com/cherish/settings/fragments/AnimationsSettings.java @@ -70,6 +70,7 @@ public class AnimationsSettings extends SettingsPreferenceFragment private static final String SCROLLINGCACHE_PERSIST_PROP = "persist.sys.scrollingcache"; private static final String SCROLLINGCACHE_DEFAULT = "2"; private static final String ANIMATION_DURATION = "animation_duration"; + private static final String KEY_SCREEN_OFF_ANIMATION = "screen_off_animation"; private ListPreference mToastAnimation; private ListPreference mScrollingCachePref; @@ -87,6 +88,7 @@ public class AnimationsSettings extends SettingsPreferenceFragment private ListPreference mWallpaperIntraOpen; private ListPreference mWallpaperIntraClose; private CustomSeekBarPreference mAnimationDuration; + private ListPreference mScreenOffAnimation; private int[] mAnimations; private String[] mAnimationsStrings; @@ -211,6 +213,13 @@ public class AnimationsSettings extends SettingsPreferenceFragment mWallpaperIntraClose.setSummary(getProperSummary(mWallpaperIntraClose)); mWallpaperIntraClose.setEntries(mAnimationsStrings); mWallpaperIntraClose.setEntryValues(mAnimationsNum); + + mScreenOffAnimation = (ListPreference) findPreference(KEY_SCREEN_OFF_ANIMATION); + int screenOffAnimation = Settings.System.getInt(getContentResolver(), + Settings.System.SCREEN_OFF_ANIMATION, 0); + mScreenOffAnimation.setValue(Integer.toString(screenOffAnimation)); + mScreenOffAnimation.setSummary(mScreenOffAnimation.getEntry()); + mScreenOffAnimation.setOnPreferenceChangeListener(this); } @Override @@ -244,6 +253,12 @@ public class AnimationsSettings extends SettingsPreferenceFragment Settings.Global.LISTVIEW_INTERPOLATOR, value); mListViewInterpolator.setSummary(mListViewInterpolator.getEntries()[index]); return true; + } else if (preference == mScreenOffAnimation) { + int value = Integer.valueOf((String) newValue); + int index = mScreenOffAnimation.findIndexOfValue((String) newValue); + mScreenOffAnimation.setSummary(mScreenOffAnimation.getEntries()[index]); + Settings.System.putInt(getContentResolver(), Settings.System.SCREEN_OFF_ANIMATION, value); + return true; } else if (preference == mScrollingCachePref) { if (newValue != null) { SystemProperties.set(SCROLLINGCACHE_PERSIST_PROP, (String) newValue);