Skip to content
Snippets Groups Projects
Unverified Commit 0a088af0 authored by akwizgran's avatar akwizgran
Browse files

Use IoExecutor for background IO tasks.

parent c21854fb
No related branches found
No related tags found
No related merge requests found
......@@ -40,8 +40,10 @@ import org.briarproject.api.keyagreement.KeyAgreementTaskFactory;
import org.briarproject.api.keyagreement.Payload;
import org.briarproject.api.keyagreement.PayloadEncoder;
import org.briarproject.api.keyagreement.PayloadParser;
import org.briarproject.api.lifecycle.IoExecutor;
import java.io.IOException;
import java.util.concurrent.Executor;
import java.util.logging.Logger;
import javax.inject.Inject;
......@@ -72,6 +74,9 @@ public class ShowQrCodeFragment extends BaseEventFragment
protected PayloadParser payloadParser;
@Inject
protected AndroidExecutor androidExecutor;
@Inject
@IoExecutor
protected Executor ioExecutor;
private LinearLayout qrLayout;
private CameraView cameraView;
......@@ -179,21 +184,21 @@ public class ShowQrCodeFragment extends BaseEventFragment
private void startListening() {
task = keyAgreementTaskFactory.getTask();
gotRemotePayload = false;
new Thread(new Runnable() {
ioExecutor.execute(new Runnable() {
@Override
public void run() {
task.listen();
}
}).start();
});
}
private void stopListening() {
new Thread(new Runnable() {
ioExecutor.execute(new Runnable() {
@Override
public void run() {
task.stopListening();
}
}).start();
});
}
private void openCamera() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment