Basic logic for ab testing a simple edit page where most things are hidden

pull/14/head
Sam Bosley 12 years ago
parent 5675f598e6
commit c9e8efc82a

@ -77,6 +77,28 @@ public class BeastModePreferences extends ListActivity {
Preferences.setBoolean(BEAST_MODE_ASSERTED_HIDE_ALWAYS, true); Preferences.setBoolean(BEAST_MODE_ASSERTED_HIDE_ALWAYS, true);
} }
/**
* returns the beast mode preference string that would correspond to almost everything hidden
* used for ab testing the effect of simple edit page
*/
public static String getSimpleEditOrderForABTest(Context c) {
ArrayList<String> defaultOrder = constructOrderedControlList(c);
String hideSectionPref = c.getString(R.string.TEA_ctrl_hide_section_pref);
String detailsSectionPref = c.getString(R.string.TEA_ctrl_more_pref);
int moreIndex = defaultOrder.indexOf(detailsSectionPref);
if (moreIndex > - 1) {
defaultOrder.remove(hideSectionPref);
defaultOrder.add(moreIndex + 1, hideSectionPref);
}
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 @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);

@ -121,8 +121,13 @@ public class ABTests {
public static final String AB_TEST_PERSISTENT_REMINDERS = "android_persist_rmd"; //$NON-NLS-1$ public static final String AB_TEST_PERSISTENT_REMINDERS = "android_persist_rmd"; //$NON-NLS-1$
public static final String AB_TEST_SIMPLE_EDIT = "android_simple_edit"; //$NON-NLS-1$
private void initialize() { private void initialize() {
addTest(AB_TEST_PERSISTENT_REMINDERS, new int[] { 1, 1 }, addTest(AB_TEST_PERSISTENT_REMINDERS, new int[] { 1, 1 },
new int[] { 0, 1 }, new String[] { "rmd-not-persistent", "rmd-persistent" }); //$NON-NLS-1$ //$NON-NLS-2$ new int[] { 0, 1 }, new String[] { "rmd-not-persistent", "rmd-persistent" }); //$NON-NLS-1$ //$NON-NLS-2$
addTest(AB_TEST_SIMPLE_EDIT, new int[] { 9, 1 },
new int[] { 1, 0 }, new String[] { "regular-edit", "simple-edit" }); //$NON-NLS-1$ //$NON-NLS-2$
} }
} }

@ -15,6 +15,7 @@ import com.todoroo.andlib.data.TodorooCursor;
import com.todoroo.andlib.service.ContextManager; import com.todoroo.andlib.service.ContextManager;
import com.todoroo.andlib.sql.Query; import com.todoroo.andlib.sql.Query;
import com.todoroo.andlib.utility.Preferences; import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.activity.BeastModePreferences;
import com.todoroo.astrid.api.AstridApiConstants; import com.todoroo.astrid.api.AstridApiConstants;
import com.todoroo.astrid.core.PluginServices; import com.todoroo.astrid.core.PluginServices;
import com.todoroo.astrid.data.Task; import com.todoroo.astrid.data.Task;
@ -69,6 +70,12 @@ public class AstridPreferences {
Preferences.setIfUnset(prefs, editor, r, R.string.p_rmd_persistent, Preferences.setIfUnset(prefs, editor, r, R.string.p_rmd_persistent,
ABChooser.readChoiceForTest(ABTests.AB_TEST_PERSISTENT_REMINDERS) != 0); ABChooser.readChoiceForTest(ABTests.AB_TEST_PERSISTENT_REMINDERS) != 0);
boolean simpleEdit = ABChooser.readChoiceForTest(ABTests.AB_TEST_SIMPLE_EDIT) != 0;
if (simpleEdit && !Preferences.isSet(BeastModePreferences.BEAST_MODE_ORDER_PREF)) {
Preferences.setString(BeastModePreferences.BEAST_MODE_ORDER_PREF,
BeastModePreferences.getSimpleEditOrderForABTest(context));
}
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