SubspaceModifierNodeElement

abstract class SubspaceModifierNodeElement<N : SubspaceModifier.Node> : SubspaceModifier


Modifier elements manage an instance of a particular SubspaceModifier.Node implementation. A given SubspaceModifier.Node implementation can only be used when a SubspaceModifierNodeElement, which creates and updates that implementation, is applied to a layout.

A SubspaceModifierNodeElement should be very lightweight, and do little more than hold the information necessary to create and maintain an instance of the associated SubspaceModifier.Node type.

Parameters
<N : SubspaceModifier.Node>

The type of node that this element creates and updates.

Summary

Public constructors

Public functions

abstract N

This will be called the first time the modifier is applied to the layout and it should construct and return the corresponding SubspaceModifier.Node instance.

abstract operator Boolean
equals(other: Any?)

Require equals() to be implemented.

abstract Int

Require hashCode() to be implemented.

abstract Unit
update(node: N)

Called when a modifier is applied to a layout whose inputs have changed from the previous application.

Inherited functions

From androidx.xr.compose.subspace.layout.SubspaceModifier
open Boolean

Returns true if predicate returns true for all SubspaceModifierNodeElements in this SubspaceModifier or if this SubspaceModifier contains no Elements.

open Boolean

Returns true if predicate returns true for any SubspaceModifierNodeElement in this SubspaceModifier.

open R
<R : Any?> foldIn(
    initial: R,
    operation: (SubspaceModifierNodeElement<SubspaceModifier.Node>, R) -> R
)

Accumulates a value starting with initial and applying operation to the current value and each SubspaceModifierNodeElement from outside in.

open R
<R : Any?> foldOut(
    initial: R,
    operation: (SubspaceModifierNodeElement<SubspaceModifier.Node>, R) -> R
)

Accumulates a value starting with initial and applying operation to the current value and each SubspaceModifierNodeElement from inside out.

open infix SubspaceModifier

Concatenates this modifier with another.

Public constructors

SubspaceModifierNodeElement

<N : SubspaceModifier.Node> SubspaceModifierNodeElement()
Parameters
<N : SubspaceModifier.Node>

The type of node that this element creates and updates.

Public functions

create

Added in 1.0.0-alpha04
abstract fun create(): N

This will be called the first time the modifier is applied to the layout and it should construct and return the corresponding SubspaceModifier.Node instance.

equals

Added in 1.0.0-alpha04
abstract operator fun equals(other: Any?): Boolean

Require equals() to be implemented. Using a data class is sufficient. Singletons may implement this function with referential equality (this === other). Modifiers with no inputs may implement this function by checking the type of the other object.

hashCode

Added in 1.0.0-alpha04
abstract fun hashCode(): Int

Require hashCode() to be implemented. Using a data class is sufficient. Singletons and modifiers with no parameters may implement this function by returning an arbitrary constant.

update

Added in 1.0.0-alpha04
abstract fun update(node: N): Unit

Called when a modifier is applied to a layout whose inputs have changed from the previous application. This function will have the current node instance passed in as a parameter, and it is expected that the node will be brought up to date.