Finalize login A/B tests, added preference for social reminders

pull/14/head
Sam Bosley 13 years ago
parent 33e78ff26d
commit b6bf3c7477

@ -149,9 +149,11 @@ public class ReminderDialog extends Dialog {
((TextView) findViewById(R.id.reminder_message)).setText( ((TextView) findViewById(R.id.reminder_message)).setText(
Notifications.getRandomReminder(activity.getResources().getStringArray(R.array.reminder_responses))); Notifications.getRandomReminder(activity.getResources().getStringArray(R.array.reminder_responses)));
if (Preferences.getBoolean(R.string.p_rmd_social, true)) {
Task task = taskService.fetchById(taskId, Task.ID, Task.SHARED_WITH); Task task = taskService.fetchById(taskId, Task.ID, Task.SHARED_WITH);
addFacesToReminder(activity, task); addFacesToReminder(activity, task);
} }
}
private void addFacesToReminder(Activity activity, Task task) { private void addFacesToReminder(Activity activity, Task task) {
if (task == null) if (task == null)

@ -99,6 +99,11 @@ public class ReminderPreferences extends TodorooPreferenceActivity {
preference.setSummary(R.string.rmd_EPr_enabled_desc_true); preference.setSummary(R.string.rmd_EPr_enabled_desc_true);
else else
preference.setSummary(R.string.rmd_EPr_enabled_desc_false); preference.setSummary(R.string.rmd_EPr_enabled_desc_false);
} else if (r.getString(R.string.p_rmd_social).equals(preference.getKey())) {
if ((Boolean)value)
preference.setSummary(R.string.rmd_EPr_social_summary_enabled);
else
preference.setSummary(R.string.rmd_EPr_social_summary_disabled);
} }
} }

@ -46,6 +46,9 @@
<!-- default random reminder setting (in hours) --> <!-- default random reminder setting (in hours) -->
<string name="p_rmd_default_random_hours">notif_default_reminder</string> <string name="p_rmd_default_random_hours">notif_default_reminder</string>
<!-- show faces in reminders (aka social reminders) -->
<string name="p_rmd_social">p_rmd_social</string>
<!-- field missed calls preference --> <!-- field missed calls preference -->
<string name="p_field_missed_calls">field_missed_calls</string> <string name="p_field_missed_calls">field_missed_calls</string>

@ -146,6 +146,15 @@
<!-- Reminder Preference: Notification Persistence Description (false) --> <!-- Reminder Preference: Notification Persistence Description (false) -->
<string name="rmd_EPr_persistent_desc_false">Notifications can be cleared with \"Clear All\" button</string> <string name="rmd_EPr_persistent_desc_false">Notifications can be cleared with \"Clear All\" button</string>
<!-- Reminder Preference: Social Reminders Title -->
<string name="rmd_EPr_social_title">Social encouragement</string>
<!-- Reminder Preference: Social Reminders Summary (enabled) -->
<string name="rmd_EPr_social_summary_enabled">Reminders will show who is counting on you for shared tasks</string>
<!-- Reminder Preference: Social Reminders Summary (disabled) -->
<string name="rmd_EPr_social_summary_disabled">Reminders will not show who is counting on you for shared tasks</string>
<!-- Reminder Preference: Notification Icon Title --> <!-- Reminder Preference: Notification Icon Title -->
<!-- Reminder Preference: Notification Icon Description --> <!-- Reminder Preference: Notification Icon Description -->

@ -23,6 +23,11 @@
android:entries="@array/EPr_rmd_time" android:entries="@array/EPr_rmd_time"
android:entryValues="@array/EPr_rmd_time_values" android:entryValues="@array/EPr_rmd_time_values"
android:title="@string/rmd_EPr_rmd_time_title"/> android:title="@string/rmd_EPr_rmd_time_title"/>
<com.todoroo.astrid.ui.MultilineCheckboxPreference
android:key="@string/p_rmd_social"
android:title="@string/rmd_EPr_social_title"
android:summary="@string/rmd_EPr_social_summary_enabled"
android:defaultValue="true"/>
<com.todoroo.astrid.ui.MultilineCheckboxPreference <com.todoroo.astrid.ui.MultilineCheckboxPreference
android:key="@string/p_rmd_persistent" android:key="@string/p_rmd_persistent"
android:title="@string/rmd_EPr_persistent_title"/> android:title="@string/rmd_EPr_persistent_title"/>

