remove the standalone cancel autofocus function

This commit is contained in:
tibbi 2018-06-11 16:58:39 +02:00
parent d21124e3bc
commit f246a23440
1 changed files with 3 additions and 7 deletions

View File

@ -597,9 +597,11 @@ class PreviewCameraTwo : ViewGroup, TextureView.SurfaceTextureListener, MyPrevie
} }
} }
cancelAutoFocus()
mCaptureSession!!.stopRepeating() mCaptureSession!!.stopRepeating()
mPreviewRequestBuilder!!.apply { mPreviewRequestBuilder!!.apply {
set(CaptureRequest.CONTROL_AF_TRIGGER, CameraMetadata.CONTROL_AF_TRIGGER_IDLE)
mCaptureSession!!.capture(build(), mCaptureCallback, mBackgroundHandler)
// touch-to-focus inspired by OpenCamera // touch-to-focus inspired by OpenCamera
val characteristics = getCameraCharacteristics() val characteristics = getCameraCharacteristics()
if (characteristics.get(CameraCharacteristics.CONTROL_MAX_REGIONS_AF) >= 1) { if (characteristics.get(CameraCharacteristics.CONTROL_MAX_REGIONS_AF) >= 1) {
@ -618,12 +620,6 @@ class PreviewCameraTwo : ViewGroup, TextureView.SurfaceTextureListener, MyPrevie
} }
} }
private fun cancelAutoFocus() {
val cancelRequest = mPreviewRequestBuilder
cancelRequest!!.set(CaptureRequest.CONTROL_AF_TRIGGER, CameraMetadata.CONTROL_AF_TRIGGER_IDLE)
mCaptureSession!!.capture(cancelRequest.build(), null, mBackgroundHandler)
}
private fun convertAreaToMeteringRectangle(sensorRect: Rect, focusArea: FocusArea): MeteringRectangle { private fun convertAreaToMeteringRectangle(sensorRect: Rect, focusArea: FocusArea): MeteringRectangle {
val camera2Rect = convertRectToCamera2(sensorRect, focusArea.rect) val camera2Rect = convertRectToCamera2(sensorRect, focusArea.rect)
return MeteringRectangle(camera2Rect, focusArea.weight) return MeteringRectangle(camera2Rect, focusArea.weight)