Added a prefrence to control how aggressive the fragment pager is with preloading task lists

pull/14/head
Sam Bosley 13 years ago
parent 978aa11fd1
commit 529bb2fcba

@ -261,6 +261,15 @@
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:name="com.todoroo.astrid.core.PerformancePreferences"
android:theme="@android:style/Theme"
android:label="@string/EPr_performance_header">
<intent-filter>
<action android:name="com.todoroo.astrid.SETTINGS" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<!-- tags --> <!-- tags -->
<receiver android:name="com.todoroo.astrid.tags.TagsPlugin"> <receiver android:name="com.todoroo.astrid.tags.TagsPlugin">
<intent-filter> <intent-filter>

@ -0,0 +1,21 @@
package com.todoroo.astrid.core;
import android.preference.Preference;
import com.timsu.astrid.R;
import com.todoroo.andlib.utility.TodorooPreferenceActivity;
public class PerformancePreferences extends TodorooPreferenceActivity {
@Override
public int getPreferenceResource() {
return R.xml.preferences_performance;
}
@Override
public void updatePreferences(Preference preference, Object value) {
// TODO Auto-generated method stub
}
}

@ -159,6 +159,12 @@
<item>08</item> <item>08</item>
</string-array> </string-array>
<string-array name="EPr_swipe_lists_performance_mode_values">
<item>1</item>
<item>3</item>
<item>8</item>
</string-array>
<!-- ======================================================= APPEARANCE == --> <!-- ======================================================= APPEARANCE == -->
<string name="p_colorize">colorize</string> <string name="p_colorize">colorize</string>
@ -280,6 +286,9 @@
<!-- default reminder mode setting (corresponds to entry in TEA_reminder_mode_once, TEA_reminder_mode_five, TEA_reminder_mode_nonstop) --> <!-- default reminder mode setting (corresponds to entry in TEA_reminder_mode_once, TEA_reminder_mode_five, TEA_reminder_mode_nonstop) -->
<string name="p_default_reminders_mode_key">rmd_default_reminder_mode</string> <string name="p_default_reminders_mode_key">rmd_default_reminder_mode</string>
<!-- swipe between lists performance mode setting -->
<string name="p_swipe_lists_performance_key">p_swipe_lists_perf</string>
<string-array name="EPr_default_addtocalendar_values"> <string-array name="EPr_default_addtocalendar_values">
<!-- addtocalendar: labels that map EPr_default_addtocalendar items to calendar selection in settings. --> <!-- addtocalendar: labels that map EPr_default_addtocalendar items to calendar selection in settings. -->
<item>-1</item> <item>-1</item>

@ -540,6 +540,19 @@
<!-- Preference screen: all task row settings --> <!-- Preference screen: all task row settings -->
<string name="EPr_taskRowPrefs_title">Task Row Appearance</string> <string name="EPr_taskRowPrefs_title">Task Row Appearance</string>
<!-- Preference screen: performance -->
<string name="EPr_performance_header">Performance</string>
<!-- Preference: swipe between lists performance -->
<string name="EPr_swipe_lists_performance_title">Swipe between lists</string>
<string name="EPr_swipe_lists_performance_subtitle">Controls the memory performance of swipe between lists</string>
<string-array name="EPr_swipe_lists_performance_mode">
<item>Memory Conservation</item>
<item>Normal</item>
<item>High Performance</item>
</string-array>
<string-array name="EPr_default_reminders_mode"> <string-array name="EPr_default_reminders_mode">
<!-- reminders duration: labels for "Task Defaults" preference item. --> <!-- reminders duration: labels for "Task Defaults" preference item. -->
<item>@string/TEA_reminder_mode_once</item> <item>@string/TEA_reminder_mode_once</item>

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/EPr_performance_header">
<ListPreference
android:key="@string/p_swipe_lists_performance_key"
android:title="@string/EPr_swipe_lists_performance_title"
android:entries="@array/EPr_swipe_lists_performance_mode"
android:entryValues="@array/EPr_swipe_lists_performance_mode_values"
android:summary="@string/EPr_swipe_lists_performance_subtitle" />
</PreferenceScreen>

@ -9,6 +9,7 @@ import android.view.MotionEvent;
import android.view.View; import android.view.View;
import com.timsu.astrid.R; import com.timsu.astrid.R;
import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.activity.TaskListFragment; import com.todoroo.astrid.activity.TaskListFragment;
import com.todoroo.astrid.adapter.TaskListFragmentPagerAdapter; import com.todoroo.astrid.adapter.TaskListFragmentPagerAdapter;
import com.todoroo.astrid.api.Filter; import com.todoroo.astrid.api.Filter;
@ -16,11 +17,10 @@ import com.todoroo.astrid.utility.Flags;
public class TaskListFragmentPager extends ViewPager { public class TaskListFragmentPager extends ViewPager {
private static final int OFFSCREEN_PAGE_LIMIT = 2;
public TaskListFragmentPager(Context context, AttributeSet attrs) { public TaskListFragmentPager(Context context, AttributeSet attrs) {
super(context, attrs); super(context, attrs);
setOffscreenPageLimit(OFFSCREEN_PAGE_LIMIT); int offscreenPageLimit = Preferences.getIntegerFromString(R.string.p_swipe_lists_performance_key, 3);
setOffscreenPageLimit(offscreenPageLimit);
} }
@Override @Override

@ -46,6 +46,7 @@ public class AstridPreferences {
Preferences.setIfUnset(prefs, editor, r, R.string.p_rmd_default_random_hours, 0); Preferences.setIfUnset(prefs, editor, r, R.string.p_rmd_default_random_hours, 0);
Preferences.setIfUnset(prefs, editor, r, R.string.p_fontSize, 18); Preferences.setIfUnset(prefs, editor, r, R.string.p_fontSize, 18);
Preferences.setIfUnset(prefs, editor, r, R.string.p_showNotes, false); Preferences.setIfUnset(prefs, editor, r, R.string.p_showNotes, false);
Preferences.setIfUnset(prefs, editor, r, R.string.p_swipe_lists_performance_key, 3);
if ("white-blue".equals(Preferences.getStringValue(R.string.p_theme))) { //$NON-NLS-1$ migrate from when white-blue wasn't the default if ("white-blue".equals(Preferences.getStringValue(R.string.p_theme))) { //$NON-NLS-1$ migrate from when white-blue wasn't the default
Preferences.setString(R.string.p_theme, ThemeService.THEME_WHITE); Preferences.setString(R.string.p_theme, ThemeService.THEME_WHITE);

Loading…
Cancel
Save