move the error with failed resolution setting to the moment of image capture

This commit is contained in:
tibbi 2018-02-26 16:33:31 +01:00
parent 59da992442
commit d04ed7d334
2 changed files with 5 additions and 2 deletions

View File

@ -84,6 +84,7 @@ class PhotoProcessor(val activity: MainActivity, val uri: Uri?, val currCameraId
} else {
matrix.preScale(-1f, 1f)
}
try {
image = Bitmap.createBitmap(image, 0, 0, image.width, image.height, matrix, false)
} catch (e: OutOfMemoryError) {

View File

@ -205,7 +205,6 @@ class Preview : ViewGroup, SurfaceHolder.Callback, MediaScannerConnection.OnScan
}.sortedByDescending { it.width * it.height }
if (index == -1) {
mActivity?.toast(R.string.setting_resolution_failed)
index = getDefaultFullscreenResolution(resolutions) ?: 0
}
@ -292,12 +291,15 @@ class Preview : ViewGroup, SurfaceHolder.Callback, MediaScannerConnection.OnScan
if (mCanTakePicture) {
val selectedResolution = getSelectedResolution()
mParameters!!.setPictureSize(selectedResolution.width, selectedResolution.height)
val pictureSize = mParameters!!.pictureSize
if (selectedResolution.width != pictureSize.width || selectedResolution.height != pictureSize.height) {
mActivity!!.toast(R.string.setting_resolution_failed)
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
mCamera!!.enableShutterSound(false)
}
mRotationAtCapture = mActivity!!.mLastHandledOrientation
updateCameraParameters()
isWaitingForTakePictureCallback = true