diff --git a/astrid/plugin-src/com/todoroo/astrid/reminders/ReminderDialog.java b/astrid/plugin-src/com/todoroo/astrid/reminders/ReminderDialog.java index fac3d66dc..0c897a972 100644 --- a/astrid/plugin-src/com/todoroo/astrid/reminders/ReminderDialog.java +++ b/astrid/plugin-src/com/todoroo/astrid/reminders/ReminderDialog.java @@ -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) { diff --git a/astrid/plugin-src/com/todoroo/astrid/reminders/ReminderPreferences.java b/astrid/plugin-src/com/todoroo/astrid/reminders/ReminderPreferences.java index c97c2f7f3..38e0ca01b 100644 --- a/astrid/plugin-src/com/todoroo/astrid/reminders/ReminderPreferences.java +++ b/astrid/plugin-src/com/todoroo/astrid/reminders/ReminderPreferences.java @@ -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); } } diff --git a/astrid/res/values/keys.xml b/astrid/res/values/keys.xml index 959367192..47db84ca6 100644 --- a/astrid/res/values/keys.xml +++ b/astrid/res/values/keys.xml @@ -46,6 +46,9 @@ notif_default_reminder + + p_rmd_social + field_missed_calls diff --git a/astrid/res/values/strings-reminders.xml b/astrid/res/values/strings-reminders.xml index 1a0906c96..62051dbe8 100644 --- a/astrid/res/values/strings-reminders.xml +++ b/astrid/res/values/strings-reminders.xml @@ -145,6 +145,15 @@ Notifications must be viewed individually to be cleared Notifications can be cleared with \"Clear All\" button + + + Social encouragement + + Reminders will show who is counting on you for shared tasks + + Reminders will not show who is counting on you for shared tasks + + diff --git a/astrid/res/xml/preferences_reminders.xml b/astrid/res/xml/preferences_reminders.xml index 302c9e805..4f024a70f 100644 --- a/astrid/res/xml/preferences_reminders.xml +++ b/astrid/res/xml/preferences_reminders.xml @@ -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"/> + diff --git a/astrid/src/com/todoroo/astrid/service/abtesting/ABTests.java b/astrid/src/com/todoroo/astrid/service/abtesting/ABTests.java index 060d55562..0e0362cde 100644 --- a/astrid/src/com/todoroo/astrid/service/abtesting/ABTests.java +++ b/astrid/src/com/todoroo/astrid/service/abtesting/ABTests.java @@ -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 @@ -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() { diff --git a/astrid/src/com/todoroo/astrid/utility/AstridDefaultPreferenceSpec.java b/astrid/src/com/todoroo/astrid/utility/AstridDefaultPreferenceSpec.java index 5a8a031a4..58970d92f 100644 --- a/astrid/src/com/todoroo/astrid/utility/AstridDefaultPreferenceSpec.java +++ b/astrid/src/com/todoroo/astrid/utility/AstridDefaultPreferenceSpec.java @@ -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); diff --git a/astrid/src/com/todoroo/astrid/utility/AstridLitePreferenceSpec.java b/astrid/src/com/todoroo/astrid/utility/AstridLitePreferenceSpec.java index 7c047ffd0..df9830b0d 100644 --- a/astrid/src/com/todoroo/astrid/utility/AstridLitePreferenceSpec.java +++ b/astrid/src/com/todoroo/astrid/utility/AstridLitePreferenceSpec.java @@ -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); diff --git a/astrid/src/com/todoroo/astrid/welcome/tutorial/WelcomePagerAdapter.java b/astrid/src/com/todoroo/astrid/welcome/tutorial/WelcomePagerAdapter.java index d2f448415..9575e1b97 100644 --- a/astrid/src/com/todoroo/astrid/welcome/tutorial/WelcomePagerAdapter.java +++ b/astrid/src/com/todoroo/astrid/welcome/tutorial/WelcomePagerAdapter.java @@ -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