Screen Info
Caution
This component has been deprecated and is no longer supported.
In order to retrieve information about the display area and folding feature, you should use the Jetpack Window Manager.
Alternatively, use one of these dual-screen controls and layouts that can automatically adapt to dual-screen and foldabe devices.
The ScreenInfo
component lets you get details about the screen state of the device.
getHinge - Returns the coordinates of the Hinge in a Rect object.
fun getHinge(context: Context): Rect?
isSurfaceDuoDevice - Check if the device is Surface Duo.
fun isSurfaceDuoDevice(context: Context): Boolean
getWindowRect - Returns coordinates of the entire device window.
fun getWindowRect(context: Context): Rect
getScreenRectangles - Returns the coordinates of the two screens of the device.
fun getScreenRectangles(context: Context): List<Rect>?
isDualMode - Check if the application is in dual-screen mode or not.
fun isDualMode(context: Context): Boolean
getCurrentRotation - Returns a constant int for the rotation of the screen.
According to the rotation the function will return: Surface.ROTATION_0
, Surface.ROTATION_90
, Surface.ROTATION_180
, Surface.ROTATION_270
.
fun getCurrentRotation(context: Context): Int