diff --git a/astrid/plugin-src/com/todoroo/astrid/actfm/ActFmPreferences.java b/astrid/plugin-src/com/todoroo/astrid/actfm/ActFmPreferences.java
index 3980ae393..1e5fb59a3 100644
--- a/astrid/plugin-src/com/todoroo/astrid/actfm/ActFmPreferences.java
+++ b/astrid/plugin-src/com/todoroo/astrid/actfm/ActFmPreferences.java
@@ -1,5 +1,6 @@
package com.todoroo.astrid.actfm;
+import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.Resources;
import android.preference.Preference;
@@ -7,8 +8,10 @@ import android.preference.PreferenceCategory;
import com.timsu.astrid.R;
import com.todoroo.andlib.service.Autowired;
+import com.todoroo.andlib.utility.DialogUtilities;
import com.todoroo.astrid.actfm.sync.ActFmPreferenceService;
import com.todoroo.astrid.actfm.sync.ActFmSyncV2Provider;
+import com.todoroo.astrid.gtasks.GtasksPreferenceService;
import com.todoroo.astrid.sync.SyncProviderPreferences;
import com.todoroo.astrid.sync.SyncProviderUtilities;
@@ -22,6 +25,7 @@ import com.todoroo.astrid.sync.SyncProviderUtilities;
public class ActFmPreferences extends SyncProviderPreferences {
@Autowired ActFmPreferenceService actFmPreferenceService;
+ @Autowired GtasksPreferenceService gtasksPreferenceService;
@Override
public int getPreferenceResource() {
@@ -31,14 +35,28 @@ public class ActFmPreferences extends SyncProviderPreferences {
@Override
public void startSync() {
if (!actFmPreferenceService.isLoggedIn()) {
- Intent intent = new Intent(this, ActFmLoginActivity.class);
- startActivityForResult(intent, REQUEST_LOGIN);
+ if (gtasksPreferenceService.isLoggedIn()) {
+ DialogUtilities.okCancelDialog(this, getString(R.string.DLG_warning), getString(R.string.actfm_dual_sync_warning),
+ new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ startLogin();
+ }
+ }, null);
+ } else {
+ startLogin();
+ }
} else {
setResult(RESULT_CODE_SYNCHRONIZE);
finish();
}
}
+ private void startLogin() {
+ Intent intent = new Intent(this, ActFmLoginActivity.class);
+ startActivityForResult(intent, REQUEST_LOGIN);
+ }
+
@Override
public void logOut() {
new ActFmSyncV2Provider().signOut();
diff --git a/astrid/plugin-src/com/todoroo/astrid/gtasks/GtasksPreferences.java b/astrid/plugin-src/com/todoroo/astrid/gtasks/GtasksPreferences.java
index 48ea5f42e..6209bfaa9 100644
--- a/astrid/plugin-src/com/todoroo/astrid/gtasks/GtasksPreferences.java
+++ b/astrid/plugin-src/com/todoroo/astrid/gtasks/GtasksPreferences.java
@@ -1,11 +1,14 @@
package com.todoroo.astrid.gtasks;
+import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import com.timsu.astrid.R;
import com.todoroo.andlib.service.Autowired;
import com.todoroo.andlib.service.DependencyInjectionService;
+import com.todoroo.andlib.utility.DialogUtilities;
+import com.todoroo.astrid.actfm.sync.ActFmPreferenceService;
import com.todoroo.astrid.gtasks.auth.GtasksLoginActivity;
import com.todoroo.astrid.gtasks.sync.GtasksSyncV2Provider;
import com.todoroo.astrid.sync.SyncProviderPreferences;
@@ -21,6 +24,7 @@ import com.todoroo.astrid.sync.SyncProviderUtilities;
public class GtasksPreferences extends SyncProviderPreferences {
@Autowired private GtasksPreferenceService gtasksPreferenceService;
+ @Autowired private ActFmPreferenceService actFmPreferenceService;
public GtasksPreferences() {
super();
@@ -40,14 +44,28 @@ public class GtasksPreferences extends SyncProviderPreferences {
@Override
public void startSync() {
if (!gtasksPreferenceService.isLoggedIn()) {
- Intent intent = new Intent(this, GtasksLoginActivity.class);
- startActivityForResult(intent, REQUEST_LOGIN);
+ if (actFmPreferenceService.isLoggedIn()) {
+ DialogUtilities.okCancelDialog(this, getString(R.string.DLG_warning), getString(R.string.gtasks_dual_sync_warning),
+ new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ startLogin();
+ }
+ }, null);
+ } else {
+ startLogin();
+ }
} else {
setResult(RESULT_CODE_SYNCHRONIZE);
finish();
}
}
+ private void startLogin() {
+ Intent intent = new Intent(this, GtasksLoginActivity.class);
+ startActivityForResult(intent, REQUEST_LOGIN);
+ }
+
@Override
public void logOut() {
GtasksSyncV2Provider.getInstance().signOut();
diff --git a/astrid/res/values/strings-actfm.xml b/astrid/res/values/strings-actfm.xml
index 43415617a..7fc6d3fb0 100644
--- a/astrid/res/values/strings-actfm.xml
+++ b/astrid/res/values/strings-actfm.xml
@@ -287,5 +287,9 @@
New comments received / click for more details
+ You are currently synchronizing with Google Tasks.
+ Be advised that synchronizing with both services can in some cases lead to unexpected results.
+ Are you sure you want to sync with Astrid.com?
+
diff --git a/astrid/res/values/strings-core.xml b/astrid/res/values/strings-core.xml
index 4c806f404..5742df960 100644
--- a/astrid/res/values/strings-core.xml
+++ b/astrid/res/values/strings-core.xml
@@ -67,6 +67,8 @@
Undo
+ Warning
+
diff --git a/astrid/res/values/strings-gtasks.xml b/astrid/res/values/strings-gtasks.xml
index 9c3c3f65d..e9754ebb3 100644
--- a/astrid/res/values/strings-gtasks.xml
+++ b/astrid/res/values/strings-gtasks.xml
@@ -104,6 +104,9 @@
Error authenticating in background. Please try initiating a sync while Astrid is running.
+ You are currently synchronizing with Astrid.com.
+ Be advised that synchronizing with both services can in some cases lead to unexpected results.
+ Are you sure you want to sync with Google Tasks?