androidx.compose.remote.creation.compose.state

Interfaces

MutableRemoteState

A readable and writable Remote Compose State value.

RemoteAnimationSpec

Specification for animations in Remote Compose.

RemotePaint

A paint object used for remote drawing operations.

RemoteState

A readable but not writable Remote Compose State value.

RemoteStateScope

Scope for accessing remote state IDs.

Classes

BaseRemoteState

Common base class for all Remote types.

MutableRemoteBoolean

A mutable implementation of RemoteBoolean.

MutableRemoteEnum

A mutable implementation of RemoteEnum.

MutableRemoteFloat

A mutable implementation of RemoteFloat.

MutableRemoteImageBitmap

A mutable implementation of RemoteImageBitmap that holds its value in a MutableRemoteState.

MutableRemoteInt

A mutable implementation of RemoteInt.

MutableRemoteLong

A mutable implementation of RemoteLong.

MutableRemoteString

An implementation of RemoteString that holds its value in a MutableRemoteState.

RemoteBoolean

A class representing a remote boolean value.

RemoteColor

Canvas color supporting constant values, named variables, and dynamic expressions.

RemoteDp

Represents a Density-independent pixel (Dp) value.

RemoteEasing

Defines the easing curve used for Remote Compose animations.

RemoteEnum

A class representing a remote enum value.

RemoteFloat

Abstract base class for all remote float representations.

RemoteImageBitmap

Abstract base class for all remote bitmap representations in Compose Remote, this class extends RemoteState.

RemoteInt

Abstract base class for all remote integer representations.

RemoteLong

Abstract base class for all remote long representations.

RemoteMatrix3x3

Represents a 3x3 transformation matrix.

RemoteState.Domain

Represents the domain (namespace) for named remote states.

RemoteString

Abstract base class for all remote string representations.

RemoteTextUnit

Represents a TextUnit value (Sp or Em) backed by a RemoteFloat.

RemoteTweenSpec

Easing-based animation specification with a fixed duration.

Objects

RemoteColor.Companion
RemoteConfiguration

Provides access to host display and window context variables evaluated by the host player.

RemoteDp.Companion
RemoteState.Domain.System

The system-defined domain, used for platform-level or framework state.

RemoteState.Domain.User

The default user-defined domain.

RemoteTimeVariables

Provides access to remote time and animation variables evaluated by the host player.

Composables

rememberMutableRemoteBoolean

Factory composable for mutable remote boolean state.

rememberMutableRemoteEnum

Factory composable for mutable remote enum state.

rememberMutableRemoteFloat

Factory composable for mutable remote float state.

rememberMutableRemoteImageBitmap

Factory for mutable remote bitmap state.

rememberMutableRemoteInt

Factory composable for mutable remote integer state.

rememberMutableRemoteString

Factory composable for mutable remote string state.

rememberNamedRemoteBoolean

Remembers a named remote boolean expression.

rememberNamedRemoteColor

Remembers a named remote color expression.

rememberNamedRemoteDp

Remembers a named remote Dp expression.

rememberNamedRemoteEnum

Remembers a named remote enum expression.

rememberNamedRemoteFloat

Remembers a named remote float expression.

rememberNamedRemoteImageBitmap

Remembers a named RemoteImageBitmap from a lambda providing the initial ImageBitmap.

rememberNamedRemoteInt

Remembers a named remote integer expression.

rememberNamedRemoteLong

Remembers a named remote long expression.

rememberNamedRemoteString

Remembers a named remote string expression.

rememberRemoteImageBitmap

Remembers a remote bitmap from a URL.

Top-level functions summary

RemoteColor

Creates a RemoteColor from a literal Color value.

RemoteDp
RemoteDp(value: Dp)

Creates a RemoteDp from a literal Dp value.

RemoteFloat

Returns the absolute value of the given RemoteFloat.

RemoteFloat

Computes the arc cosine of the given RemoteFloat.

RemoteDp
animateRemoteDpAsState(
    targetValue: RemoteDp,
    animationSpec: RemoteAnimationSpec,
    initialValue: Float
)

Returns a RemoteDp that animates towards targetValue whenever it changes.

RemoteFloat
animateRemoteFloatAsState(
    targetValue: RemoteFloat,
    animationSpec: RemoteAnimationSpec,
    initialValue: Float,
    wrap: Float
)

Returns a RemoteFloat that animates towards targetValue whenever it changes.

