First part of BQP UI improvements.

Includes parallel improvements to Bluetooth key exchange UI.
This commit is contained in:
str4d
2016-04-01 03:24:24 +00:00
committed by akwizgran
parent 5f5ceedc29
commit b81a567468
22 changed files with 443 additions and 134 deletions

View File

@@ -97,8 +97,7 @@ public class CameraView extends SurfaceView implements SurfaceHolder.Callback,
try {
camera.setPreviewDisplay(holder);
camera.startPreview();
if (autoFocus) camera.autoFocus(this);
previewConsumer.start(camera);
startConsumer();
} catch (IOException | RuntimeException e) {
LOG.log(WARNING, "Error starting camera preview", e);
}
@@ -106,14 +105,23 @@ public class CameraView extends SurfaceView implements SurfaceHolder.Callback,
private void stopPreview() {
try {
previewConsumer.stop();
if (autoFocus) camera.cancelAutoFocus();
stopConsumer();
camera.stopPreview();
} catch (RuntimeException e) {
LOG.log(WARNING, "Error stopping camera preview", e);
}
}
public void startConsumer() {
if (autoFocus) camera.autoFocus(this);
previewConsumer.start(camera);
}
public void stopConsumer() {
previewConsumer.stop();
if (autoFocus) camera.cancelAutoFocus();
}
private void setDisplayOrientation(int rotationDegrees) {
int orientation;
CameraInfo info = new CameraInfo();
@@ -124,7 +132,7 @@ public class CameraView extends SurfaceView implements SurfaceHolder.Callback,
} else {
orientation = (info.orientation - rotationDegrees + 360) % 360;
}
if(LOG.isLoggable(INFO))
if (LOG.isLoggable(INFO))
LOG.info("Display orientation " + orientation + " degrees");
try {
camera.setDisplayOrientation(orientation);
@@ -211,7 +219,7 @@ public class CameraView extends SurfaceView implements SurfaceHolder.Callback,
}
}
if (bestSize != null) {
if(LOG.isLoggable(INFO))
if (LOG.isLoggable(INFO))
LOG.info("Best size " + bestSize.width + "x" + bestSize.height);
params.setPreviewSize(bestSize.width, bestSize.height);
}