From 9548d6621d6985e6752c12102d98e55a4ad964eb Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 10 Jul 2018 00:03:34 +0200 Subject: [PATCH] fix #171, try avoiding capturing rotated photos --- .../com/simplemobiletools/camera/views/PreviewCameraTwo.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 d682f7d9..e665f28c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/camera/views/PreviewCameraTwo.kt +++ b/app/src/main/kotlin/com/simplemobiletools/camera/views/PreviewCameraTwo.kt @@ -578,11 +578,12 @@ class PreviewCameraTwo : ViewGroup, TextureView.SurfaceTextureListener, MyPrevie mCameraState = STATE_PICTURE_TAKEN mRotationAtCapture = mActivity.mLastHandledOrientation + val jpegOrientation = (mSensorOrientation + compensateDeviceRotation(mRotationAtCapture, mUseFrontCamera)) % 360 val captureBuilder = mCameraDevice!!.createCaptureRequest(CameraDevice.TEMPLATE_STILL_CAPTURE).apply { addTarget(mImageReader!!.surface) setFlashAndExposure(this) set(CaptureRequest.CONTROL_AF_MODE, CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE) - set(CaptureRequest.JPEG_ORIENTATION, mSensorOrientation) + set(CaptureRequest.JPEG_ORIENTATION, jpegOrientation) set(CaptureRequest.CONTROL_CAPTURE_INTENT, CaptureRequest.CONTROL_CAPTURE_INTENT_STILL_CAPTURE) set(CaptureRequest.CONTROL_AE_TARGET_FPS_RANGE, getFrameRange()) if (mZoomRect != null) {