RemoteFloat

Computes the arc sine of the given RemoteFloat.

RemoteFloat

Computes the arc tangent of the given RemoteFloat value.

RemoteFloat

Returns the angle theta from the conversion of rectangular coordinates (b, a) to polar coordinates (r, theta).

RemoteFloat

Returns the cube root of a RemoteFloat.

RemoteFloat

Returns the smallest mathematical integer RemoteFloat greater than or equal to a.

RemoteFloat
clamp(value: RemoteFloat, min: RemoteFloat, max: RemoteFloat)

Restricts the given value to the range defined by min and max.

RemoteFloat

Returns the first floating-point argument with the sign of the second floating-point argument.

RemoteFloat

Computes the cosine of the given RemoteFloat.

RemoteColor
createNamedRemoteColor(
    name: String,
    defaultValue: Color,
    domain: RemoteState.Domain
)

Creates a named RemoteColor with an initial value.

RemoteDp
createNamedRemoteDp(
    name: String,
    defaultValue: Dp,
    domain: RemoteState.Domain
)

Creates a named RemoteDp with an initial value.

RemoteDp
createNamedRemoteDp(
    name: String,
    defaultValue: Float,
    domain: RemoteState.Domain
)

Creates a named RemoteDp with an initial value.

RemoteDp
createNamedRemoteDp(
    name: String,
    domain: RemoteState.Domain,
    value: () -> RemoteDp
)

Creates a named RemoteDp expression.

RemoteFloat

Returns Euler's number e raised to the power of a.

RemoteFloat

Returns the largest mathematical integer RemoteFloat less than or equal to a.

RemoteFloat
lerp(from: RemoteFloat, to: RemoteFloat, tween: RemoteFloat)

Computes from + (to - from) * tween.

RemoteFloat

Computes the natural logarithm (base e) of the RemoteFloat.

RemoteFloat

Computes the base-10 logarithm of the RemoteFloat.

RemoteFloat

Computes a multiply-add operation: a * b + c.

RemoteDp
max(a: RemoteDp, b: RemoteDp)

Returns the greater of two RemoteDp values.

RemoteFloat

Returns the greater of two RemoteFloat values.

RemoteDp
min(a: RemoteDp, b: RemoteDp)

Returns the smaller of two RemoteDp values.

RemoteFloat

Returns the smaller of two RemoteFloat values.

RemoteFloat

Raises a to the power of b.

RemoteAnimationSpec
remoteSpring(
    dampingRatio: @FloatRange(from = 0.0, to = 1.0) Float,
    stiffness: @FloatRange(from = 0.0, fromInclusive = false) Float,
    stopThreshold: @FloatRange(from = 0.0, fromInclusive = false) Float,
    boundaryMode: Int
)

Creates a RemoteAnimationSpec for physics-based spring animations.

RemoteTweenSpec
remoteTween(durationMillis: @IntRange(from = 0) Int, easing: RemoteEasing)

Creates a RemoteAnimationSpec with the given duration in milliseconds and easing curve.

RemoteFloat

Returns the value of the given RemoteFloat rounded to the nearest integer.

RemoteFloat

Returns the sign of the given RemoteFloat.

RemoteFloat

Computes the sine of the given RemoteFloat.

RemoteFloat

Returns the positive square root of the given RemoteFloat.

RemoteFloat

Computes the trigonometric tangent of an angle in radians.

RemoteFloat

Converts an angle measured in radians to an approximately equivalent angle measured in degrees.

RemoteFloat

Converts the given RemoteFloat value in degrees to radians.

RemoteColor
tween(from: RemoteColor, to: RemoteColor, tween: RemoteFloat)

Creates a remote color that interpolates between two RemoteColors based on a tween factor.

Extension functions summary

Color

Converts this RemoteColor to a Color if it has a constant value.

Color?

Converts this RemoteColor to a Color if it has a constant value, or null otherwise.

RemoteDp

Extension function to convert a Dp to a RemoteDp.

RemoteColor

Extension function to convert a Color to a RemoteColor.

RemoteDp

Converts this RemoteFloat to a RemoteDp directly (1:1)

RemoteTextUnit

Extension function to convert a TextUnit to a RemoteTextUnit.

RemoteColor
RemoteColor.Companion.createNamedRemoteColor(
    name: String,
    defaultValue: Color,
    domain: RemoteState.Domain
)

Creates a named RemoteColor with an initial value.

