Replaced the Performance preferences with 'Astrid Labs', where users can go to enable/disable features that are being AB tested

pull/14/head
Sam Bosley 12 years ago
parent a9ede5955c
commit 32bd06219a

@ -261,9 +261,9 @@
</intent-filter>
</activity>
<activity android:name="com.todoroo.astrid.core.PerformancePreferences"
<activity android:name="com.todoroo.astrid.core.LabsPreferences"
android:theme="@android:style/Theme"
android:label="@string/EPr_performance_header">
android:label="@string/EPr_labs_header">
<intent-filter>
<action android:name="com.todoroo.astrid.SETTINGS" />
<category android:name="android.intent.category.DEFAULT" />

@ -49,6 +49,7 @@ import com.todoroo.andlib.service.ExceptionService;
import com.todoroo.andlib.sql.Order;
import com.todoroo.andlib.sql.Query;
import com.todoroo.andlib.utility.DialogUtilities;
import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.actfm.sync.ActFmPreferenceService;
import com.todoroo.astrid.actfm.sync.ActFmSyncService;
import com.todoroo.astrid.activity.TaskEditFragment;
@ -66,7 +67,6 @@ import com.todoroo.astrid.service.TagDataService;
import com.todoroo.astrid.service.TaskService;
import com.todoroo.astrid.service.ThemeService;
import com.todoroo.astrid.service.abtesting.ABChooser;
import com.todoroo.astrid.service.abtesting.ABOptions;
import com.todoroo.astrid.tags.TagService;
import com.todoroo.astrid.ui.PeopleContainer;
import com.todoroo.astrid.ui.PeopleContainer.OnAddNewPersonListener;
@ -394,17 +394,15 @@ public class EditPeopleControlSet extends PopupControlSet {
new JSONObject().put("default_picture", R.drawable.icn_friends)
.put(CONTACT_CHOOSER_USER, true));
int contactsIndex = addUnassigned ? 2 : 1;
boolean addedContacts = true;
if (abChooser.getChoiceForOption(ABOptions.AB_OPTION_CONTACTS_PICKER_ENABLED) == 0)
boolean addContactPicker = Preferences.getBoolean(R.string.p_use_contact_picker, true);
if (addContactPicker)
coreUsers.add(contactsIndex, contactPickerUser);
else
addedContacts = false;
for (AssignedChangedListener l : listeners) {
if (l.shouldShowTaskRabbit()) {
taskRabbitUser = new AssignedToUser(activity.getString(R.string.actfm_EPA_task_rabbit), new JSONObject().put("default_picture", R.drawable.task_rabbit_image));
int taskRabbitIndex = addUnassigned ? 3 : 2;
if (!addedContacts)
if (!addContactPicker)
taskRabbitIndex--;
coreUsers.add(taskRabbitIndex, taskRabbitUser);
if(l.didPostToTaskRabbit()){

@ -10,11 +10,11 @@ import com.todoroo.andlib.utility.AndroidUtilities;
import com.todoroo.andlib.utility.DialogUtilities;
import com.todoroo.andlib.utility.TodorooPreferenceActivity;
public class PerformancePreferences extends TodorooPreferenceActivity {
public class LabsPreferences extends TodorooPreferenceActivity {
@Override
public int getPreferenceResource() {
return R.xml.preferences_performance;
return R.xml.preferences_labs;
}
@Override
@ -25,7 +25,7 @@ public class PerformancePreferences extends TodorooPreferenceActivity {
preference.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference p, Object newValue) {
DialogUtilities.okDialog(PerformancePreferences.this, r.getString(R.string.EPr_swipe_lists_restart_alert), null);
DialogUtilities.okDialog(LabsPreferences.this, r.getString(R.string.EPr_swipe_lists_restart_alert), null);
return true;
}
});

@ -290,6 +290,9 @@
<!-- swipe between lists performance mode setting -->
<string name="p_swipe_lists_performance_key">p_swipe_lists_perf</string>
<!-- use new contact picker setting -->
<string name="p_use_contact_picker">p_use_contact_picker</string>
<string-array name="EPr_default_addtocalendar_values">
<!-- addtocalendar: labels that map EPr_default_addtocalendar items to calendar selection in settings. -->
<item>-1</item>

@ -540,13 +540,18 @@
<!-- Preference screen: all task row settings -->
<string name="EPr_taskRowPrefs_title">Task Row Appearance</string>
<!-- Preference screen: performance -->
<string name="EPr_performance_header">Performance</string>
<!-- Preference screen: Astrid Labs (experimental features)-->
<string name="EPr_labs_header">Astrid Labs</string>
<string name="EPr_labs_desc">Enable or disable experimental features</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>
<!-- Preferences: use the system contact picker for task assignment -->
<string name="EPr_use_contact_picker">Use contact picker</string>
<string name="EPr_use_contact_picker_desc">Display the system contact picker option in the task assignment window</string>
<string name="EPr_swipe_lists_restart_alert">You will need to restart Astrid for this change to take effect</string>
<string-array name="EPr_swipe_lists_performance_mode">

@ -1,11 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/EPr_performance_header">
android:title="@string/EPr_labs_header"
android:summary="@string/EPr_labs_desc">
<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" />
<CheckBoxPreference
android:key="@string/p_use_contact_picker"
android:title="@string/EPr_use_contact_picker"
android:summary="@string/EPr_use_contact_picker_desc"/>
</PreferenceScreen>

@ -214,6 +214,7 @@ public class StartupService {
}).start();
abChooser.getChoiceForOption(ABOptions.AB_OPTION_SWIPE_ENABLED_KEY);
abChooser.getChoiceForOption(ABOptions.AB_OPTION_CONTACTS_PICKER_ENABLED);
AstridPreferences.setPreferenceDefaults();
// check for task killers

@ -174,7 +174,7 @@ public class ABOptions {
public static final String AB_OPTION_SWIPE_ENABLED_KEY = "swipeEnabled"; //$NON-NLS-1$
private static final int[] AB_OPTION_SWIPE_ENABLED_PROBS = { 1, 1 };
private static final String[] AB_OPTION_SWIPE_ENABLED_DESC = { "swipe-lists-enabled", "swipe-lists-disabled" }; //$NON-NLS-1$//$NON-NLS-2$
private static final String[] AB_OPTION_SWIPE_ENABLED_DESC = { "swipe-lists-disabled", "swipe-lists-enabled" }; //$NON-NLS-1$//$NON-NLS-2$
private static final String[] AB_OPTION_SWIPE_ENABLED_EVENTS = { StatisticsConstants.APP_OPEN_THREE_DAYS,
StatisticsConstants.APP_OPEN_ONE_WEEK,
StatisticsConstants.APP_OPEN_TWO_WEEKS,
@ -182,7 +182,7 @@ public class ABOptions {
public static final String AB_OPTION_CONTACTS_PICKER_ENABLED = "contactsEnabled"; //$NON-NLS-1$
private static final int[] AB_OPTION_CONTACTS_ENABLED_PROBS = { 1, 1 };
private static final String[] AB_OPTION_CONTACTS_ENABLED_DESC = { "contacts-enabled", "contacts-disabled" }; //$NON-NLS-1$//$NON-NLS-2$
private static final String[] AB_OPTION_CONTACTS_ENABLED_DESC = { "contacts-disabled", "contacts-enabled" }; //$NON-NLS-1$//$NON-NLS-2$
private static final String[] AB_OPTION_CONTACTS_ENABLED_EVENTS = { StatisticsConstants.APP_OPEN_THREE_DAYS,
StatisticsConstants.APP_OPEN_ONE_WEEK,
StatisticsConstants.APP_OPEN_TWO_WEEKS,

@ -49,9 +49,12 @@ public class AstridPreferences {
Preferences.setIfUnset(prefs, editor, r, R.string.p_fontSize, 18);
Preferences.setIfUnset(prefs, editor, r, R.string.p_showNotes, false);
boolean swipeEnabled = (ABChooser.readChoiceForOption(ABOptions.AB_OPTION_SWIPE_ENABLED_KEY) == 0);
boolean swipeEnabled = (ABChooser.readChoiceForOption(ABOptions.AB_OPTION_SWIPE_ENABLED_KEY) == 1);
Preferences.setIfUnset(prefs, editor, r, R.string.p_swipe_lists_performance_key, swipeEnabled ? 3 : 0);
boolean contactsPickerEnabled = (ABChooser.readChoiceForOption(ABOptions.AB_OPTION_CONTACTS_PICKER_ENABLED) == 1);
Preferences.setIfUnset(prefs, editor, r, R.string.p_use_contact_picker, contactsPickerEnabled);
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);
}

Loading…
Cancel
Save