diff --git a/astrid/src/com/todoroo/astrid/activity/BeastModePreferences.java b/astrid/src/com/todoroo/astrid/activity/BeastModePreferences.java index 34fc9c7be..ada29f88e 100644 --- a/astrid/src/com/todoroo/astrid/activity/BeastModePreferences.java +++ b/astrid/src/com/todoroo/astrid/activity/BeastModePreferences.java @@ -77,6 +77,31 @@ public class BeastModePreferences extends ListActivity { Preferences.setBoolean(BEAST_MODE_ASSERTED_HIDE_ALWAYS, true); } + /** + * returns the beast mode preference string that would correspond to a more advanced + * used for ab testing the effect of simple edit page + */ + public static String getAdvancedEditOrderForABTest(Context c) { + ArrayList defaultOrder = constructOrderedControlList(c); + String hideSectionPref = c.getString(R.string.TEA_ctrl_hide_section_pref); + String detailsSectionPref = c.getString(R.string.TEA_ctrl_more_pref); + + //Move hide section to the end of the list + defaultOrder.remove(hideSectionPref); + defaultOrder.add(hideSectionPref); + + // Put the last few items only under details + defaultOrder.remove(detailsSectionPref); + defaultOrder.add(defaultOrder.size() - 4, detailsSectionPref); + + StringBuilder builder = new StringBuilder(); + for (int i = 0; i < defaultOrder.size(); i++) { + builder.append(defaultOrder.get(i)); + builder.append(BEAST_MODE_PREF_ITEM_SEPARATOR); + } + return builder.toString(); + } + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); diff --git a/astrid/src/com/todoroo/astrid/service/abtesting/ABTests.java b/astrid/src/com/todoroo/astrid/service/abtesting/ABTests.java index 2f7305362..b819d20b4 100644 --- a/astrid/src/com/todoroo/astrid/service/abtesting/ABTests.java +++ b/astrid/src/com/todoroo/astrid/service/abtesting/ABTests.java @@ -125,6 +125,8 @@ public class ABTests { public static final String AB_SIMPLE_TASK_ROW = "android_simple_task_row"; //$NON-NLS-1$ + public static final String AB_ADVANCED_EDIT = "android_advanced_edit"; //$NON-NLS-1$ + private void initialize() { addTest(AB_TASK_EDIT_TOAST, new int[] { 1, 1 }, new int[] { 1, 1 }, new String[] { "dont-show-toasts", "show-toasts" }); //$NON-NLS-1$ //$NON-NLS-2$ @@ -132,6 +134,9 @@ public class ABTests { addTest(AB_SIMPLE_TASK_ROW, new int[] { 1, 1 }, new int[] { 1, 0 }, new String[] { "original-row-style", "simple-row-style" });//$NON-NLS-1$ //$NON-NLS-2$ + addTest(AB_ADVANCED_EDIT, new int[] { 1, 1 }, + new int[] { 1, 0 }, new String[] { "default_edit", "advanced_edit" }); //$NON-NLS-1$ //$NON-NLS-2$ + // AB_SWIPE_BETWEEN has to be added in the startup service since it needs a non-null context for initialization } } diff --git a/astrid/src/com/todoroo/astrid/utility/AstridPreferences.java b/astrid/src/com/todoroo/astrid/utility/AstridPreferences.java index 3decf017d..3a9cc42e3 100644 --- a/astrid/src/com/todoroo/astrid/utility/AstridPreferences.java +++ b/astrid/src/com/todoroo/astrid/utility/AstridPreferences.java @@ -17,6 +17,7 @@ import com.todoroo.andlib.sql.Functions; import com.todoroo.andlib.sql.Query; import com.todoroo.andlib.utility.AndroidUtilities; import com.todoroo.andlib.utility.Preferences; +import com.todoroo.astrid.activity.BeastModePreferences; import com.todoroo.astrid.api.AstridApiConstants; import com.todoroo.astrid.core.PluginServices; import com.todoroo.astrid.data.TagData; @@ -89,6 +90,12 @@ public class AstridPreferences { swipeEnabled = true; } + boolean advancedEdit = ABChooser.readChoiceForTest(ABTests.AB_ADVANCED_EDIT) != 0; + if (advancedEdit && !Preferences.isSet(BeastModePreferences.BEAST_MODE_ORDER_PREF)) { + Preferences.setString(BeastModePreferences.BEAST_MODE_ORDER_PREF, + BeastModePreferences.getAdvancedEditOrderForABTest(context)); + } + Preferences.setIfUnset(prefs, editor, r, R.string.p_swipe_lists_enabled, swipeEnabled); if ("white-blue".equals(Preferences.getStringValue(R.string.p_theme))) { //$NON-NLS-1$ migrate from when white-blue wasn't the default