RemoteDp
RemoteDp.Companion.createNamedRemoteDp(
    name: String,
    defaultValue: Dp,
    domain: RemoteState.Domain
)

Creates a named RemoteDp with an initial value.

RemoteColor
RemoteColor.Companion.createThemedRemoteColor(
    lightColorRes: @ColorRes Int,
    darkColorRes: @ColorRes Int,
    lightFallback: Color,
    darkFallback: Color
)

Creates a themed RemoteColor that resolves to different Android system colors in light and dark mode.

RemoteColor
RemoteColor.Companion.createThemedRemoteColor(
    lightColorRes: @ColorRes Int,
    darkColorRes: @ColorRes Int,
    lightFallback: @ColorInt Int,
    darkFallback: @ColorInt Int
)

Creates a themed RemoteColor that resolves to different Android system colors in light and dark mode.

RemotePath

Build the RemotePath, encoding using this RemoteStateScope.

RemoteDp

Converts this RemoteFloat representing pixels to a RemoteDp by dividing by density.

RemoteTextUnit

Extension function to convert a Dp to a RemoteTextUnit in Sp.

Extension properties summary

Dp

Extension property to get the Dp value of this RemoteDp.

Dp?

Extension property to get the Dp value of this RemoteDp, or null if dynamic.

RemoteImageBitmap

Extension property to convert a ImageBitmap to a RemoteImageBitmap.

RemoteBoolean

Extension property to convert a Boolean to a RemoteBoolean.

RemoteColor

Extension property to convert a Color to a RemoteColor.

RemoteColor

Extension property to convert an ARGB Int to a RemoteColor.

RemoteDp

Extension property to convert a Dp to a RemoteDp.

RemoteDp

Extension property to convert a Float to a RemoteDp.

RemoteDp

Extension property to convert an Int to a RemoteDp.

RemoteFloat

Extension property to convert a Float to a RemoteFloat.

RemoteFloat

Extension property to convert an Int to a RemoteFloat.

RemoteInt

Extension property to convert an Int to a RemoteInt.

RemoteString

Extension property to convert a String to a RemoteString.

RemoteTextUnit

Extension property to convert a RemoteFloat to a RemoteTextUnit in Sp.

RemoteTextUnit

Extension property to convert a Float to a RemoteTextUnit in Sp.

RemoteTextUnit

Extension property to convert an Int to a RemoteTextUnit in Sp.

Top-level functions

fun RemoteColor(color: Color): RemoteColor

Creates a RemoteColor from a literal Color value.

Parameters
color: Color

The Color value.

Returns
RemoteColor

A RemoteColor representing the constant color.

fun RemoteDp(value: Dp): RemoteDp

Creates a RemoteDp from a literal Dp value.

Parameters
value: Dp

The Dp value.

Returns
RemoteDp

A RemoteDp representing the constant Dp.

fun abs(a: RemoteFloat): RemoteFloat

Returns the absolute value of the given RemoteFloat.

Parameters
a: RemoteFloat

The RemoteFloat whose absolute value is to be determined.

Returns
RemoteFloat

A RemoteFloat representing the absolute value of a.

fun acos(a: RemoteFloat): RemoteFloat

Computes the arc cosine of the given RemoteFloat.

Parameters
a: RemoteFloat

The value whose arc cosine is to be computed.

Returns
RemoteFloat

The arc cosine of a in radians.

fun animateRemoteDpAsState(
    targetValue: RemoteDp,
    animationSpec: RemoteAnimationSpec = remoteTween(),
    initialValue: Float = Float.NaN
): RemoteDp

Returns a RemoteDp that animates towards targetValue whenever it changes.

Parameters
targetValue: RemoteDp

The target value to animate towards.

animationSpec: RemoteAnimationSpec = remoteTween()

The specification for the animation (e.g. remoteTween or remoteSpring).

initialValue: Float = Float.NaN

Optional initial value if animating from a start value.

animateRemoteFloatAsState

fun animateRemoteFloatAsState(
    targetValue: RemoteFloat,
    animationSpec: RemoteAnimationSpec = remoteTween(),
    initialValue: Float = Float.NaN,
    wrap: Float = Float.NaN
): RemoteFloat

Returns a RemoteFloat that animates towards targetValue whenever it changes.

Parameters
targetValue: RemoteFloat

The target value to animate towards.

animationSpec: RemoteAnimationSpec = remoteTween()

