minor update

This commit is contained in:
tibbi 2017-03-20 19:13:32 +01:00
parent 207bb44eed
commit 0eed22d749
1 changed files with 8 additions and 8 deletions

View File

@ -1,15 +1,15 @@
package com.simplemobiletools.camera.extensions
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 {
var degrees = 0
val isFrontCamera = currCameraId == Camera.CameraInfo.CAMERA_FACING_FRONT
if (this == Constants.ORIENT_LANDSCAPE_LEFT) {
degrees += if (isFrontCamera) 90 else 270
} else if (this == Constants.ORIENT_LANDSCAPE_RIGHT) {
degrees += if (isFrontCamera) 270 else 90
}
return degrees
return if (this == ORIENT_LANDSCAPE_LEFT) {
if (isFrontCamera) 90 else 270
} else if (this == ORIENT_LANDSCAPE_RIGHT) {
if (isFrontCamera) 270 else 90
} else
0
}