mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-20 22:59:54 +01:00
Use IoExecutor for background IO tasks.
This commit is contained in:
@@ -40,8 +40,10 @@ import org.briarproject.api.keyagreement.KeyAgreementTaskFactory;
|
|||||||
import org.briarproject.api.keyagreement.Payload;
|
import org.briarproject.api.keyagreement.Payload;
|
||||||
import org.briarproject.api.keyagreement.PayloadEncoder;
|
import org.briarproject.api.keyagreement.PayloadEncoder;
|
||||||
import org.briarproject.api.keyagreement.PayloadParser;
|
import org.briarproject.api.keyagreement.PayloadParser;
|
||||||
|
import org.briarproject.api.lifecycle.IoExecutor;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.concurrent.Executor;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
@@ -72,6 +74,9 @@ public class ShowQrCodeFragment extends BaseEventFragment
|
|||||||
protected PayloadParser payloadParser;
|
protected PayloadParser payloadParser;
|
||||||
@Inject
|
@Inject
|
||||||
protected AndroidExecutor androidExecutor;
|
protected AndroidExecutor androidExecutor;
|
||||||
|
@Inject
|
||||||
|
@IoExecutor
|
||||||
|
protected Executor ioExecutor;
|
||||||
|
|
||||||
private LinearLayout qrLayout;
|
private LinearLayout qrLayout;
|
||||||
private CameraView cameraView;
|
private CameraView cameraView;
|
||||||
@@ -179,21 +184,21 @@ public class ShowQrCodeFragment extends BaseEventFragment
|
|||||||
private void startListening() {
|
private void startListening() {
|
||||||
task = keyAgreementTaskFactory.getTask();
|
task = keyAgreementTaskFactory.getTask();
|
||||||
gotRemotePayload = false;
|
gotRemotePayload = false;
|
||||||
new Thread(new Runnable() {
|
ioExecutor.execute(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
task.listen();
|
task.listen();
|
||||||
}
|
}
|
||||||
}).start();
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void stopListening() {
|
private void stopListening() {
|
||||||
new Thread(new Runnable() {
|
ioExecutor.execute(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
task.stopListening();
|
task.stopListening();
|
||||||
}
|
}
|
||||||
}).start();
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void openCamera() {
|
private void openCamera() {
|
||||||
|
|||||||
Reference in New Issue
Block a user