CompositionData
-
Cmn
interface CompositionData
CompositionGroup |
|
A CompositionData is the data tracked by the composer during composition.
This interface is not intended to be used directly and is provided to allow the tools API to have access to data tracked during composition. The tools API should be used instead which provides a more usable interpretation of the slot table.
Summary
Public functions |
||
|---|---|---|
open CompositionGroup? |
Find a sub-group by identity. |
Cmn
|
Public properties |
||
|---|---|---|
Iterable<CompositionGroup> |
Iterate the composition data in the group. |
Cmn
|
Boolean |
Returns true if no composition data has been collected. |
Cmn
|
Extension functions |
||
|---|---|---|
CompositionInstance? |
Find the |
Cmn
|
Group |
Return a group tree for for the slot table that represents the entire content of the slot table. |
android
|
T? |
@UiToolingDataApiReturn a tree of custom nodes for the slot table. |
android
|
Public functions
find
open fun find(identityToFind: Any): CompositionGroup?
Find a sub-group by identity. Returns null if the group is not found or the implementation of this interface does not support finding groups by their identity. In other words, a null result from this method should not be interpreted as the identity is not a group in the composition data.
Public properties
compositionGroups
val compositionGroups: Iterable<CompositionGroup>
Iterate the composition data in the group. The composition data is structured as a tree of values that corresponds to the call graph of the functions that produced the tree. Interspersed are groups that represents the nodes themselves.
Extension functions
findCompositionInstance
fun CompositionData.findCompositionInstance(): CompositionInstance?
Find the CompositionInstance associated with the root CompositionData. This is only valid for instances of CompositionData that are recorded in a LocalInspectionTables table directly.
Even though CompositionGroups implement the CompositionData interface, only the root CompositionData has an associated CompositionInstance. All CompositionGroup instances will return null.
asTree
@UiToolingDataApi
fun CompositionData.asTree(): Group
Return a group tree for for the slot table that represents the entire content of the slot table.
mapTree
@UiToolingDataApi
fun <T : Any?> CompositionData.mapTree(
factory: (CompositionGroup, SourceContext, List<T>) -> T?,
cache: ContextCache = ContextCache()
): T?
Return a tree of custom nodes for the slot table.
The factory method will be called for every CompositionGroup in the slot tree and can be used to create custom nodes based on the passed arguments. The SourceContext argument gives access to additional information encoded in the CompositionGroup.sourceInfo. A return of null from factory means that the entire subtree will be ignored.
A cache can optionally be specified. If a client is calling mapTree multiple times, this can save some time if the values of CompositionGroup.sourceInfo are not unique.