From 31d7ee2663eff74b05133ed4af68f97077b09004 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 7 Jun 2018 13:42:22 +0200 Subject: [PATCH] make sure we have a valid capture session at focusing and zooming --- .../com/simplemobiletools/camera/views/PreviewCameraTwo.kt | 3 ++- 1 file changed, 2 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 0998c89f..1c73f140 100644 --- a/app/src/main/kotlin/com/simplemobiletools/camera/views/PreviewCameraTwo.kt +++ b/app/src/main/kotlin/com/simplemobiletools/camera/views/PreviewCameraTwo.kt @@ -112,13 +112,14 @@ class PreviewCameraTwo : ViewGroup, TextureView.SurfaceTextureListener, MyPrevie mDownEventAtY = event.y } else if (event.action == MotionEvent.ACTION_UP) { if (mIsFocusSupported && System.currentTimeMillis() - mDownEventAtMS < CLICK_MS && + mCaptureSession != null && Math.abs(event.x - mDownEventAtX) < CLICK_DIST && Math.abs(event.y - mDownEventAtY) < CLICK_DIST) { focusArea(event.x, event.y) } } - if (mIsZoomSupported && event.pointerCount > 1) { + if (mIsZoomSupported && event.pointerCount > 1 && mCaptureSession != null) { handleZoom(event) } true