diff --git a/astrid/plugin-src/com/todoroo/astrid/core/LabsPreferences.java b/astrid/plugin-src/com/todoroo/astrid/core/LabsPreferences.java index faccf1913..7cad199fa 100644 --- a/astrid/plugin-src/com/todoroo/astrid/core/LabsPreferences.java +++ b/astrid/plugin-src/com/todoroo/astrid/core/LabsPreferences.java @@ -55,6 +55,8 @@ public class LabsPreferences extends TodorooPreferenceActivity { } else if (r.getString(R.string.p_third_party_addons).equals(key)) { setEnabledSummary(preference, value, R.string.EPr_third_party_addons_desc_enabled, R.string.EPr_third_party_addons_desc_disabled); + } else if (r.getString(R.string.p_end_at_deadline).equals(key)){ + setEnabledSummary(preference, value, R.string.EPr_cal_start_at_due_time, R.string.EPr_cal_end_at_due_time); } else if (r.getString(R.string.p_ideas_tab_enabled).equals(key)) { if (!Constants.MARKET_STRATEGY.allowIdeasTab()) { PreferenceScreen screen = getPreferenceScreen(); diff --git a/astrid/plugin-src/com/todoroo/astrid/gcal/GCalHelper.java b/astrid/plugin-src/com/todoroo/astrid/gcal/GCalHelper.java index b6f57a156..525bcb2f8 100644 --- a/astrid/plugin-src/com/todoroo/astrid/gcal/GCalHelper.java +++ b/astrid/plugin-src/com/todoroo/astrid/gcal/GCalHelper.java @@ -181,8 +181,13 @@ public class GCalHelper { long estimatedTime = task.getValue(Task.ESTIMATED_SECONDS) * 1000; if(estimatedTime <= 0) estimatedTime = DEFAULT_CAL_TIME; - values.put("dtstart", dueDate - estimatedTime); - values.put("dtend", dueDate); + if (Preferences.getBoolean(R.string.p_end_at_deadline, true)) { + values.put("dtstart", dueDate); + values.put("dtend", dueDate + estimatedTime); + }else{ + values.put("dtstart", dueDate - estimatedTime); + values.put("dtend", dueDate); + } // setting a duetime to a previously timeless event requires explicitly setting allDay=0 values.put("allDay", "0"); values.put("eventTimezone", TimeZone.getDefault().getID()); diff --git a/astrid/res/values/keys.xml b/astrid/res/values/keys.xml index 891fd7899..5347a322a 100644 --- a/astrid/res/values/keys.xml +++ b/astrid/res/values/keys.xml @@ -305,6 +305,9 @@ p_use_contact_picker + + p_end_at_deadline + -1 diff --git a/astrid/res/values/strings-core.xml b/astrid/res/values/strings-core.xml index 64ce8c49a..378188a0f 100644 --- a/astrid/res/values/strings-core.xml +++ b/astrid/res/values/strings-core.xml @@ -647,6 +647,12 @@ Task Ideas Get ideas to help you complete tasks + + Calendar event time + End calendar events at due time + Start calendar events at due time + + You will need to restart Astrid for this change to take effect @@ -656,6 +662,7 @@ High Performance + Swipe between lists is disabled diff --git a/astrid/res/xml/preferences_labs.xml b/astrid/res/xml/preferences_labs.xml index 27aaff9ec..46b20fbd2 100644 --- a/astrid/res/xml/preferences_labs.xml +++ b/astrid/res/xml/preferences_labs.xml @@ -22,4 +22,8 @@ android:key="@string/p_ideas_tab_enabled" android:title="@string/EPr_ideas_tab_enabled" android:summary="@string/EPr_ideas_tab_description" /> + + diff --git a/astrid/src/com/todoroo/astrid/service/abtesting/ABTests.java b/astrid/src/com/todoroo/astrid/service/abtesting/ABTests.java index d0f2dfba3..a8327c810 100644 --- a/astrid/src/com/todoroo/astrid/service/abtesting/ABTests.java +++ b/astrid/src/com/todoroo/astrid/service/abtesting/ABTests.java @@ -114,7 +114,10 @@ public class ABTests { bundles.put(testKey, bundle); } - private void initialize() { // Set up + public static final String AB_TEST_CAL_KEY = "cal_ab_test"; //$NON-NLS-1$ + private void initialize() { + addTest(AB_TEST_CAL_KEY, new int[] {1, 1}, new int[] {1, 1}, + new String[] {"end-at-due-time", "start-at-due-time"}); //$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 9add885af..f69221f68 100644 --- a/astrid/src/com/todoroo/astrid/utility/AstridPreferences.java +++ b/astrid/src/com/todoroo/astrid/utility/AstridPreferences.java @@ -15,6 +15,8 @@ import com.todoroo.astrid.core.PluginServices; import com.todoroo.astrid.data.Task; import com.todoroo.astrid.data.User; import com.todoroo.astrid.service.ThemeService; +import com.todoroo.astrid.service.abtesting.ABChooser; +import com.todoroo.astrid.service.abtesting.ABTests; public class AstridPreferences { @@ -57,6 +59,8 @@ public class AstridPreferences { Preferences.setIfUnset(prefs, editor, r, R.string.p_third_party_addons, false); Preferences.setIfUnset(prefs, editor, r, R.string.p_ideas_tab_enabled, true); + Preferences.setIfUnset(prefs, editor, r, R.string.p_end_at_deadline, + ABChooser.readChoiceForTest(ABTests.AB_TEST_CAL_KEY) != 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);