From 619366807b5df55050a87f008ddf564097827b8d Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 16 May 2020 17:39:13 +0200 Subject: [PATCH] catching an exceptions at focusing some area --- .../com/simplemobiletools/camera/views/CameraPreview.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/camera/views/CameraPreview.kt b/app/src/main/kotlin/com/simplemobiletools/camera/views/CameraPreview.kt index 581482cd..f5ca875e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/camera/views/CameraPreview.kt +++ b/app/src/main/kotlin/com/simplemobiletools/camera/views/CameraPreview.kt @@ -628,7 +628,11 @@ class CameraPreview : ViewGroup, TextureView.SurfaceTextureListener, MyPreview { } } - mCaptureSession!!.stopRepeating() + try { + mCaptureSession!!.stopRepeating() + } catch (ignored: Exception) { + } + mPreviewRequestBuilder!!.apply { set(CaptureRequest.CONTROL_AF_TRIGGER, CameraMetadata.CONTROL_AF_TRIGGER_IDLE) mCaptureSession!!.capture(build(), mCaptureCallback, mBackgroundHandler) @@ -775,7 +779,7 @@ class CameraPreview : ViewGroup, TextureView.SurfaceTextureListener, MyPreview { val uri = if (context.isPathOnSD(mLastVideoPath)) { val parentDocumentFile = context.getDocumentFile(mLastVideoPath.getParentPath()) val documentFile = parentDocumentFile?.createFile("video/mp4", mLastVideoPath.getFilenameFromPath()) - ?: mActivity.getDocumentFile(mLastVideoPath) + ?: mActivity.getDocumentFile(mLastVideoPath) documentFile!!.uri } else { Uri.fromFile(File(mLastVideoPath))