diff --git a/app/src/main/kotlin/com/simplemobiletools/camera/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/camera/helpers/Constants.kt index 66c59abe..8a2d4d52 100644 --- a/app/src/main/kotlin/com/simplemobiletools/camera/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/camera/helpers/Constants.kt @@ -38,9 +38,8 @@ const val STATE_STARTING_RECORDING = 6 const val STATE_STOPING_RECORDING = 7 const val STATE_RECORDING = 8 -fun compensateDeviceRotation(orientation: Int, isUsingFrontCamera: Boolean) = when { - orientation == ORIENT_LANDSCAPE_LEFT -> 270 - orientation == ORIENT_LANDSCAPE_RIGHT -> 90 - isUsingFrontCamera -> 180 +fun compensateDeviceRotation(orientation: Int) = when (orientation) { + ORIENT_LANDSCAPE_LEFT -> 270 + ORIENT_LANDSCAPE_RIGHT -> 90 else -> 0 } diff --git a/app/src/main/kotlin/com/simplemobiletools/camera/helpers/PhotoProcessor.kt b/app/src/main/kotlin/com/simplemobiletools/camera/helpers/PhotoProcessor.kt index d1d395e0..28d3a4d9 100644 --- a/app/src/main/kotlin/com/simplemobiletools/camera/helpers/PhotoProcessor.kt +++ b/app/src/main/kotlin/com/simplemobiletools/camera/helpers/PhotoProcessor.kt @@ -79,7 +79,7 @@ class PhotoProcessor(val activity: MainActivity, val saveUri: Uri?, val deviceOr val imageRot = orient.degreesFromOrientation() - val deviceRot = compensateDeviceRotation(deviceOrientation, isUsingFrontCamera) + val deviceRot = compensateDeviceRotation(deviceOrientation) var image = BitmapFactory.decodeByteArray(data, 0, data.size) val totalRotation = (imageRot + deviceRot + previewRotation) % 360 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 41b43a0f..87768743 100644 --- a/app/src/main/kotlin/com/simplemobiletools/camera/views/CameraPreview.kt +++ b/app/src/main/kotlin/com/simplemobiletools/camera/views/CameraPreview.kt @@ -568,7 +568,7 @@ class CameraPreview : ViewGroup, TextureView.SurfaceTextureListener, MyPreview { mCameraState = STATE_PICTURE_TAKEN mRotationAtCapture = mActivity.mLastHandledOrientation - val jpegOrientation = (mSensorOrientation + compensateDeviceRotation(mRotationAtCapture, mUseFrontCamera)) % 360 + val jpegOrientation = (mSensorOrientation + compensateDeviceRotation(mRotationAtCapture)) % 360 val captureBuilder = mCameraDevice!!.createCaptureRequest(CameraDevice.TEMPLATE_STILL_CAPTURE).apply { addTarget(mImageReader!!.surface) setFlashAndExposure(this)