The specification for the animation (e.g. remoteTween or remoteSpring).

initialValue: Float = Float.NaN

Optional initial value if animating from a start value.

wrap: Float = Float.NaN

Optional wrap modulo bound (e.g. 360f for angles).

fun asin(a: RemoteFloat): RemoteFloat

Computes the arc sine of the given RemoteFloat.

Parameters
a: RemoteFloat

The value whose arc sine is to be computed.

Returns
RemoteFloat

The arc sine of a in radians.

fun atan(a: RemoteFloat): RemoteFloat

Computes the arc tangent of the given RemoteFloat value.

Parameters
a: RemoteFloat

The value whose arc tangent is to be computed.

Returns
RemoteFloat

The arc tangent of a, in radians, in the range of -pi/2 to pi/2.

fun atan2(a: RemoteFloat, b: RemoteFloat): RemoteFloat

Returns the angle theta from the conversion of rectangular coordinates (b, a) to polar coordinates (r, theta).

Parameters
a: RemoteFloat

The y-coordinate

b: RemoteFloat

The x-coordinate

fun cbrt(a: RemoteFloat): RemoteFloat

Returns the cube root of a RemoteFloat.

Parameters
a: RemoteFloat

The RemoteFloat whose cube root is to be computed.

fun ceil(a: RemoteFloat): RemoteFloat

Returns the smallest mathematical integer RemoteFloat greater than or equal to a.

Parameters
a: RemoteFloat

The RemoteFloat value to round up.

fun clamp(value: RemoteFloat, min: RemoteFloat, max: RemoteFloat): RemoteFloat

Restricts the given value to the range defined by min and max.

Parameters
value: RemoteFloat

The RemoteFloat value to be clamped

min: RemoteFloat

The lower bound of the range

max: RemoteFloat

The upper bound of the range

fun copySign(a: RemoteFloat, b: RemoteFloat): RemoteFloat

Returns the first floating-point argument with the sign of the second floating-point argument.

Parameters
a: RemoteFloat

The value whose magnitude is used.

b: RemoteFloat

The value whose sign is used.

fun cos(a: RemoteFloat): RemoteFloat

Computes the cosine of the given RemoteFloat.

Parameters
a: RemoteFloat

The value in radians whose cosine is to be computed.

Returns
RemoteFloat

The cosine of a.

fun createNamedRemoteColor(
    name: String,
    defaultValue: Color,
    domain: RemoteState.Domain = RemoteState.Domain.User
): RemoteColor

Creates a named RemoteColor with an initial value.

Parameters
name: String

A unique name to identify this state within its domain.

defaultValue: Color

The initial Color value for the named remote color.

domain: RemoteState.Domain = RemoteState.Domain.User

The domain for the named state. Defaults to RemoteState.Domain.User.

Returns
RemoteColor

A RemoteColor representing the named color.

fun createNamedRemoteDp(
    name: String,
    defaultValue: Dp,
    domain: RemoteState.Domain = RemoteState.Domain.User
): RemoteDp

Creates a named RemoteDp with an initial value.

Named remote Dps can be set via AndroidRemoteContext.setNamedFloat.

Parameters
name: String

A unique name to identify this state within its domain.

defaultValue: Dp

The initial Dp value for the named remote Dp.

domain: RemoteState.Domain = RemoteState.Domain.User

The domain for the named state. Defaults to RemoteState.Domain.User.

Returns
RemoteDp

A RemoteDp representing the named Dp.

fun createNamedRemoteDp(
    name: String,
    defaultValue: Float,
    domain: RemoteState.Domain = RemoteState.Domain.User
): RemoteDp

Creates a named RemoteDp with an initial value.

Named remote Dps can be set via AndroidRemoteContext.setNamedFloat.

Parameters
name: String

A unique name to identify this state within its domain.

defaultValue: Float

The initial Float value for the named remote Dp.

domain: RemoteState.Domain = RemoteState.Domain.User

The domain for the named state. Defaults to RemoteState.Domain.User.

Returns
RemoteDp

A RemoteDp representing the named Dp.

fun createNamedRemoteDp(
    name: String,
    domain: RemoteState.Domain = RemoteState.Domain.User,
    value: () -> RemoteDp
): RemoteDp

Creates a named RemoteDp expression.

Parameters
name: String

A unique name to identify this state within its domain.

domain: RemoteState.Domain = RemoteState.Domain.User

