diff --git a/app/src/main/kotlin/com/simplemobiletools/camera/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/camera/activities/MainActivity.kt index 0fccad1f..af2ee8b3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/camera/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/camera/activities/MainActivity.kt @@ -97,7 +97,6 @@ class MainActivity : SimpleActivity(), PreviewListener, PhotoProcessor.MediaSave mFadeHandler.removeCallbacksAndMessages(null) hideTimer() - mPreview?.releaseCamera() mOrientationEventListener.disable() if (mPreview?.getCameraState() == STATE_PICTURE_TAKEN) { @@ -108,7 +107,6 @@ class MainActivity : SimpleActivity(), PreviewListener, PhotoProcessor.MediaSave override fun onDestroy() { super.onDestroy() - mPreview?.releaseCamera() mPreview = null } diff --git a/app/src/main/kotlin/com/simplemobiletools/camera/interfaces/MyPreview.kt b/app/src/main/kotlin/com/simplemobiletools/camera/interfaces/MyPreview.kt index dd9f4fcb..97e8b482 100644 --- a/app/src/main/kotlin/com/simplemobiletools/camera/interfaces/MyPreview.kt +++ b/app/src/main/kotlin/com/simplemobiletools/camera/interfaces/MyPreview.kt @@ -17,8 +17,6 @@ interface MyPreview { fun getCameraState(): Int - fun releaseCamera() - fun showChangeResolutionDialog() fun toggleFrontBackCamera() diff --git a/app/src/main/kotlin/com/simplemobiletools/camera/views/PreviewCameraOne.kt b/app/src/main/kotlin/com/simplemobiletools/camera/views/PreviewCameraOne.kt index e730de4d..122e97cc 100644 --- a/app/src/main/kotlin/com/simplemobiletools/camera/views/PreviewCameraOne.kt +++ b/app/src/main/kotlin/com/simplemobiletools/camera/views/PreviewCameraOne.kt @@ -115,7 +115,9 @@ class PreviewCameraOne : ViewGroup, SurfaceHolder.Callback, MyPreview { override fun onResumed() {} - override fun onPaused() {} + override fun onPaused() { + releaseCamera() + } override fun tryInitVideoMode() { if (mIsSurfaceCreated) { @@ -502,7 +504,7 @@ class PreviewCameraOne : ViewGroup, SurfaceHolder.Callback, MyPreview { } } - override fun releaseCamera() { + fun releaseCamera() { stopRecording() mCamera?.stopPreview() mCamera?.release() 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 c9a3b12f..c14ed197 100644 --- a/app/src/main/kotlin/com/simplemobiletools/camera/views/PreviewCameraTwo.kt +++ b/app/src/main/kotlin/com/simplemobiletools/camera/views/PreviewCameraTwo.kt @@ -403,9 +403,6 @@ class PreviewCameraTwo : ViewGroup, TextureView.SurfaceTextureListener, MyPrevie override fun getCameraState() = mCameraState - override fun releaseCamera() { - } - override fun showChangeResolutionDialog() { }