diff --git a/app/src/main/java/com/murrayc/galaxyzoo/app/ClassifyActivity.java b/app/src/main/java/com/murrayc/galaxyzoo/app/ClassifyActivity.java index afe1d8f7..5759008e 100644 --- a/app/src/main/java/com/murrayc/galaxyzoo/app/ClassifyActivity.java +++ b/app/src/main/java/com/murrayc/galaxyzoo/app/ClassifyActivity.java @@ -160,6 +160,10 @@ protected Boolean doInBackground(final Void... params) { return Boolean.FALSE; } + if (isCancelled()) { + return Boolean.FALSE; + } + return LoginUtils.getLoggedIn(context); } @@ -205,6 +209,10 @@ protected Void doInBackground(final Void... params) { return null; } + if (isCancelled()) { + return null; + } + final AccountManager mgr = AccountManager.get(context); //Note this needs the GET_ACCOUNTS permission on @@ -216,12 +224,15 @@ protected Void doInBackground(final Void... params) { return null; } + if (isCancelled()) { + return null; + } + final Account account = accts[0]; final Bundle extras = new Bundle(); extras.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true); - //Ask the framework to run our SyncAdapter. ContentResolver.requestSync(account, Item.AUTHORITY, extras); diff --git a/app/src/main/java/com/murrayc/galaxyzoo/app/LoginActivity.java b/app/src/main/java/com/murrayc/galaxyzoo/app/LoginActivity.java index 463749f9..90961525 100644 --- a/app/src/main/java/com/murrayc/galaxyzoo/app/LoginActivity.java +++ b/app/src/main/java/com/murrayc/galaxyzoo/app/LoginActivity.java @@ -315,6 +315,10 @@ protected Void doInBackground(final Void... params) { return null; } + if (isCancelled()) { + return null; + } + final String accountName = loginResult.getName(); final AccountManager accountManager = AccountManager.get(context); diff --git a/app/src/main/java/com/murrayc/galaxyzoo/app/LoginUtils.java b/app/src/main/java/com/murrayc/galaxyzoo/app/LoginUtils.java index 3d971315..2961fbc6 100644 --- a/app/src/main/java/com/murrayc/galaxyzoo/app/LoginUtils.java +++ b/app/src/main/java/com/murrayc/galaxyzoo/app/LoginUtils.java @@ -470,6 +470,10 @@ protected LoginDetails doInBackground(final Void... params) { return null; } + if (isCancelled()) { + return null; + } + LoginDetails result = null; try { @@ -517,6 +521,10 @@ protected Void doInBackground(final Void... params) { return null; } + if (isCancelled()) { + return null; + } + final LoginUtils.LoginDetails loginDetails = LoginUtils.getAccountLoginDetails(context); if(!LoginUtils.getLoggedIn(loginDetails)) { return null; @@ -527,6 +535,10 @@ protected Void doInBackground(final Void... params) { return null; } + if (isCancelled()) { + return null; + } + LoginUtils.removeAccount(context, accountName); LoginUtils.addAnonymousAccount(context); diff --git a/app/src/main/java/com/murrayc/galaxyzoo/app/QuestionFragment.java b/app/src/main/java/com/murrayc/galaxyzoo/app/QuestionFragment.java index c71963eb..8725a888 100644 --- a/app/src/main/java/com/murrayc/galaxyzoo/app/QuestionFragment.java +++ b/app/src/main/java/com/murrayc/galaxyzoo/app/QuestionFragment.java @@ -681,6 +681,10 @@ protected Void doInBackground(final Void... params) { return null; } + if (isCancelled()) { + return null; + } + fragment.saveClassificationSync(classificationInProgress); return null; diff --git a/app/src/main/java/com/murrayc/galaxyzoo/app/Singleton.java b/app/src/main/java/com/murrayc/galaxyzoo/app/Singleton.java index fd7b2604..c5a7e26d 100644 --- a/app/src/main/java/com/murrayc/galaxyzoo/app/Singleton.java +++ b/app/src/main/java/com/murrayc/galaxyzoo/app/Singleton.java @@ -318,6 +318,10 @@ protected Void doInBackground(final Context... params) { return null; } + if (isCancelled()) { + return null; + } + final Context context = params[0]; try { Singleton.ourInstance = new Singleton(context);