From eec74133eddbfe1481b8dd231dcec8bd116af998 Mon Sep 17 00:00:00 2001 From: Yuval Peress Date: Mon, 12 Jun 2017 03:17:35 -0400 Subject: [PATCH] Fix crash for picture callback after stop() The callback is using the captured camera object instead of checking the mCamera object to verify that we haven't released yet. Also, added a getter for the flash property. --- camerakit/src/main/api16/com/flurgle/camerakit/Camera1.java | 4 +++- .../src/main/java/com/flurgle/camerakit/CameraView.java | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/camerakit/src/main/api16/com/flurgle/camerakit/Camera1.java b/camerakit/src/main/api16/com/flurgle/camerakit/Camera1.java index 84b0cc5b..956804f3 100644 --- a/camerakit/src/main/api16/com/flurgle/camerakit/Camera1.java +++ b/camerakit/src/main/api16/com/flurgle/camerakit/Camera1.java @@ -214,7 +214,9 @@ public class Camera1 extends CameraImpl { @Override public void onPictureTaken(byte[] data, Camera camera) { mCameraListener.onPictureTaken(data); - camera.startPreview(); + if (mCamera != null) { + mCamera.startPreview(); + } } }); break; diff --git a/camerakit/src/main/java/com/flurgle/camerakit/CameraView.java b/camerakit/src/main/java/com/flurgle/camerakit/CameraView.java index 5c73df1a..0e343171 100644 --- a/camerakit/src/main/java/com/flurgle/camerakit/CameraView.java +++ b/camerakit/src/main/java/com/flurgle/camerakit/CameraView.java @@ -330,6 +330,11 @@ public class CameraView extends FrameLayout implements LifecycleObserver { mCameraImpl.setFlash(flash); } + @Flash + public int getFlash() { + return mFlash; + } + public void setFocus(@Focus int focus) { this.mFocus = focus; if (this.mFocus == CameraKit.Constants.FOCUS_TAP_WITH_MARKER) {