minor update

This commit is contained in:
tibbi 2017-03-20 19:13:32 +01:00
parent 207bb44eed
commit 0eed22d749

View File

@ -1,15 +1,15 @@
package com.simplemobiletools.camera.extensions package com.simplemobiletools.camera.extensions
import android.hardware.Camera import android.hardware.Camera
import com.simplemobiletools.camera.Constants import com.simplemobiletools.camera.ORIENT_LANDSCAPE_LEFT
import com.simplemobiletools.camera.ORIENT_LANDSCAPE_RIGHT
fun Int.compensateDeviceRotation(currCameraId: Int): Int { fun Int.compensateDeviceRotation(currCameraId: Int): Int {
var degrees = 0
val isFrontCamera = currCameraId == Camera.CameraInfo.CAMERA_FACING_FRONT val isFrontCamera = currCameraId == Camera.CameraInfo.CAMERA_FACING_FRONT
if (this == Constants.ORIENT_LANDSCAPE_LEFT) { return if (this == ORIENT_LANDSCAPE_LEFT) {
degrees += if (isFrontCamera) 90 else 270 if (isFrontCamera) 90 else 270
} else if (this == Constants.ORIENT_LANDSCAPE_RIGHT) { } else if (this == ORIENT_LANDSCAPE_RIGHT) {
degrees += if (isFrontCamera) 270 else 90 if (isFrontCamera) 270 else 90
} } else
return degrees 0
} }