DeviceState
class DeviceState
kotlin.Any | |
↳ | androidx.window.DeviceState |
Information about the state of the device.
Currently only includes the description of the state for foldable devices.
Summary
Nested classes | |
---|---|
Builder for |
Constants | |
---|---|
static Int |
The foldable device is closed, its primary screen area is not accessible. |
static Int |
The foldable device is flipped with the flexible screen parts or physical screens facing opposite directions. |
static Int |
The foldable device's hinge is in an intermediate position between opened and closed state, there is a non-flat angle between parts of the flexible screen or between physical screen panels. |
static Int |
The foldable device is completely open, the screen space that is presented to the user is flat. |
static Int |
Unknown state of the device. |
Public methods | |
---|---|
Int |
Get the posture of a foldable device with a flexible screen or multiple physical screens. |
String |
toString() |
Constants
POSTURE_CLOSED
static val POSTURE_CLOSED: Int
The foldable device is closed, its primary screen area is not accessible.
Value: 1
POSTURE_FLIPPED
static val POSTURE_FLIPPED: Int
The foldable device is flipped with the flexible screen parts or physical screens facing opposite directions. ________________ *________________
Value: 4
POSTURE_HALF_OPENED
static val POSTURE_HALF_OPENED: Int
The foldable device's hinge is in an intermediate position between opened and closed state, there is a non-flat angle between parts of the flexible screen or between physical screen panels. | | | | | *________________
Value: 2
POSTURE_OPENED
static val POSTURE_OPENED: Int
The foldable device is completely open, the screen space that is presented to the user is flat. ________________ ________________ *
Value: 3
POSTURE_UNKNOWN
static val POSTURE_UNKNOWN: Int
Unknown state of the device. May mean that either this device doesn't support different postures or doesn't provide any information about its state at all.
Value: 0
Public methods
getPosture
fun getPosture(): Int
Get the posture of a foldable device with a flexible screen or multiple physical screens. Devices with a single rigid display will always report POSTURE_UNKNOWN
.
toString
@NonNull fun toString(): String