Cherish:Add option to disable scrolling cache [2/2]
Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
This commit is contained in:
@@ -539,4 +539,19 @@
|
||||
<item>6</item>
|
||||
<item>7</item>
|
||||
</string-array>
|
||||
|
||||
<!-- Option to enable/disable scrolling cache -->
|
||||
<string-array name="entries_scrollingcache" translatable="false">
|
||||
<item>@string/pref_scrollingcache_force_enable</item>
|
||||
<item>@string/pref_scrollingcache_default_enable</item>
|
||||
<item>@string/pref_scrollingcache_default_disable</item>
|
||||
<item>@string/pref_scrollingcache_force_disable</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="values_scrollingcache" translatable="false">
|
||||
<item>0</item>
|
||||
<item>1</item>
|
||||
<item>2</item>
|
||||
<item>3</item>
|
||||
</string-array>
|
||||
</resources>
|
||||
|
||||
@@ -606,4 +606,12 @@
|
||||
<string name="listview_overshoot_interpolator">Overshoot</string>
|
||||
<string name="listview_anticipate_overshoot_interpolator">Anticipate and overshoot</string>
|
||||
<string name="listview_bounce_interpolator">Bounce</string>
|
||||
|
||||
<!-- Option to enable/disable scrolling cache -->
|
||||
<string name="pref_scrollingcache_title">Scrolling cache</string>
|
||||
<string name="pref_scrollingcache_summary">Scrolling cache may improve scrolling performance at the cost of memory</string>
|
||||
<string name="pref_scrollingcache_force_enable">Force enable</string>
|
||||
<string name="pref_scrollingcache_default_enable">Default enable</string>
|
||||
<string name="pref_scrollingcache_default_disable">Default disable</string>
|
||||
<string name="pref_scrollingcache_force_disable">Force disable</string>
|
||||
</resources>
|
||||
|
||||
@@ -69,6 +69,14 @@
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<ListPreference
|
||||
android:key="pref_scrollingcache"
|
||||
android:dialogTitle="@string/pref_scrollingcache_title"
|
||||
android:title="@string/pref_scrollingcache_title"
|
||||
android:summary="@string/pref_scrollingcache_summary"
|
||||
android:entries="@array/entries_scrollingcache"
|
||||
android:entryValues="@array/values_scrollingcache" />
|
||||
|
||||
<ListPreference
|
||||
android:key="toast_animation"
|
||||
android:title="@string/toast_animation_title"
|
||||
|
||||
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user