public class RemoteDp internal constructor(
@get:RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) public val value: RemoteFloat
) : BaseRemoteState<Float>(RemoteStateInstanceKey())
Represents a Density-independent pixel (Dp) value.
RemoteDp represents a Dp value that can be a constant, a named variable, or a dynamic expression.
Properties
cacheKey
public override val cacheKey: RemoteStateCacheKey
constantValueOrNull
override val constantValueOrNull: Float?
Functions
toPx
public fun toPx(density: RemoteDensity): RemoteFloat
Function to convert this RemoteDp to a density-independent pixel value. It multiplies the current float value by the screen's density.
toPx
public fun toPx(): RemoteFloat
Converts a RemoteDp to a RemoteFloat Px using the RemoteDensity.
plus
public operator fun plus(other: RemoteDp): RemoteDp
Add two RemoteDps together.
minus
public operator fun minus(other: RemoteDp): RemoteDp
Subtract a RemoteDp from another one.
unaryMinus
public operator fun unaryMinus(): RemoteDp
This is the same as multiplying the Dp by -1.0.
div
public operator fun div(other: Float): RemoteDp
Divide a RemoteDp by a scalar.
div
public operator fun div(other: Int): RemoteDp
Divide a RemoteDp by a scalar.
div
public operator fun div(other: RemoteFloat): RemoteDp
Divide a RemoteDp by a RemoteFloat.
div
public operator fun div(other: RemoteInt): RemoteDp
Divide a RemoteDp by a RemoteInt.
div
public operator fun div(other: RemoteDp): RemoteFloat
Divide by another RemoteDp to get a scalar.
times
public operator fun times(other: Float): RemoteDp
Multiply a RemoteDp by a scalar.
times
public operator fun times(other: Int): RemoteDp
Multiply a RemoteDp by a scalar.
times
public operator fun times(other: RemoteFloat): RemoteDp
Multiply a RemoteDp by a RemoteFloat.
times
public operator fun times(other: RemoteInt): RemoteDp
Multiply a RemoteDp by a RemoteInt.
isLessThan
public fun isLessThan(other: RemoteDp): RemoteBoolean
Check if this RemoteDp is less than other.
isLessThanOrEqualTo
public fun isLessThanOrEqualTo(other: RemoteDp): RemoteBoolean
Check if this RemoteDp is less than or equal to other.
isGreaterThan
public fun isGreaterThan(other: RemoteDp): RemoteBoolean
Check if this RemoteDp is greater than other.
isGreaterThanOrEqualTo
public fun isGreaterThanOrEqualTo(other: RemoteDp): RemoteBoolean
Check if this RemoteDp is greater than or equal to other.
isEqualTo
public fun isEqualTo(other: RemoteDp): RemoteBoolean
Check if this RemoteDp is equal to other.
isNotEqualTo
public fun isNotEqualTo(other: RemoteDp): RemoteBoolean
Check if this RemoteDp is not equal to other.
Members
Companion
public companion object
Functions
invoke
public operator fun invoke(value: RemoteFloat): RemoteDp
Creates a RemoteDp from a RemoteFloat.
Parameters
| value | The RemoteFloat value. |
Return
A RemoteDp representing the Dp.
invoke
public operator fun invoke(value: Float): RemoteDp
Creates a RemoteDp from a literal Float value.
Parameters
| value | The Float value. |
Return
A RemoteDp representing the constant Dp.
createNamedRemoteDp
public 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 | A unique name to identify this state within its domain. |
| defaultValue | The initial Float value for the named remote Dp. |
| domain | The domain for the named state. Defaults to RemoteState.Domain.User. |
Return
A RemoteDp representing the named Dp.
createNamedRemoteDp
public fun createNamedRemoteDp(
name: String,
domain: RemoteState.Domain = RemoteState.Domain.User,
value: () -> RemoteDp,
): RemoteDp