abstract class RemoteFloat : BaseRemoteState

Known direct subclasses
MutableRemoteFloat

A mutable implementation of RemoteFloat.


Abstract base class for all remote float representations.

RemoteFloat represents a floating-point value that can be a constant, a possibly named variable, or a dynamic expression (e.g., an arithmetic operation).

Summary

Public companion functions

RemoteFloat
createNamedRemoteFloat(
    name: String,
    defaultValue: Float,
    domain: RemoteState.Domain
)

Creates a named RemoteFloat with an initial value.

RemoteFloat
createNamedRemoteFloatExpression(
    name: String,
    domain: RemoteState.Domain,
    expression: RemoteFloatContext.() -> RemoteFloat
)
operator RemoteFloat
invoke(value: Float)

Creates a RemoteFloat from a constant Float value.

Public functions

operator RemoteFloat

Returns a new RemoteFloat that evaluates to this RemoteFloat div v.

infix RemoteBoolean

Returns a RemoteBoolean that evaluates to true if b is equal to the value of this RemoteFloat or false otherwise.

infix RemoteBoolean

Returns a RemoteBoolean that evaluates to true if b is greater than or equal to the value of this RemoteFloat or false otherwise.

infix RemoteBoolean

Returns a RemoteBoolean that evaluates to true if b is greater than the value of this RemoteFloat or false otherwise.

infix RemoteBoolean

Returns a RemoteBoolean that evaluates to true if b is less than or equal to the value of this RemoteFloat or false otherwise.

infix RemoteBoolean

Returns a RemoteBoolean that evaluates to true if b is less than the value of this RemoteFloat or false otherwise.

RemoteFloat

Returns a new RemoteFloat that evaluates to minimum of this RemoteFloat and v.

operator RemoteFloat

Returns a new RemoteFloat that evaluates to this RemoteFloat minus v.

infix RemoteBoolean

Returns a RemoteBoolean that evaluates to true if b is not equal to the value of this RemoteFloat or false otherwise.

operator RemoteFloat

Returns a new RemoteFloat that evaluates to this RemoteFloat plus v.

operator RemoteFloat

Returns a new RemoteFloat that evaluates to this RemoteFloat modulo v.

operator RemoteFloat

Returns a new RemoteFloat that evaluates to this RemoteFloat times v.

RemoteInt

Returns a RemoteInt that evaluates to the result of this RemoteFloat converted to Int.

RemoteString

Returns a RemoteString that evaluates to the result of this RemoteFloat formatted according to the provided DecimalFormat.

RemoteString
toRemoteString(before: Int, after: Int, flags: Int)

Returns a RemoteString that converts the result of this RemoteFloat with specified formatting.

operator RemoteFloat

Returns a new RemoteFloat that evaluates to the negative of this RemoteFloat.

Extension functions

RemoteDp

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

Inherited properties

From androidx.compose.remote.creation.compose.state.BaseRemoteState
abstract Float?

The constant value or null if there isn't one.

From androidx.compose.remote.creation.compose.state.RemoteState
open Float

The constant value held by this state.

open Boolean

Whether or not this remote state evaluates to a constant value.

Public companion functions

createNamedRemoteFloat

Added in 1.0.0-alpha12
fun createNamedRemoteFloat(
    name: String,
    defaultValue: Float,
    domain: RemoteState.Domain = RemoteState.Domain.User
): RemoteFloat

Creates a named RemoteFloat with an initial value. This allows referring to a float by a symbolic name in the remote document. Named remote ints can be set via AndroidRemoteContext.setNamedFloat.

Parameters
name: String

The name of the remote float.

defaultValue: Float

The initial value of the remote float.

domain: RemoteState.Domain = RemoteState.Domain.User

The domain of the named float (defaults to RemoteState.Domain.User). This helps avoid name collisions.

Returns
RemoteFloat

A RemoteFloat representing the named float.

createNamedRemoteFloatExpression

fun createNamedRemoteFloatExpression(
    name: String,
    domain: RemoteState.Domain = RemoteState.Domain.User,
    expression: RemoteFloatContext.() -> RemoteFloat
): RemoteFloat

invoke

Added in 1.0.0-alpha12
operator fun invoke(value: Float): RemoteFloat

