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.
pull/1/head
Yuval Peress 8 years ago
parent 4a6ef7659b
commit eec74133ed
  1. 4
      camerakit/src/main/api16/com/flurgle/camerakit/Camera1.java
  2. 5
      camerakit/src/main/java/com/flurgle/camerakit/CameraView.java

@ -214,7 +214,9 @@ public class Camera1 extends CameraImpl {
@Override @Override
public void onPictureTaken(byte[] data, Camera camera) { public void onPictureTaken(byte[] data, Camera camera) {
mCameraListener.onPictureTaken(data); mCameraListener.onPictureTaken(data);
camera.startPreview(); if (mCamera != null) {
mCamera.startPreview();
}
} }
}); });
break; break;

@ -330,6 +330,11 @@ public class CameraView extends FrameLayout implements LifecycleObserver {
mCameraImpl.setFlash(flash); mCameraImpl.setFlash(flash);
} }
@Flash
public int getFlash() {
return mFlash;
}
public void setFocus(@Focus int focus) { public void setFocus(@Focus int focus) {
this.mFocus = focus; this.mFocus = focus;
if (this.mFocus == CameraKit.Constants.FOCUS_TAP_WITH_MARKER) { if (this.mFocus == CameraKit.Constants.FOCUS_TAP_WITH_MARKER) {

Loading…
Cancel
Save