The domain for the named state. Defaults to RemoteState.Domain.User.

value: () -> RemoteDp

A lambda that provides the RemoteDp expression.

Returns
RemoteDp

A RemoteDp representing the named Dp expression.

fun exp(a: RemoteFloat): RemoteFloat

Returns Euler's number e raised to the power of a.

Parameters
a: RemoteFloat

The exponent to raise e to.

fun floor(a: RemoteFloat): RemoteFloat

Returns the largest mathematical integer RemoteFloat less than or equal to a.

Parameters
a: RemoteFloat

The RemoteFloat value to round down.

fun lerp(from: RemoteFloat, to: RemoteFloat, tween: RemoteFloat): RemoteFloat

Computes from + (to - from) * tween.

Parameters
from: RemoteFloat

The RemoteFloat we're interpolating from, i.e. when tween is 0, lerp evaluates to from

to: RemoteFloat

The RemoteFloat we're interpolating towards, i.e. when tween is 1, lerp evaluates to to

tween: RemoteFloat

The ratio between from and to that controls the result.

fun ln(a: RemoteFloat): RemoteFloat

Computes the natural logarithm (base e) of the RemoteFloat.

Parameters
a: RemoteFloat

The value whose natural logarithm is to be computed.

fun log(a: RemoteFloat): RemoteFloat

Computes the base-10 logarithm of the RemoteFloat.

Parameters
a: RemoteFloat

The value whose logarithm is to be computed.

fun mad(a: RemoteFloat, b: RemoteFloat, c: RemoteFloat): RemoteFloat

Computes a multiply-add operation: a * b + c.

Parameters
a: RemoteFloat

The first multiplier

b: RemoteFloat

The second multiplier

c: RemoteFloat

The value to be added to the product of a and b

fun max(a: RemoteDp, b: RemoteDp): RemoteDp

Returns the greater of two RemoteDp values.

Parameters
a: RemoteDp

The first RemoteDp value to compare.

b: RemoteDp

The second RemoteDp value to compare.

fun max(a: RemoteFloat, b: RemoteFloat): RemoteFloat

Returns the greater of two RemoteFloat values.

Parameters
a: RemoteFloat

The first RemoteFloat value.

b: RemoteFloat

The second RemoteFloat value.

Returns
RemoteFloat

The larger of a and b.

fun min(a: RemoteDp, b: RemoteDp): RemoteDp

Returns the smaller of two RemoteDp values.

Parameters
a: RemoteDp

The first RemoteDp value to compare.

b: RemoteDp

The second RemoteDp value to compare.

fun min(a: RemoteFloat, b: RemoteFloat): RemoteFloat

Returns the smaller of two RemoteFloat values.

Parameters
a: RemoteFloat

The first RemoteFloat value

b: RemoteFloat

The second RemoteFloat value

Returns
RemoteFloat

A RemoteFloat representing the minimum of a and b

fun pow(a: RemoteFloat, b: RemoteFloat): RemoteFloat

Raises a to the power of b.

Parameters
a: RemoteFloat

The base value.

b: RemoteFloat

The exponent value.

Returns
RemoteFloat

A RemoteFloat representing a raised to the power of b.

fun remoteSpring(
    dampingRatio: @FloatRange(from = 0.0, to = 1.0) Float = 1.0f,
    stiffness: @FloatRange(from = 0.0, fromInclusive = false) Float = 50.0f,
    stopThreshold: @FloatRange(from = 0.0, fromInclusive = false) Float = 0.001f,
    boundaryMode: Int = 0
): RemoteAnimationSpec

Creates a RemoteAnimationSpec for physics-based spring animations.

Parameters
dampingRatio: @FloatRange(from = 0.0, to = 1.0) Float = 1.0f

Damping ratio (1.0 = no bounce, < 1.0 = bouncy).

stiffness: @FloatRange(from = 0.0, fromInclusive = false) Float = 50.0f

Spring stiffness.

stopThreshold: @FloatRange(from = 0.0, fromInclusive = false) Float = 0.001f

Threshold for stopping velocity/displacement.

boundaryMode: Int = 0

Boundary mode for the spring.

fun remoteTween(
    durationMillis: @IntRange(from = 0) Int = 300,
    easing: RemoteEasing = RemoteEasing.Standard
): RemoteTweenSpec

Creates a RemoteAnimationSpec with the given duration in milliseconds and easing curve.

