DeviceParametersBuilders.DeviceParameters.Builder


public final class DeviceParametersBuilders.DeviceParameters.Builder


Builder for DeviceParameters

Summary

Public constructors

Creates an instance of Builder.

Public methods

@NonNull DeviceParametersBuilders.DeviceParameters

Builds an instance from accumulated values.

@NonNull DeviceParametersBuilders.DeviceParameters.Builder

Sets renderer supported Capabilities.

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

Sets the platform of the device.

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

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

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

Sets the maximum schema version supported by the current renderer.

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

Sets density of the display.

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

Sets height of the device's screen in DP.

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

Sets the shape of the device's screen.

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

Sets width of the device's screen in DP.

Public constructors

Builder

Added in 1.0.0
public Builder()

Creates an instance of Builder.

Public methods

build

Added in 1.0.0
public @NonNull DeviceParametersBuilders.DeviceParameters build()

Builds an instance from accumulated values.

setCapabilities

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

Sets renderer supported Capabilities.

setDevicePlatform

Added in 1.0.0
@RequiresSchemaVersion(major = 1, minor = 0)
public @NonNull DeviceParametersBuilders.DeviceParameters.Builder setDevicePlatform(int devicePlatform)

Sets the platform of the device.

setFontScale

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

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)
public @NonNull DeviceParametersBuilders.DeviceParameters.Builder setRendererSchemaVersion(
    @NonNull VersionBuilders.VersionInfo rendererSchemaVersion
)

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)
public @NonNull DeviceParametersBuilders.DeviceParameters.Builder setScreenDensity(
    @FloatRange(from = 0.0, fromInclusive = false, toInclusive = false) float screenDensity
)

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)
public @NonNull DeviceParametersBuilders.DeviceParameters.Builder setScreenHeightDp(@Dimension(unit = 0) int screenHeightDp)

Sets height of the device's screen in DP.

setScreenShape

Added in 1.0.0
@RequiresSchemaVersion(major = 1, minor = 0)
public @NonNull DeviceParametersBuilders.DeviceParameters.Builder setScreenShape(int screenShape)

Sets the shape of the device's screen.

setScreenWidthDp

Added in 1.0.0
@RequiresSchemaVersion(major = 1, minor = 0)
public @NonNull DeviceParametersBuilders.DeviceParameters.Builder setScreenWidthDp(@Dimension(unit = 0) int screenWidthDp)

Sets width of the device's screen in DP.