diff --git a/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmSyncThread.java b/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmSyncThread.java index 8fc756ad2..38c1d83b5 100644 --- a/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmSyncThread.java +++ b/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmSyncThread.java @@ -3,9 +3,11 @@ package com.todoroo.astrid.actfm.sync; import java.io.IOException; import java.util.Collections; import java.util.HashMap; +import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Map; +import java.util.Set; import org.json.JSONArray; import org.json.JSONObject; @@ -267,17 +269,13 @@ public class ActFmSyncThread { batchSize = Math.max(batchSize / 2, 1); } - boolean didDefaultRefreshThisLoop = false; + Set callbacksExecutedThisLoop = new HashSet(); for (ClientToServerMessage message : messageBatch) { try { Runnable r = pendingCallbacks.remove(message); - if (r != null) { - if (r == DEFAULT_REFRESH_RUNNABLE) { - if (didDefaultRefreshThisLoop) - continue; - didDefaultRefreshThisLoop = true; - } + if (r != null && !callbacksExecutedThisLoop.contains(r)) { r.run(); + callbacksExecutedThisLoop.add(r); } } catch (Exception e) { Log.e(ERROR_TAG, "Unexpected exception executing sync callback", e); diff --git a/astrid/src/com/todoroo/astrid/helper/ProgressBarSyncResultCallback.java b/astrid/src/com/todoroo/astrid/helper/ProgressBarSyncResultCallback.java index ded758c02..8ee2664d0 100644 --- a/astrid/src/com/todoroo/astrid/helper/ProgressBarSyncResultCallback.java +++ b/astrid/src/com/todoroo/astrid/helper/ProgressBarSyncResultCallback.java @@ -37,16 +37,6 @@ public class ProgressBarSyncResultCallback extends SyncResultCallbackAdapter { progressBar.setMax(0); } - public ProgressBarSyncResultCallback(Activity activity, ProgressBar pBar, - Runnable onFinished) { - this.progressBar = pBar; - this.activity = activity; - this.onFinished = onFinished; - - progressBar.setProgress(0); - progressBar.setMax(0); - } - @Override public void finished() { if(providers.decrementAndGet() == 0) {