AndroidDeviceOrientation

AndroidDeviceOrientation class implements the DeviceOrientation interface to handle device orientation specifically for Android devices. This class retrieves the current orientation of the device (portrait, landscape, or unknown) based on the system configuration. It checks the device's orientation and provides properties and methods to determine whether the device is in portrait or landscape mode.

It uses the Resources.configuration.orientation property to determine the current orientation of the device.

Author

Swapnil Musale

See also

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
open override val isLandscape: Boolean

isLandscape checks if the device is currently in landscape mode

Link copied to clipboard
open override val isPortrait: Boolean

isPortrait checks if the device is currently in portrait mode

Link copied to clipboard
private val orientation: Int

orientation holds the current orientation of the device retrieved from the system configuration

Functions

Link copied to clipboard
open override fun getDeviceOrientation(): String

Method to get the current orientation of the device