[SQUASHED]Screen Off Animation config & make screen off animation selection logical[2/2]

Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
This commit is contained in:
maxwen
2018-09-13 00:51:16 +05:30
committed by Hưng Phan
parent 98df05de35
commit 2fca3a9d03
4 changed files with 45 additions and 0 deletions

View File

@@ -554,4 +554,19 @@
<item>2</item> <item>2</item>
<item>3</item> <item>3</item>
</string-array> </string-array>
<!-- Screen off animation -->
<string-array name="screen_off_animation_entries">
<item>@string/screen_off_animation_fade</item>
<item>@string/screen_off_animation_color</item>
<item>@string/screen_off_animation_crt</item>
<item>@string/screen_off_animation_scale</item>
</string-array>
<string-array name="screen_off_animation_values" translatable="false">
<item>0</item>
<item>1</item>
<item>2</item>
<item>3</item>
</string-array>
</resources> </resources>

View File

@@ -616,4 +616,11 @@
<!-- Force disable transition animation --> <!-- Force disable transition animation -->
<string name="disable_transition_animations_title">Disable transition animations</string> <string name="disable_transition_animations_title">Disable transition animations</string>
<string name="disable_transition_animations_summary">Force disable all transition animations</string> <string name="disable_transition_animations_summary">Force disable all transition animations</string>
<!-- Screen off animation -->
<string name="screen_off_animation_fade">Simple fade</string>
<string name="screen_off_animation_color">Color fade</string>
<string name="screen_off_animation_crt">CRT</string>
<string name="screen_off_animation_scale">Scale</string>
<string name="screen_off_animation_title">Screen off animation</string>
</resources> </resources>

View File

@@ -114,4 +114,12 @@
android:entries="@array/listview_interpolator_entries" android:entries="@array/listview_interpolator_entries"
android:entryValues="@array/listview_interpolator_values" android:entryValues="@array/listview_interpolator_values"
android:defaultValue="0" /> android:defaultValue="0" />
<ListPreference
android:key="screen_off_animation"
android:title="@string/screen_off_animation_title"
android:entries="@array/screen_off_animation_entries"
android:entryValues="@array/screen_off_animation_values"
android:persistent="false"
android:defaultValue="0" />
</PreferenceScreen> </PreferenceScreen>

View File

@@ -70,6 +70,7 @@ public class AnimationsSettings extends SettingsPreferenceFragment
private static final String SCROLLINGCACHE_PERSIST_PROP = "persist.sys.scrollingcache"; private static final String SCROLLINGCACHE_PERSIST_PROP = "persist.sys.scrollingcache";
private static final String SCROLLINGCACHE_DEFAULT = "2"; private static final String SCROLLINGCACHE_DEFAULT = "2";
private static final String ANIMATION_DURATION = "animation_duration"; private static final String ANIMATION_DURATION = "animation_duration";
private static final String KEY_SCREEN_OFF_ANIMATION = "screen_off_animation";
private ListPreference mToastAnimation; private ListPreference mToastAnimation;
private ListPreference mScrollingCachePref; private ListPreference mScrollingCachePref;
@@ -87,6 +88,7 @@ public class AnimationsSettings extends SettingsPreferenceFragment
private ListPreference mWallpaperIntraOpen; private ListPreference mWallpaperIntraOpen;
private ListPreference mWallpaperIntraClose; private ListPreference mWallpaperIntraClose;
private CustomSeekBarPreference mAnimationDuration; private CustomSeekBarPreference mAnimationDuration;
private ListPreference mScreenOffAnimation;
private int[] mAnimations; private int[] mAnimations;
private String[] mAnimationsStrings; private String[] mAnimationsStrings;
@@ -211,6 +213,13 @@ public class AnimationsSettings extends SettingsPreferenceFragment
mWallpaperIntraClose.setSummary(getProperSummary(mWallpaperIntraClose)); mWallpaperIntraClose.setSummary(getProperSummary(mWallpaperIntraClose));
mWallpaperIntraClose.setEntries(mAnimationsStrings); mWallpaperIntraClose.setEntries(mAnimationsStrings);
mWallpaperIntraClose.setEntryValues(mAnimationsNum); 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 @Override
@@ -244,6 +253,12 @@ public class AnimationsSettings extends SettingsPreferenceFragment
Settings.Global.LISTVIEW_INTERPOLATOR, value); Settings.Global.LISTVIEW_INTERPOLATOR, value);
mListViewInterpolator.setSummary(mListViewInterpolator.getEntries()[index]); mListViewInterpolator.setSummary(mListViewInterpolator.getEntries()[index]);
return true; 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) { } else if (preference == mScrollingCachePref) {
if (newValue != null) { if (newValue != null) {
SystemProperties.set(SCROLLINGCACHE_PERSIST_PROP, (String) newValue); SystemProperties.set(SCROLLINGCACHE_PERSIST_PROP, (String) newValue);