Parameters
durationMillis: @IntRange(from = 0) Int = 300

Duration of the animation in milliseconds.

easing: RemoteEasing = RemoteEasing.Standard

Easing curve to apply.

fun round(a: RemoteFloat): RemoteFloat

Returns the value of the given RemoteFloat rounded to the nearest integer.

Parameters
a: RemoteFloat

The RemoteFloat to be rounded.

fun sign(a: RemoteFloat): RemoteFloat

Returns the sign of the given RemoteFloat.

Parameters
a: RemoteFloat

The value whose sign is to be returned.

Returns
RemoteFloat

1.0 if the value is positive, -1.0 if it is negative, and 0.0 if it is zero.

fun sin(a: RemoteFloat): RemoteFloat

Computes the sine of the given RemoteFloat.

Parameters
a: RemoteFloat

The angle in radians.

Returns
RemoteFloat

The sine of a.

fun sqrt(a: RemoteFloat): RemoteFloat

Returns the positive square root of the given RemoteFloat.

Parameters
a: RemoteFloat

The RemoteFloat whose square root is to be computed.

fun tan(a: RemoteFloat): RemoteFloat

Computes the trigonometric tangent of an angle in radians.

Parameters
a: RemoteFloat

The angle in radians.

fun toDeg(a: RemoteFloat): RemoteFloat

Converts an angle measured in radians to an approximately equivalent angle measured in degrees.

Parameters
a: RemoteFloat

An angle, in radians

Returns
RemoteFloat

The measurement of the angle a in degrees

fun toRad(a: RemoteFloat): RemoteFloat

Converts the given RemoteFloat value in degrees to radians.

Parameters
a: RemoteFloat

An angle in degrees.

fun tween(from: RemoteColor, to: RemoteColor, tween: RemoteFloat): RemoteColor

Creates a remote color that interpolates between two RemoteColors based on a tween factor. This allows for dynamic color transitions where both the start/end colors and the interpolation factor can be remote expressions.

Parameters
from: RemoteColor

The starting RemoteColor.

to: RemoteColor

The ending RemoteColor.

tween: RemoteFloat

A RemoteFloat representing the interpolation factor in range 0..1.

Returns
RemoteColor

A new RemoteColor representing the tweened color.

Extension functions

RemoteColor.asConstantColor

fun RemoteColor.asConstantColor(): Color

Converts this RemoteColor to a Color if it has a constant value.

RemoteColor.asConstantColorOrNull

fun RemoteColor.asConstantColorOrNull(): Color?

Converts this RemoteColor to a Color if it has a constant value, or null otherwise.

fun Dp.asRdp(): RemoteDp

Extension function to convert a Dp to a RemoteDp.

fun Color.asRemoteColor(): RemoteColor

Extension function to convert a Color to a RemoteColor.

fun RemoteFloat.asRemoteDp(): RemoteDp

Converts this RemoteFloat to a RemoteDp directly (1:1)

TextUnit.asRemoteTextUnit

fun TextUnit.asRemoteTextUnit(): RemoteTextUnit

Extension function to convert a TextUnit to a RemoteTextUnit.

RemoteColor.Companion.createNamedRemoteColor

fun RemoteColor.Companion.createNamedRemoteColor(
    name: String,
    defaultValue: Color,
    domain: RemoteState.Domain = RemoteState.Domain.User
): RemoteColor

Creates a named RemoteColor with an initial value.

Named remote colors can be set via AndroidRemoteContext.setNamedColor.

Parameters
name: String

A unique name to identify this state within its domain.

defaultValue: Color

The initial Color value for the named remote color.

domain: RemoteState.Domain = RemoteState.Domain.User

The domain for the named state. Defaults to RemoteState.Domain.User.

Returns
RemoteColor

A RemoteColor representing the named color.

RemoteDp.Companion.createNamedRemoteDp

fun RemoteDp.Companion.createNamedRemoteDp(
    name: String,
    defaultValue: Dp,
    domain: RemoteState.Domain = RemoteState.Domain.User
): RemoteDp

Creates a named RemoteDp with an initial value.

Named remote Dps can be set via AndroidRemoteContext.setNamedFloat.

Parameters
name: String

A unique name to identify this state within its domain.

defaultValue: Dp

The initial Dp value for the named remote Dp.

domain: RemoteState.Domain = RemoteState.Domain.User

The domain for the named state. Defaults to RemoteState.Domain.User.

