DeviceParametersBuilders.DeviceParameters


@RequiresSchemaVersion(major = 1, minor = 0)
class DeviceParametersBuilders.DeviceParameters


Parameters describing the device requesting a layout update. This contains physical and logical characteristics about the device (e.g. screen size and density, etc).

Summary

Public functions

DeviceParametersBuilders.Capabilities?

Gets renderer supported Capabilities.

Int

Gets the platform of the device.

@FloatRange(from = 0.0, fromInclusive = false, toInclusive = false) Float

Gets current user preference for the scaling factor for fonts displayed on the display.

VersionBuilders.VersionInfo

Gets the maximum schema version supported by the current renderer.

@FloatRange(from = 0.0, fromInclusive = false, toInclusive = false) Float

Gets density of the display.

@Dimension(unit = 0) Int

Gets height of the device's screen in DP.

Int

Gets the shape of the device's screen.

@Dimension(unit = 0) Int

Gets width of the device's screen in DP.

String

Public functions

getCapabilities

Added in 1.0.0
@ProtoLayoutExperimental
fun getCapabilities(): DeviceParametersBuilders.Capabilities?

Gets renderer supported Capabilities.

getDevicePlatform

Added in 1.0.0
fun getDevicePlatform(): Int

Gets the platform of the device.

getFontScale

Added in 1.0.0
fun getFontScale(): @FloatRange(from = 0.0, fromInclusive = false, toInclusive = false) Float

Gets current user preference for the scaling factor for fonts displayed on the display. This value is used to get from SP to DP (dp = sp * font_scale).

getRendererSchemaVersion

Added in 1.0.0
fun getRendererSchemaVersion(): VersionBuilders.VersionInfo

Gets the maximum schema version supported by the current renderer. When building a layout that uses features not available on schema version 1.0 , this can be used to conditionally choose which feature to use.

getScreenDensity

Added in 1.0.0
fun getScreenDensity(): @FloatRange(from = 0.0, fromInclusive = false, toInclusive = false) Float

Gets density of the display. This value is the scaling factor to get from DP to Pixels (px = dp * density).

getScreenHeightDp

Added in 1.0.0
fun getScreenHeightDp(): @Dimension(unit = 0) Int

Gets height of the device's screen in DP.

getScreenShape

Added in 1.0.0
fun getScreenShape(): Int

Gets the shape of the device's screen.

getScreenWidthDp

Added in 1.0.0
fun getScreenWidthDp(): @Dimension(unit = 0) Int

Gets width of the device's screen in DP.

toString

fun toString(): String