@ -8,11 +8,8 @@ package com.todoroo.astrid.service.abtesting;
import java.util.HashMap; import java.util.HashMap;
import java.util.Set; import java.util.Set;
import android.accounts.Account;
import android.content.Context; import android.content.Context;
import com.google.api.client.googleapis.extensions.android2.auth.GoogleAccountManager;
/** /**
* Helper class to define options with their probabilities and descriptions * Helper class to define options with their probabilities and descriptions
* @author Sam Bosley <sam@astrid.com> * @author Sam Bosley <sam@astrid.com>
@ -33,20 +30,7 @@ public class ABTests {
* @param context * @param context
*/ */
public void externalInit(Context context) { public void externalInit(Context context) {
// The outer 'if' statement is to prevent one test from being added one time //
// and the other from being added later if the accounts changed
if (ABChooser.readChoiceForTest(AB_NEW_LOGIN_NO_GOOGLE) == ABChooser.NO_OPTION
&& ABChooser.readChoiceForTest(AB_NEW_LOGIN_YES_GOOGLE) == ABChooser.NO_OPTION) {
GoogleAccountManager am = new GoogleAccountManager(context);
Account[] accounts = am.getAccounts();
if (accounts == null || accounts.length == 0) {
addTest(AB_NEW_LOGIN_NO_GOOGLE, new int[] { 1, 1 },
new int[] { 1, 0 }, new String[] { "old-welcome", "new-welcome" }, true); //$NON-NLS-1$//$NON-NLS-2$
} else {
addTest(AB_NEW_LOGIN_YES_GOOGLE, new int[] { 1, 1, 1 },
new int[] { 1, 0, 0 }, new String[] { "old-welcome", "new-welcome", "new-quick-welcome" }, true); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
}
}
} }
/** /**
@ -150,10 +134,6 @@ public class ABTests {
} }
} }
public static final String AB_NEW_LOGIN_NO_GOOGLE = "android_new_login_n_google"; //$NON-NLS-1$
public static final String AB_NEW_LOGIN_YES_GOOGLE = "android_new_login_y_google"; //$NON-NLS-1$
public static final String AB_USE_DATE_SHORTCUTS = "android_use_date_shortcuts"; //$NON-NLS-1$ public static final String AB_USE_DATE_SHORTCUTS = "android_use_date_shortcuts"; //$NON-NLS-1$
private void initialize() { private void initialize() {

@ -126,6 +126,7 @@ public class AstridDefaultPreferenceSpec extends AstridPreferenceSpec {
setPreference(prefs, editor, r, R.string.p_simple_input_boxes, false, ifUnset); setPreference(prefs, editor, r, R.string.p_simple_input_boxes, false, ifUnset);
setPreference(prefs, editor, r, R.string.p_show_list_members, true, ifUnset); setPreference(prefs, editor, r, R.string.p_show_list_members, true, ifUnset);
setPreference(prefs, editor, r, R.string.p_rmd_social, true, ifUnset);
setPreference(prefs, editor, r, R.string.p_theme, ThemeService.THEME_WHITE, ifUnset); setPreference(prefs, editor, r, R.string.p_theme, ThemeService.THEME_WHITE, ifUnset);

@ -100,6 +100,7 @@ public class AstridLitePreferenceSpec extends AstridPreferenceSpec {
setPreference(prefs, editor, r, R.string.p_simple_input_boxes, true, ifUnset); setPreference(prefs, editor, r, R.string.p_simple_input_boxes, true, ifUnset);
setPreference(prefs, editor, r, R.string.p_show_list_members, false, ifUnset); setPreference(prefs, editor, r, R.string.p_show_list_members, false, ifUnset);
setPreference(prefs, editor, r, R.string.p_rmd_social, true, ifUnset);
setPreference(prefs, editor, r, R.string.p_theme, ThemeService.THEME_WHITE_ALT, ifUnset); setPreference(prefs, editor, r, R.string.p_theme, ThemeService.THEME_WHITE_ALT, ifUnset);

@ -6,6 +6,7 @@
package com.todoroo.astrid.welcome.tutorial; package com.todoroo.astrid.welcome.tutorial;
import android.accounts.Account;
import android.content.Context; import android.content.Context;
import android.os.Parcelable; import android.os.Parcelable;
import android.support.v4.view.PagerAdapter; import android.support.v4.view.PagerAdapter;
@ -17,12 +18,11 @@ import android.view.WindowManager;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import com.google.api.client.googleapis.extensions.android2.auth.GoogleAccountManager;
import com.timsu.astrid.R; import com.timsu.astrid.R;
import com.todoroo.andlib.service.Autowired; import com.todoroo.andlib.service.Autowired;
import com.todoroo.andlib.service.DependencyInjectionService; import com.todoroo.andlib.service.DependencyInjectionService;
import com.todoroo.astrid.actfm.sync.ActFmPreferenceService; import com.todoroo.astrid.actfm.sync.ActFmPreferenceService;
import com.todoroo.astrid.service.abtesting.ABChooser;
import com.todoroo.astrid.service.abtesting.ABTests;
import com.todoroo.astrid.utility.Constants; import com.todoroo.astrid.utility.Constants;
import com.viewpagerindicator.TitleProvider; import com.viewpagerindicator.TitleProvider;
@ -62,7 +62,7 @@ public class WelcomePagerAdapter extends PagerAdapter implements TitleProvider
R.layout.welcome_walkthrough_page, R.layout.welcome_walkthrough_page,
R.layout.welcome_walkthrough_page, R.layout.welcome_walkthrough_page,
R.layout.welcome_walkthrough_page, R.layout.welcome_walkthrough_page,
R.layout.welcome_walkthrough_login_page, R.layout.actfm_login_activity,
}; };
public int fallbackLoginPage; public int fallbackLoginPage;
@ -80,32 +80,21 @@ public class WelcomePagerAdapter extends PagerAdapter implements TitleProvider
title[title.length - 1] = R.string.welcome_title_7_return; title[title.length - 1] = R.string.welcome_title_7_return;
images[images.length - 1] = R.drawable.welcome_walkthrough_1; images[images.length - 1] = R.drawable.welcome_walkthrough_1;
body[body.length - 1] = R.string.welcome_body_7_return; body[body.length - 1] = R.string.welcome_body_7_return;
fallbackLoginPage = R.layout.welcome_walkthrough_page; fallbackLoginPage = R.layout.actfm_login_activity;
} else { } else {
if (Constants.ASTRID_LITE) { if (Constants.ASTRID_LITE) {
adjustResourcesForLite(); adjustResourcesForLite();
} }
GoogleAccountManager am = new GoogleAccountManager(context);
Account[] accounts = am.getAccounts();
// Setup login page from AB tests // Setup login page from AB tests
fallbackLoginPage = layouts[layouts.length - 1]; fallbackLoginPage = layouts[layouts.length - 1];
if (ABChooser.readChoiceForTest(ABTests.AB_NEW_LOGIN_YES_GOOGLE) != ABChooser.NO_OPTION) { if (accounts != null && accounts.length > 0) { // If has google account
int choice = ABChooser.readChoiceForTest(ABTests.AB_NEW_LOGIN_YES_GOOGLE);
switch (choice) {
case 1:
fallbackLoginPage = layouts[layouts.length - 1] = R.layout.actfm_login_activity;
break;
case 2:
layouts[layouts.length - 1] = R.layout.welcome_walkthrough_simple_login; layouts[layouts.length - 1] = R.layout.welcome_walkthrough_simple_login;
fallbackLoginPage = R.layout.actfm_login_activity; fallbackLoginPage = R.layout.actfm_login_activity;
break; } else { // If no google account
default:
fallbackLoginPage = layouts[layouts.length - 1];
break;
}
} else if (ABChooser.readChoiceForTest(ABTests.AB_NEW_LOGIN_NO_GOOGLE) != ABChooser.NO_OPTION) {
int choice = ABChooser.readChoiceForTest(ABTests.AB_NEW_LOGIN_NO_GOOGLE);
fallbackLoginPage = layouts[layouts.length - 1];
if (choice == 1)
fallbackLoginPage = layouts[layouts.length - 1] = R.layout.actfm_login_activity; fallbackLoginPage = layouts[layouts.length - 1] = R.layout.actfm_login_activity;
} }
} }
@ -115,7 +104,7 @@ public class WelcomePagerAdapter extends PagerAdapter implements TitleProvider
images = new int[] { 0 }; images = new int[] { 0 };
title = new int[] { R.string.welcome_title_7 }; title = new int[] { R.string.welcome_title_7 };
body = new int[] { R.string.welcome_body_7 }; body = new int[] { R.string.welcome_body_7 };
layouts = new int[] { R.layout.welcome_walkthrough_login_page }; layouts = new int[] { R.layout.actfm_login_activity };
} }
@Override @Override

Loading…
Cancel
Save