Returns
RemoteDp

A RemoteDp representing the named Dp.

RemoteColor.Companion.createThemedRemoteColor

fun RemoteColor.Companion.createThemedRemoteColor(
    lightColorRes: @ColorRes Int,
    darkColorRes: @ColorRes Int,
    lightFallback: Color,
    darkFallback: Color
): RemoteColor

Creates a themed RemoteColor that resolves to different Android system colors in light and dark mode.

Parameters
lightColorRes: @ColorRes Int

The android.R.color resource ID for light mode.

darkColorRes: @ColorRes Int

The android.R.color resource ID for dark mode.

lightFallback: Color

The fallback Color value to use in light mode if the theme color cannot be resolved.

darkFallback: Color

The fallback Color value to use in dark mode if the theme color cannot be resolved.

Returns
RemoteColor

A RemoteColor representing the themed color.

RemoteColor.Companion.createThemedRemoteColor

fun RemoteColor.Companion.createThemedRemoteColor(
    lightColorRes: @ColorRes Int,
    darkColorRes: @ColorRes Int,
    lightFallback: @ColorInt Int,
    darkFallback: @ColorInt Int
): RemoteColor

Creates a themed RemoteColor that resolves to different Android system colors in light and dark mode.

Parameters
lightColorRes: @ColorRes Int

The android.R.color resource ID for light mode.

darkColorRes: @ColorRes Int

The android.R.color resource ID for dark mode.

lightFallback: @ColorInt Int

The fallback ARGB color integer to use in light mode if the theme color cannot be resolved.

darkFallback: @ColorInt Int

The fallback ARGB color integer to use in dark mode if the theme color cannot be resolved.

Returns
RemoteColor

A RemoteColor representing the themed color.

RemoteStateScope.remotePath

fun RemoteStateScope.remotePath(fn: RemotePathScope.() -> Unit): RemotePath

Build the RemotePath, encoding using this RemoteStateScope.

fun RemoteFloat.toRemoteDp(): RemoteDp

Converts this RemoteFloat representing pixels to a RemoteDp by dividing by density.

fun Dp.toRsp(): RemoteTextUnit

Extension function to convert a Dp to a RemoteTextUnit in Sp.

Extension properties

val RemoteDp.asDp: Dp

Extension property to get the Dp value of this RemoteDp.

val RemoteDp.asDpOrNull: Dp?

Extension property to get the Dp value of this RemoteDp, or null if dynamic.

val ImageBitmap.rb: RemoteImageBitmap

Extension property to convert a ImageBitmap to a RemoteImageBitmap.

val Boolean.rb: RemoteBoolean

Extension property to convert a Boolean to a RemoteBoolean.

val Color.rc: RemoteColor

Extension property to convert a Color to a RemoteColor.

val @ColorInt Int.rc: RemoteColor

Extension property to convert an ARGB Int to a RemoteColor.

val Dp.rdp: RemoteDp

Extension property to convert a Dp to a RemoteDp.

val Float.rdp: RemoteDp

Extension property to convert a Float to a RemoteDp.

val Int.rdp: RemoteDp

Extension property to convert an Int to a RemoteDp.

val Float.rf: RemoteFloat

Extension property to convert a Float to a RemoteFloat.

val Int.rf: RemoteFloat

Extension property to convert an Int to a RemoteFloat.

val Int.ri: RemoteInt

Extension property to convert an Int to a RemoteInt.

val String.rs: RemoteString

Extension property to convert a String to a RemoteString.

val RemoteFloat.rsp: RemoteTextUnit

Extension property to convert a RemoteFloat to a RemoteTextUnit in Sp.

import androidx.compose.remote.creation.compose.layout.RemoteText
import androidx.compose.remote.creation.compose.state.rememberNamedRemoteFloat
import androidx.compose.remote.creation.compose.state.rf
import androidx.compose.remote.creation.compose.state.rs
import androidx.compose.remote.creation.compose.state.rsp

val fontScale = rememberNamedRemoteFloat("fontScale") { 1.2f.rf }
val dynamicSize = (16f.rf * fontScale).rsp
RemoteText(text = "Dynamic Size Text".rs, fontSize = dynamicSize)
val Float.rsp: RemoteTextUnit

Extension property to convert a Float to a RemoteTextUnit in Sp.

val Int.rsp: RemoteTextUnit

Extension property to convert an Int to a RemoteTextUnit in Sp.