Skip to content

Commit

Permalink
Fixed some typos
Browse files Browse the repository at this point in the history
  • Loading branch information
danielgindi authored May 1, 2017
1 parent 713538e commit 52b0f34
Showing 1 changed file with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ public CameraSource start(SurfaceHolder surfaceHolder) throws IOException {
mCamera = createCamera();
mCamera.setPreviewDisplay(surfaceHolder);
mCamera.startPreview();

mCanTakePicture = true;

mProcessingThread = new Thread(mFrameProcessor);
Expand Down Expand Up @@ -429,7 +429,7 @@ public void stop() {

// clear the buffer to prevent oom exceptions
mBytesToByteBuffer.clear();

mCanTakePicture = false;

if (mCamera != null) {
Expand Down Expand Up @@ -532,9 +532,9 @@ public int doZoom(float scale) {
public void takePicture(ShutterCallback shutter, PictureCallback jpeg) {
synchronized (mCameraLock) {
if (mCamera != null && mCanTakePicture) {

mCanTakePicture = false; // Preview is suspended until we're done

PictureStartCallback startCallback = new PictureStartCallback();
startCallback.mDelegate = shutter;
PictureDoneCallback doneCallback = new PictureDoneCallback();
Expand Down Expand Up @@ -575,8 +575,8 @@ public boolean setFocusMode(@FocusMode String mode) {
synchronized (mCameraLock) {
if (mCamera != null && mode != null) {
Camera.Parameters parameters = mCamera.getParameters();
final List<String> supportedFlashModes = parameters.getSupportedFlashModes();
if (supportedFlashModes != null && supportedFlashModes.contains(mode)) {
final List<String> supportedFocusModes = parameters.getSupportedFlashModes();
if (supportedFocusModes != null && supportedFocusModes.contains(mode)) {
parameters.setFocusMode(mode);
mCamera.setParameters(parameters);
mFocusMode = mode;
Expand Down Expand Up @@ -629,6 +629,12 @@ public boolean setFlashMode(@FlashMode String mode) {
}
}

public boolean isModeSupported(String mode) {
Camera.Parameters parameters = mCamera.getParameters();
final List<String> supportedModes = parameters.getSupportedFlashModes();
return supportedModes != null && supportedModes.contains(mode);
}

/**
* Starts camera auto-focus and registers a callback function to run when
* the camera is focused. This method is only valid when preview is active
Expand Down Expand Up @@ -828,8 +834,8 @@ private Camera createCamera() {
setRotation(camera, parameters, mRequestedCameraId);

if (mFocusMode != null) {
final List<String> supportedFlashModes = parameters.getSupportedFlashModes();
if (supportedFlashModes != null && supportedFlashModes.contains(mFocusMode)) {
final List<String> supportedFocusModes = parameters.getSupportedFlashModes();
if (supportedFocusModes != null && supportedFocusModes.contains(mFocusMode)) {
parameters.setFocusMode(mFocusMode);
} else {
Log.i(TAG, "Camera focus mode: " + mFocusMode + " is not supported on this device.");
Expand Down

0 comments on commit 52b0f34

Please sign in to comment.