move the error with failed resolution setting to the moment of image capture
This commit is contained in:
parent
59da992442
commit
d04ed7d334
|
@ -84,6 +84,7 @@ class PhotoProcessor(val activity: MainActivity, val uri: Uri?, val currCameraId
|
||||||
} else {
|
} else {
|
||||||
matrix.preScale(-1f, 1f)
|
matrix.preScale(-1f, 1f)
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
image = Bitmap.createBitmap(image, 0, 0, image.width, image.height, matrix, false)
|
image = Bitmap.createBitmap(image, 0, 0, image.width, image.height, matrix, false)
|
||||||
} catch (e: OutOfMemoryError) {
|
} catch (e: OutOfMemoryError) {
|
||||||
|
|
|
@ -205,7 +205,6 @@ class Preview : ViewGroup, SurfaceHolder.Callback, MediaScannerConnection.OnScan
|
||||||
}.sortedByDescending { it.width * it.height }
|
}.sortedByDescending { it.width * it.height }
|
||||||
|
|
||||||
if (index == -1) {
|
if (index == -1) {
|
||||||
mActivity?.toast(R.string.setting_resolution_failed)
|
|
||||||
index = getDefaultFullscreenResolution(resolutions) ?: 0
|
index = getDefaultFullscreenResolution(resolutions) ?: 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -292,12 +291,15 @@ class Preview : ViewGroup, SurfaceHolder.Callback, MediaScannerConnection.OnScan
|
||||||
if (mCanTakePicture) {
|
if (mCanTakePicture) {
|
||||||
val selectedResolution = getSelectedResolution()
|
val selectedResolution = getSelectedResolution()
|
||||||
mParameters!!.setPictureSize(selectedResolution.width, selectedResolution.height)
|
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) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
||||||
mCamera!!.enableShutterSound(false)
|
mCamera!!.enableShutterSound(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
mRotationAtCapture = mActivity!!.mLastHandledOrientation
|
mRotationAtCapture = mActivity!!.mLastHandledOrientation
|
||||||
updateCameraParameters()
|
updateCameraParameters()
|
||||||
isWaitingForTakePictureCallback = true
|
isWaitingForTakePictureCallback = true
|
||||||
|
|
Loading…
Reference in New Issue