OrientationUtil

Utility class for querying the device's orientation.

Functions

Link copied to clipboard

Calculates how far from the natural orientation the device currently is in degrees.

Link copied to clipboard

Calculates the current orientation of the device as either landscape or portrait.

Link copied to clipboard

Calculates the 'natural' orientation of the device, often Configuration.ORIENTATION_PORTRAIT for phones and Configuration.ORIENTATION_LANDSCAPE for tablets. NOTE: This value is fixed for the device, unlike its current orientation which changes depending on how the device is held.

Link copied to clipboard

Calculates the Surface.X in 0, 90, 180, 270 degrees off the 'natural' device orientation.

Link copied to clipboard
fun isDocumentAlignedWithImage(currentDeviceOrientation: Int, documentOrientation: Int, frameOrientation: Int): Boolean

Determines if the document's long side aligns with the device's long side.