Device Orientation Mapper

Defined in package com.scandit.datacapture.core.ui.orientation

DeviceOrientation

Added in version 6.7.0

This enum represents the rotation state of the current device, taking into consideration its natural orientation. This can be thought of as the orientation in relation to the lower chin of the device when in vertical position. The rotation cycle this creates is the following when clockwise: Portrait -> LandscapeLeft -> Portrait Upside Down -> Landscape Right and the other way around when counter-clockwise.

Notice that the entry point of the cycle may be different depending on the device default orientation: * A device which defaults a rectangular screen’s ui to vertical, will enter the rotation cycle above from the PORTRAIT state. Rotating the device clockwise will change the orientation to LANDSCAPE_LEFT, rotating it one more time ( if the device allows ) will change the orientation to PORTRAIT_UPSIDE_DOWN and so on. * A device which defaults a rectangular screen’s ui to horizontal, will enter the rotation cycle above from the LANDSCAPE_RIGHT state. Rotating the device clockwise will change the orientation to PORTRAIT, rotating it one more time will change the orientation to LANDSCAPE_LEFT and so on.

Note

The second example may apply also to tablets which have hardware navigation buttons on the long side. This means that when the device is in PORTRAIT those buttons will be on the left side.

PORTRAIT

Added in version 6.7.0

The device is in Portrait orientation.

LANDSCAPE_RIGHT

Added in version 6.7.0

The device is in Landscape Right orientation.

PORTRAIT_UPSIDE_DOWN

Added in version 6.7.0

The device is in Upside Down Portrait orientation.

LANDSCAPE_LEFT

Added in version 6.7.0

The device is in Landscape Left orientation.

DeviceOrientationMapper
class DeviceOrientationMapper

Added in version 6.7.0

A mapper to infer the device orientation from the screen rotation. Particularly useful in combination with DataCaptureViewListener.onSizeChanged() to react to orientation changes.

DeviceOrientationMapper()
DeviceOrientationMapper()

Added in version 6.7.0

Constructs a new DeviceOrientationMapper instance.

mapRotationToOrientation(rotation)
DeviceOrientation mapRotationToOrientation(
        int rotation)

Added in version 6.7.0

Maps the screen rotation (for example provided in DataCaptureViewListener.onSizeChanged()) to a device orientation.