Cherish:Add option to disable scrolling cache [2/2]

Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
This commit is contained in:
Sang Tae Park
2018-09-13 20:54:17 +05:30
committed by Hưng Phan
parent b56864fef9
commit 9c0e1c565a
4 changed files with 45 additions and 0 deletions

View File

@@ -65,8 +65,12 @@ public class AnimationsSettings extends SettingsPreferenceFragment
private static final String KEY_TOAST_ANIMATION = "toast_animation";
private static final String KEY_LISTVIEW_ANIMATION = "listview_animation";
private static final String KEY_LISTVIEW_INTERPOLATOR = "listview_interpolator";
private static final String SCROLLINGCACHE_PREF = "pref_scrollingcache";
private static final String SCROLLINGCACHE_PERSIST_PROP = "persist.sys.scrollingcache";
private static final String SCROLLINGCACHE_DEFAULT = "2";
private ListPreference mToastAnimation;
private ListPreference mScrollingCachePref;
private ListPreference mListViewAnimation;
private ListPreference mListViewInterpolator;
ListPreference mActivityOpenPref;
@@ -121,6 +125,11 @@ public class AnimationsSettings extends SettingsPreferenceFragment
mListViewInterpolator.setOnPreferenceChangeListener(this);
mListViewInterpolator.setEnabled(listviewanimation > 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(),