Creates a RemoteFloat from a constant Float value.

Parameters
value: Float

The value to wrap.

Returns
RemoteFloat

A RemoteFloat representing the given constant or encoded id.

Public functions

div

Added in 1.0.0-alpha12
operator fun div(v: RemoteFloat): RemoteFloat

Returns a new RemoteFloat that evaluates to this RemoteFloat div v.

eq

Added in 1.0.0-alpha12
infix fun eq(b: RemoteFloat): RemoteBoolean

Returns a RemoteBoolean that evaluates to true if b is equal to the value of this RemoteFloat or false otherwise.

ge

Added in 1.0.0-alpha12
infix fun ge(b: RemoteFloat): RemoteBoolean

Returns a RemoteBoolean that evaluates to true if b is greater than or equal to the value of this RemoteFloat or false otherwise.

gt

Added in 1.0.0-alpha12
infix fun gt(b: RemoteFloat): RemoteBoolean

Returns a RemoteBoolean that evaluates to true if b is greater than the value of this RemoteFloat or false otherwise.

le

Added in 1.0.0-alpha12
infix fun le(b: RemoteFloat): RemoteBoolean

Returns a RemoteBoolean that evaluates to true if b is less than or equal to the value of this RemoteFloat or false otherwise.

lt

Added in 1.0.0-alpha12
infix fun lt(b: RemoteFloat): RemoteBoolean

Returns a RemoteBoolean that evaluates to true if b is less than the value of this RemoteFloat or false otherwise.

min

Added in 1.0.0-alpha12
fun min(v: RemoteFloat): RemoteFloat

Returns a new RemoteFloat that evaluates to minimum of this RemoteFloat and v.

minus

Added in 1.0.0-alpha12
operator fun minus(v: RemoteFloat): RemoteFloat

Returns a new RemoteFloat that evaluates to this RemoteFloat minus v.

ne

Added in 1.0.0-alpha12
infix fun ne(b: RemoteFloat): RemoteBoolean

Returns a RemoteBoolean that evaluates to true if b is not equal to the value of this RemoteFloat or false otherwise.

plus

Added in 1.0.0-alpha12
operator fun plus(v: RemoteFloat): RemoteFloat

Returns a new RemoteFloat that evaluates to this RemoteFloat plus v.

rem

Added in 1.0.0-alpha12
operator fun rem(v: RemoteFloat): RemoteFloat

Returns a new RemoteFloat that evaluates to this RemoteFloat modulo v.

times

Added in 1.0.0-alpha12
operator fun times(v: RemoteFloat): RemoteFloat

Returns a new RemoteFloat that evaluates to this RemoteFloat times v.

toRemoteInt

Added in 1.0.0-alpha12
fun toRemoteInt(): RemoteInt

Returns a RemoteInt that evaluates to the result of this RemoteFloat converted to Int.

toRemoteString

Added in 1.0.0-alpha12
fun toRemoteString(format: DecimalFormat): RemoteString

Returns a RemoteString that evaluates to the result of this RemoteFloat formatted according to the provided DecimalFormat.

This method maps the localized DecimalFormat symbols (such as separators and grouping sizes) and configuration (such as padding and rounding) to a remote-compatible string representation.

Parameters
format: DecimalFormat

The DecimalFormat to use for determining separators, grouping, and padding.

Returns
RemoteString

A RemoteString representing the formatted float.

toRemoteString

Added in 1.0.0-alpha12
fun toRemoteString(before: Int, after: Int = 2, flags: Int = PAD_AFTER_ZERO): RemoteString

Returns a RemoteString that converts the result of this RemoteFloat with specified formatting.

Parameters
before: Int

The number of digits to show before the decimal point.

after: Int = 2

The number of digits to show after the decimal point (defaults to 2).

flags: Int = PAD_AFTER_ZERO

Formatting flags for the string conversion (defaults to TextFromFloat.PAD_AFTER_ZERO).

Returns
RemoteString

A RemoteString representing the formatted float.

unaryMinus

Added in 1.0.0-alpha12
operator fun unaryMinus(): RemoteFloat

Returns a new RemoteFloat that evaluates to the negative of this RemoteFloat.

Extension functions

fun RemoteFloat.asRemoteDp(): RemoteDp

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