Commit 1af07e5d authored by Geoffrey Métais's avatar Geoffrey Métais

Synchronize client connection

parent 48af3512
......@@ -238,7 +238,6 @@ public class MediaUtils {
private static class DialogCallback extends BaseCallBack {
private final ProgressDialog dialog;
private final Runnable mRunnable;
private boolean performAction = true;
private interface Runnable {
void run(PlaybackService service);
......@@ -256,23 +255,19 @@ public class MediaUtils {
@Override
public void onCancel(DialogInterface dialog) {
synchronized (this) {
if (performAction)
performAction = false;
else
mClient.disconnect();
mClient.disconnect();
}
}
});
mClient.connect();
synchronized (this) {
mClient.connect();
}
}
@Override
public void onConnected(PlaybackService service) {
synchronized (this) {
if (performAction) {
performAction = false;
mRunnable.run(service);
}
mRunnable.run(service);
}
dialog.cancel();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment