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

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

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

@ -99,6 +99,11 @@ public class ReminderPreferences extends TodorooPreferenceActivity {
preference.setSummary(R.string.rmd_EPr_enabled_desc_true);
else
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) -->
<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 -->
<string name="p_field_missed_calls">field_missed_calls</string>

@ -145,6 +145,15 @@
<string name="rmd_EPr_persistent_desc_true">Notifications must be viewed individually to be cleared</string>
<!-- Reminder Preference: Notification Persistence Description (false) -->
<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 Description -->

@ -23,6 +23,11 @@
android:entries="@array/EPr_rmd_time"
android:entryValues="@array/EPr_rmd_time_values"
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
android:key="@string/p_rmd_persistent"
android:title="@string/rmd_EPr_persistent_title"/>

@ -8,11 +8,8 @@ package com.todoroo.astrid.service.abtesting;
import java.util.HashMap;
import java.util.Set;
import android.accounts.Account;
import android.content.Context;
import com.google.api.client.googleapis.extensions.android2.auth.GoogleAccountManager;
/**
* Helper class to define options with their probabilities and descriptions
* @author Sam Bosley <sam@astrid.com>
@ -33,20 +30,7 @@ public class ABTests {
* @param 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$
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_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);

@ -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_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);

@ -6,6 +6,7 @@
package com.todoroo.astrid.welcome.tutorial;
import android.accounts.Account;
import android.content.Context;
import android.os.Parcelable;
import android.support.v4.view.PagerAdapter;
@ -17,12 +18,11 @@ import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.TextView;
import com.google.api.client.googleapis.extensions.android2.auth.GoogleAccountManager;
import com.timsu.astrid.R;
import com.todoroo.andlib.service.Autowired;
import com.todoroo.andlib.service.DependencyInjectionService;
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.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_login_page,
R.layout.actfm_login_activity,
};
public int fallbackLoginPage;
@ -80,33 +80,22 @@ public class WelcomePagerAdapter extends PagerAdapter implements TitleProvider
title[title.length - 1] = R.string.welcome_title_7_return;
images[images.length - 1] = R.drawable.welcome_walkthrough_1;
body[body.length - 1] = R.string.welcome_body_7_return;
fallbackLoginPage = R.layout.welcome_walkthrough_page;
fallbackLoginPage = R.layout.actfm_login_activity;
} else {
if (Constants.ASTRID_LITE) {
adjustResourcesForLite();
}
GoogleAccountManager am = new GoogleAccountManager(context);
Account[] accounts = am.getAccounts();
// Setup login page from AB tests
fallbackLoginPage = layouts[layouts.length - 1];
if (ABChooser.readChoiceForTest(ABTests.AB_NEW_LOGIN_YES_GOOGLE) != ABChooser.NO_OPTION) {
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;
fallbackLoginPage = R.layout.actfm_login_activity;
break;
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;
if (accounts != null && accounts.length > 0) { // If has google account
layouts[layouts.length - 1] = R.layout.welcome_walkthrough_simple_login;
fallbackLoginPage = R.layout.actfm_login_activity;
} else { // If no google account
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 };
title = new int[] { R.string.welcome_title_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

Loading…
Cancel
Save