diff --git a/astrid/plugin-src/com/todoroo/astrid/core/LabsPreferences.java b/astrid/plugin-src/com/todoroo/astrid/core/LabsPreferences.java
index faccf1913..c9427ad65 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.Cal_end_at_due_time, R.string.Cal_start_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..cbf5d086b 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 - estimatedTime);
+ values.put("dtend", dueDate);
+ }else{
+ values.put("dtstart", dueDate);
+ values.put("dtend", dueDate + estimatedTime);
+ }
// 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..4168efa3a 100644
--- a/astrid/res/values/strings-core.xml
+++ b/astrid/res/values/strings-core.xml
@@ -656,6 +656,12 @@
- High Performance
+ Calendar Events
+ End Calendar Events at Due Time
+ Starts Calendar Events at Due Time
+
+
+
- Swipe between lists is disabled
diff --git a/astrid/res/xml/preferences_labs.xml b/astrid/res/xml/preferences_labs.xml
index 27aaff9ec..f4787d6ab 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..d07ea8f9d 100644
--- a/astrid/src/com/todoroo/astrid/service/abtesting/ABTests.java
+++ b/astrid/src/com/todoroo/astrid/service/abtesting/ABTests.java
@@ -114,7 +114,19 @@ 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 static final int[] calTestNewUserProbs = new int[] {1, 1};
+
+ private static final int[] calTestExistingUserProbs = new int[] {1, 1};
+
+ private static final String[] calTestDescriptions = new String[] {"Start at due time", "End at due time"}; //$NON-NLS-1$//$NON-NLS-2$
+
+
+
+
+ private void initialize() {
+ addTest(AB_TEST_CAL_KEY, calTestNewUserProbs, calTestExistingUserProbs, calTestDescriptions);
}
}
diff --git a/astrid/src/com/todoroo/astrid/utility/AstridPreferences.java b/astrid/src/com/todoroo/astrid/utility/AstridPreferences.java
index 9add885af..b87bad8a3 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);