From f0fb06f11101ecf66bcb8326059ca6f73565de7c Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 26 Feb 2018 12:31:11 +0100 Subject: [PATCH] show an Unknown error message if resolution selection failed --- .../main/kotlin/com/simplemobiletools/camera/views/Preview.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/camera/views/Preview.kt b/app/src/main/kotlin/com/simplemobiletools/camera/views/Preview.kt index 158139ab..1f431129 100644 --- a/app/src/main/kotlin/com/simplemobiletools/camera/views/Preview.kt +++ b/app/src/main/kotlin/com/simplemobiletools/camera/views/Preview.kt @@ -193,8 +193,9 @@ class Preview : ViewGroup, SurfaceHolder.Callback, MediaScannerConnection.OnScan } private fun getSelectedResolution(): Camera.Size { - if (mParameters == null) + if (mParameters == null) { mParameters = mCamera!!.parameters + } var index = getResolutionIndex() val resolutions = if (mIsVideoMode) { @@ -204,6 +205,7 @@ class Preview : ViewGroup, SurfaceHolder.Callback, MediaScannerConnection.OnScan }.sortedByDescending { it.width * it.height } if (index == -1) { + mActivity?.toast(R.string.unknown_error_occurred) index = getDefaultFullscreenResolution(resolutions) ?: 0 }