@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
private void setAutoFocusMoveCallback(
android.hardware.Camera camera, Object cb) {
- camera.setAutoFocusMoveCallback((AutoFocusMoveCallback) cb);
+ try {
+ camera.setAutoFocusMoveCallback((AutoFocusMoveCallback) cb);
+ } catch (RuntimeException ex) {
+ Log.w(TAG, ex.getMessage());
+ }
}
private void capture(final CaptureCallbacks cb) {
private class DispatchThread extends Thread {
- private Queue<Runnable> mJobQueue;
+ private final Queue<Runnable> mJobQueue;
private Boolean mIsEnded;
public DispatchThread() {
private static class WaitDoneBundle {
public Runnable mUnlockRunnable;
- private Object mWaitLock;
+ private final Object mWaitLock;
WaitDoneBundle() {
mWaitLock = new Object();
*/
public static AFCallbackForward getNewInstance(
Handler handler, CameraProxy camera, CameraAFCallback cb) {
- if (handler == null || camera == null || cb == null) return null;
+ if (handler == null || camera == null || cb == null) {
+ return null;
+ }
return new AFCallbackForward(handler, camera, cb);
}
*/
public static ErrorCallbackForward getNewInstance(
Handler handler, CameraProxy camera, CameraErrorCallback cb) {
- if (handler == null || camera == null || cb == null) return null;
+ if (handler == null || camera == null || cb == null) {
+ return null;
+ }
return new ErrorCallbackForward(handler, camera, cb);
}
*/
public static AFMoveCallbackForward getNewInstance(
Handler handler, CameraProxy camera, CameraAFMoveCallback cb) {
- if (handler == null || camera == null || cb == null) return null;
+ if (handler == null || camera == null || cb == null) {
+ return null;
+ }
return new AFMoveCallbackForward(handler, camera, cb);
}
*/
public static ShutterCallbackForward getNewInstance(
Handler handler, CameraProxy camera, CameraShutterCallback cb) {
- if (handler == null || camera == null || cb == null) return null;
+ if (handler == null || camera == null || cb == null) {
+ return null;
+ }
return new ShutterCallbackForward(handler, camera, cb);
}
*/
public static PictureCallbackForward getNewInstance(
Handler handler, CameraProxy camera, CameraPictureCallback cb) {
- if (handler == null || camera == null || cb == null) return null;
+ if (handler == null || camera == null || cb == null) {
+ return null;
+ }
return new PictureCallbackForward(handler, camera, cb);
}
*/
public static PreviewCallbackForward getNewInstance(
Handler handler, CameraProxy camera, CameraPreviewDataCallback cb) {
- if (handler == null || camera == null || cb == null) return null;
+ if (handler == null || camera == null || cb == null) {
+ return null;
+ }
return new PreviewCallbackForward(handler, camera, cb);
}
*/
public static FaceDetectionCallbackForward getNewInstance(
Handler handler, CameraProxy camera, CameraFaceDetectionCallback cb) {
- if (handler == null || camera == null || cb == null) return null;
+ if (handler == null || camera == null || cb == null) {
+ return null;
+ }
return new FaceDetectionCallbackForward(handler, camera, cb);
}