DeviceParametersBuilders.DeviceParameters.Builder


class DeviceParametersBuilders.DeviceParameters.Builder


Builder for DeviceParameters

Summary

Public constructors

Creates an instance of Builder.

Public functions

DeviceParametersBuilders.DeviceParameters

Builds an instance from accumulated values.

DeviceParametersBuilders.DeviceParameters.Builder

Sets renderer supported Capabilities.

DeviceParametersBuilders.DeviceParameters.Builder
@RequiresSchemaVersion(major = 1, minor = 0)
setDevicePlatform(devicePlatform: Int)

Sets the platform of the device.

DeviceParametersBuilders.DeviceParameters.Builder
@RequiresSchemaVersion(major = 1, minor = 200)
setFontScale(
    fontScale: @FloatRange(from = 0.0, fromInclusive = false, toInclusive = false) Float
)

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

DeviceParametersBuilders.DeviceParameters.Builder
@RequiresSchemaVersion(major = 1, minor = 0)
setRendererSchemaVersion(
    rendererSchemaVersion: VersionBuilders.VersionInfo
)

Sets the maximum schema version supported by the current renderer.

DeviceParametersBuilders.DeviceParameters.Builder
@RequiresSchemaVersion(major = 1, minor = 0)
setScreenDensity(
    screenDensity: @FloatRange(from = 0.0, fromInclusive = false, toInclusive = false) Float
)

Sets density of the display.

DeviceParametersBuilders.DeviceParameters.Builder
@RequiresSchemaVersion(major = 1, minor = 0)
setScreenHeightDp(screenHeightDp: @Dimension(unit = 0) Int)

Sets height of the device's screen in DP.

DeviceParametersBuilders.DeviceParameters.Builder
@RequiresSchemaVersion(major = 1, minor = 0)
setScreenShape(screenShape: Int)

Sets the shape of the device's screen.

DeviceParametersBuilders.DeviceParameters.Builder
@RequiresSchemaVersion(major = 1, minor = 0)
setScreenWidthDp(screenWidthDp: @Dimension(unit = 0) Int)

Sets width of the device's screen in DP.

Public constructors

Builder

Added in 1.0.0
Builder()

Creates an instance of Builder.

Public functions

build

Added in 1.0.0
fun build(): DeviceParametersBuilders.DeviceParameters

Builds an instance from accumulated values.

setCapabilities

Added in 1.0.0
@RequiresSchemaVersion(major = 1, minor = 200)
@ProtoLayoutExperimental
fun setCapabilities(capabilities: DeviceParametersBuilders.Capabilities): DeviceParametersBuilders.DeviceParameters.Builder

Sets renderer supported Capabilities.

setDevicePlatform

Added in 1.0.0
@RequiresSchemaVersion(major = 1, minor = 0)
fun setDevicePlatform(devicePlatform: Int): DeviceParametersBuilders.DeviceParameters.Builder

Sets the platform of the device.

setFontScale

Added in 1.0.0
@RequiresSchemaVersion(major = 1, minor = 200)
fun setFontScale(
    fontScale: @FloatRange(from = 0.0, fromInclusive = false, toInclusive = false) Float
): DeviceParametersBuilders.DeviceParameters.Builder

Sets 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).

setRendererSchemaVersion

Added in 1.0.0
@RequiresSchemaVersion(major = 1, minor = 0)
fun setRendererSchemaVersion(
    rendererSchemaVersion: VersionBuilders.VersionInfo
): DeviceParametersBuilders.DeviceParameters.Builder

Sets 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.

setScreenDensity

Added in 1.0.0
@RequiresSchemaVersion(major = 1, minor = 0)
fun setScreenDensity(
    screenDensity: @FloatRange(from = 0.0, fromInclusive = false, toInclusive = false) Float
): DeviceParametersBuilders.DeviceParameters.Builder

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

setScreenHeightDp

Added in 1.0.0
@RequiresSchemaVersion(major = 1, minor = 0)
fun setScreenHeightDp(screenHeightDp: @Dimension(unit = 0) Int): DeviceParametersBuilders.DeviceParameters.Builder

Sets height of the device's screen in DP.

setScreenShape

Added in 1.0.0
@RequiresSchemaVersion(major = 1, minor = 0)
fun setScreenShape(screenShape: Int): DeviceParametersBuilders.DeviceParameters.Builder

Sets the shape of the device's screen.

setScreenWidthDp

Added in 1.0.0
@RequiresSchemaVersion(major = 1, minor = 0)
fun setScreenWidthDp(screenWidthDp: @Dimension(unit = 0) Int): DeviceParametersBuilders.DeviceParameters.Builder

Sets width of the device's screen in DP.