From 9c0e1c565a1f33077d152b17909266e253593e1c Mon Sep 17 00:00:00 2001 From: Sang Tae Park Date: Thu, 13 Sep 2018 20:54:17 +0530 Subject: [PATCH] Cherish:Add option to disable scrolling cache [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 | 8 ++++++++ res/xml/cherish_settings_animations.xml | 8 ++++++++ .../settings/fragments/AnimationsSettings.java | 14 ++++++++++++++ 4 files changed, 45 insertions(+) diff --git a/res/values/cherish_arrays.xml b/res/values/cherish_arrays.xml index 7717d84..c85691c 100644 --- a/res/values/cherish_arrays.xml +++ b/res/values/cherish_arrays.xml @@ -539,4 +539,19 @@ 6 7 + + + + @string/pref_scrollingcache_force_enable + @string/pref_scrollingcache_default_enable + @string/pref_scrollingcache_default_disable + @string/pref_scrollingcache_force_disable + + + + 0 + 1 + 2 + 3 + diff --git a/res/values/cherish_strings.xml b/res/values/cherish_strings.xml index 0a4e85e..887d3bf 100644 --- a/res/values/cherish_strings.xml +++ b/res/values/cherish_strings.xml @@ -606,4 +606,12 @@ Overshoot Anticipate and overshoot Bounce + + + Scrolling cache + Scrolling cache may improve scrolling performance at the cost of memory + Force enable + Default enable + Default disable + Force disable diff --git a/res/xml/cherish_settings_animations.xml b/res/xml/cherish_settings_animations.xml index 3c33021..be3fdc1 100644 --- a/res/xml/cherish_settings_animations.xml +++ b/res/xml/cherish_settings_animations.xml @@ -69,6 +69,14 @@ + + 0); + mScrollingCachePref = (ListPreference) findPreference(SCROLLINGCACHE_PREF); + mScrollingCachePref.setValue(SystemProperties.get(SCROLLINGCACHE_PERSIST_PROP, + SystemProperties.get(SCROLLINGCACHE_PERSIST_PROP, SCROLLINGCACHE_DEFAULT))); + mScrollingCachePref.setOnPreferenceChangeListener(this); + mAnimations = AwesomeAnimationHelper.getAnimationsList(); int animqty = mAnimations.length; mAnimationsStrings = new String[animqty]; @@ -228,6 +237,11 @@ public class AnimationsSettings extends SettingsPreferenceFragment Settings.Global.LISTVIEW_INTERPOLATOR, value); mListViewInterpolator.setSummary(mListViewInterpolator.getEntries()[index]); return true; + } else if (preference == mScrollingCachePref) { + if (newValue != null) { + SystemProperties.set(SCROLLINGCACHE_PERSIST_PROP, (String) newValue); + } + return true; } else if (preference == mActivityOpenPref) { int val = Integer.parseInt((String) newValue); result = Settings.Global.putInt(mContext.getContentResolver(),