AndroidDisplayMetricsImpl

AndroidDisplayMetricsImpl class provides the implementation for the DisplayMetrics interface. This class retrieves and calculates the display metrics of an Android device, such as screen width, height, and DPI (dots per inch) values for both horizontal and vertical axes.

It uses the system's DisplayMetrics to get the raw pixel values and then calculates the screen dimensions in inches based on the DPI values.

Author

Swapnil Musale

See also

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard

displayMetrics holds the system's display metrics, which includes data like screen width, height, and DPI

Link copied to clipboard
open override val heightInches: Double

heightInches the height of the display in inches This value is calculated using the pixel height and vertical DPI

Link copied to clipboard
private val heightPx: Double

heightPx the height of the display in pixels

Link copied to clipboard
open override val widthInches: Double

widthInches the width of the display in inches This value is calculated using the pixel width and horizontal DPI

Link copied to clipboard
private val widthPx: Double

widthPx the width of the display in pixels

Link copied to clipboard
open override val xDpi: Double

xDpi the horizontal density of the display in dots per inch (DPI)

Link copied to clipboard
open override val yDpi: Double

yDpi the vertical density of the display in dots per inch (DPI)