From 4d06be8b4dd4d0fd517a844a17267ef7357d3d3f Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 7 Jun 2018 23:36:33 +0200 Subject: [PATCH] fix focusing during recording --- .../simplemobiletools/camera/views/PreviewCameraTwo.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/camera/views/PreviewCameraTwo.kt b/app/src/main/kotlin/com/simplemobiletools/camera/views/PreviewCameraTwo.kt index 56efeb0e..9c83363b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/camera/views/PreviewCameraTwo.kt +++ b/app/src/main/kotlin/com/simplemobiletools/camera/views/PreviewCameraTwo.kt @@ -569,7 +569,15 @@ class PreviewCameraTwo : ViewGroup, TextureView.SurfaceTextureListener, MyPrevie } set(CaptureRequest.CONTROL_MODE, CameraMetadata.CONTROL_MODE_AUTO) - set(CaptureRequest.CONTROL_AF_TRIGGER, CameraMetadata.CONTROL_AF_TRIGGER_START) + + val trigger = if (mIsRecording) { + set(CaptureRequest.CONTROL_AF_MODE, CameraMetadata.CONTROL_AF_MODE_CONTINUOUS_VIDEO) + CameraMetadata.CONTROL_AF_TRIGGER_IDLE + } else { + CameraMetadata.CONTROL_AF_TRIGGER_START + } + + set(CaptureRequest.CONTROL_AF_TRIGGER, trigger) setTag(FOCUS_TAG) mCaptureSession!!.capture(build(), captureCallbackHandler, mBackgroundHandler) }