Catch IllegalStateExceptions in progress callback

pull/189/head
Alex Baker 11 years ago
parent 4f03fe15e4
commit 4779b09031

@ -4,8 +4,13 @@ import android.support.v4.app.FragmentActivity;
import com.todoroo.astrid.sync.SyncResultCallback; import com.todoroo.astrid.sync.SyncResultCallback;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class IndeterminateProgressBarSyncResultCallback implements SyncResultCallback { public class IndeterminateProgressBarSyncResultCallback implements SyncResultCallback {
private static final Logger log = LoggerFactory.getLogger(IndeterminateProgressBarSyncResultCallback.class);
private final FragmentActivity activity; private final FragmentActivity activity;
private Runnable onFinished; private Runnable onFinished;
@ -19,8 +24,12 @@ public class IndeterminateProgressBarSyncResultCallback implements SyncResultCal
activity.runOnUiThread(new Runnable() { activity.runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
try {
activity.setProgressBarIndeterminateVisibility(false); activity.setProgressBarIndeterminateVisibility(false);
onFinished.run(); onFinished.run();
} catch (IllegalStateException e) {
log.error(e.getMessage(), e);
}
} }
}); });
} }
@ -30,7 +39,11 @@ public class IndeterminateProgressBarSyncResultCallback implements SyncResultCal
activity.runOnUiThread(new Runnable() { activity.runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
try {
activity.setProgressBarIndeterminateVisibility(true); activity.setProgressBarIndeterminateVisibility(true);
} catch (IllegalStateException e) {
log.error(e.getMessage(), e);
}
} }
}); });

Loading…
Cancel
Save