diff --git a/astrid/plugin-src/com/todoroo/astrid/gcal/CalendarAlarmReceiver.java b/astrid/plugin-src/com/todoroo/astrid/gcal/CalendarAlarmReceiver.java index 944ea44b0..3315f474c 100644 --- a/astrid/plugin-src/com/todoroo/astrid/gcal/CalendarAlarmReceiver.java +++ b/astrid/plugin-src/com/todoroo/astrid/gcal/CalendarAlarmReceiver.java @@ -11,7 +11,9 @@ import android.net.Uri; import android.text.TextUtils; import android.util.Log; +import com.timsu.astrid.R; import com.todoroo.andlib.utility.DateUtilities; +import com.todoroo.andlib.utility.Preferences; import com.todoroo.astrid.utility.Constants; @SuppressWarnings("nls") @@ -33,6 +35,8 @@ public class CalendarAlarmReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { + if (!Preferences.getBoolean(R.string.p_calendar_reminders, true)) + return; try { ContentResolver cr = context.getContentResolver(); long eventId = intent.getLongExtra(TOKEN_EVENT_ID, -1); diff --git a/astrid/plugin-src/com/todoroo/astrid/gcal/CalendarAlarmScheduler.java b/astrid/plugin-src/com/todoroo/astrid/gcal/CalendarAlarmScheduler.java index a3115328b..873ed9fb0 100644 --- a/astrid/plugin-src/com/todoroo/astrid/gcal/CalendarAlarmScheduler.java +++ b/astrid/plugin-src/com/todoroo/astrid/gcal/CalendarAlarmScheduler.java @@ -10,7 +10,9 @@ import android.content.Intent; import android.database.Cursor; import android.util.Log; +import com.timsu.astrid.R; import com.todoroo.andlib.utility.DateUtilities; +import com.todoroo.andlib.utility.Preferences; import com.todoroo.astrid.utility.Constants; @SuppressWarnings("nls") @@ -19,6 +21,9 @@ public class CalendarAlarmScheduler { public static final String TAG = "calendar-alarm"; public static void scheduleAllCalendarAlarms(Context context) { + if (!Preferences.getBoolean(R.string.p_calendar_reminders, true)) + return; + ContentResolver cr = context.getContentResolver(); long now = DateUtilities.now(); diff --git a/astrid/res/values/keys.xml b/astrid/res/values/keys.xml index dadb046a6..33896e9e6 100644 --- a/astrid/res/values/keys.xml +++ b/astrid/res/values/keys.xml @@ -49,6 +49,9 @@ field_missed_calls + + p_calendar_reminder + show_friends_view diff --git a/astrid/res/values/strings-core.xml b/astrid/res/values/strings-core.xml index 6a928f69f..b38807eb7 100644 --- a/astrid/res/values/strings-core.xml +++ b/astrid/res/values/strings-core.xml @@ -564,6 +564,9 @@ Share with event members + + Monitor calendar events + diff --git a/astrid/res/xml/preferences_misc.xml b/astrid/res/xml/preferences_misc.xml index acf97d683..6cf9ed6ba 100644 --- a/astrid/res/xml/preferences_misc.xml +++ b/astrid/res/xml/preferences_misc.xml @@ -17,6 +17,10 @@ android:key="@string/p_field_missed_calls" android:title="@string/MCA_missed_calls_pref_title"/> + + diff --git a/astrid/src/com/todoroo/astrid/service/abtesting/ABTests.java b/astrid/src/com/todoroo/astrid/service/abtesting/ABTests.java index f1effb503..2a1aa3272 100644 --- a/astrid/src/com/todoroo/astrid/service/abtesting/ABTests.java +++ b/astrid/src/com/todoroo/astrid/service/abtesting/ABTests.java @@ -121,10 +121,14 @@ public class ABTests { public static final String AB_SIMPLE_TASK_ROW = "android_simple_task_row"; //$NON-NLS-1$ + public static final String AB_CALENDAR_REMINDERS = "android_cal_reminders"; //$NON-NLS-1$ + private void initialize() { 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_CALENDAR_REMINDERS, new int[] { 0, 1 }, + new int[] { 0, 1 }, new String[] { "no-cal-reminders", "show-cal-reminders" }); //$NON-NLS-1$ //$NON-NLS-2$ } } diff --git a/astrid/src/com/todoroo/astrid/utility/AstridPreferences.java b/astrid/src/com/todoroo/astrid/utility/AstridPreferences.java index 991795675..65b6e8c4b 100644 --- a/astrid/src/com/todoroo/astrid/utility/AstridPreferences.java +++ b/astrid/src/com/todoroo/astrid/utility/AstridPreferences.java @@ -74,7 +74,8 @@ public class AstridPreferences { Preferences.setIfUnset(prefs, editor, r, R.string.p_taskRowStyle, ABChooser.readChoiceForTest(ABTests.AB_SIMPLE_TASK_ROW) != 0); - Preferences.setIfUnset(prefs, editor, r, R.string.p_swipe_lists_enabled, false); + Preferences.setIfUnset(prefs, editor, r, R.string.p_calendar_reminders, + ABChooser.readChoiceForTest(ABTests.AB_CALENDAR_REMINDERS) != 0); 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);