SemanticsNode
class SemanticsNode
kotlin.Any | |
↳ | androidx.ui.core.semantics.SemanticsNode |
A node that represents some semantic data.
The semantics tree is maintained during the semantics phase of the pipeline (i.e., during PipelineOwner.flushSemantics), which happens after compositing. The semantics tree is then uploaded into the engine for use by assistive technology.
Summary
Public constructors |
|
---|---|
<init>() Creates a semantic node. |
Public methods |
|
---|---|
Unit |
redepthChild(child: SemanticsNode) Adjust the depth of the given child to be greater than this node's own depth. |
Unit |
Companion functions |
|
---|---|
SemanticsNode |
root(owner: SemanticsOwner) |
Properties |
|
---|---|
Boolean |
Whether this node is in a tree whose root is attached to something. |
List<SemanticsNode> |
Contains the children in inverse hit test order (i. |
Int |
The number of children this node has. |
SemanticsConfiguration | |
Int |
The depth of this node in the tree. |
Boolean |
Whether this node has a non-zero number of children. |
Int |
The unique identifier for this node. |
Boolean |
Whether the node is invisible. |
Boolean |
Whether this node merges its semantic information into an ancestor node. |
Boolean |
Whether this node is taking part in a merge of semantic information. |
Boolean |
Whether this node and all of its descendants should be treated as one logical entity. |
SemanticsOwner? |
The owner for this node (null if unattached). |
SemanticsNode? |
The parent of this node in the tree. |
Rect? |
The paint clip from an ancestor that was applied to this node. |
Rect? |
The semantic clip from an ancestor that was applied to this node. |
Rect |
The bounding box for this node in its coordinate system. |
Public constructors
<init>
SemanticsNode()
Creates a semantic node.
Each semantic node has a unique identifier that is assigned when the node is created.
Public methods
redepthChild
fun redepthChild(child: SemanticsNode): Unit
Adjust the depth of the given child to be greater than this node's own depth.
redepthChildren
fun redepthChildren(): Unit
Properties
attached
val attached: Boolean
Whether this node is in a tree whose root is attached to something.
This becomes true during the call to attach.
This becomes false during the call to detach.
children
var children: List<SemanticsNode>
Contains the children in inverse hit test order (i.e. paint order).
config
val config: SemanticsConfiguration
depth
var depth: Int
The depth of this node in the tree.
The depth of nodes in a tree monotonically increases as you traverse down the tree.
id
val id: Int
The unique identifier for this node.
The root node has an id of zero. Other nodes are given a unique id when they are created.
isInvisible
val isInvisible: Boolean
Whether the node is invisible.
A node whose rect is outside of the bounds of the screen and hence not reachable for users is considered invisible if its semantic information is not merged into a (partially) visible parent as indicated by isMergedIntoParent.
An invisible node can be safely dropped from the semantic tree without loosing semantic information that is relevant for describing the content currently shown on screen.
isMergedIntoParent
var isMergedIntoParent: Boolean
Whether this node merges its semantic information into an ancestor node.
isPartOfNodeMerging
val isPartOfNodeMerging: Boolean
Whether this node is taking part in a merge of semantic information.
This returns true if the node is either merged into an ancestor node or if decedent nodes are merged into this node.
See also:
mergeAllDescendantsIntoThisNode
var mergeAllDescendantsIntoThisNode: Boolean
Whether this node and all of its descendants should be treated as one logical entity.
owner
var owner: SemanticsOwner?
The owner for this node (null if unattached).
The entire subtree that this node belongs to will have the same owner.
parentPaintClipRect
var parentPaintClipRect: Rect?
The paint clip from an ancestor that was applied to this node.
Expressed in the coordinate system of the node. May be null if no clip has been applied.
Descendant SemanticsNodes that are positioned outside of this rect will either be excluded from the semantics tree (if they have no overlap with parentSemanticsClipRect) or they will be included and marked as hidden (if they are overlapping with parentSemanticsClipRect).
This rect is completely enclosed by parentSemanticsClipRect.
If this rect is null parentSemanticsClipRect also has to be null.
parentSemanticsClipRect
var parentSemanticsClipRect: Rect?
The semantic clip from an ancestor that was applied to this node.
Expressed in the coordinate system of the node. May be null if no clip has been applied.
Descendant SemanticsNodes that are positioned outside of this rect will be excluded from the semantics tree. Descendant SemanticsNodes that are overlapping with this rect, but are outside of parentPaintClipRect will be included in the tree, but they will be marked as hidden because they are assumed to be not visible on screen.
If this rect is null, all descendant SemanticsNodes outside of parentPaintClipRect will be excluded from the tree.
If this rect is non-null it has to completely enclose parentPaintClipRect. If parentPaintClipRect is null this property is also null.
Companion functions
root
fun root(owner: SemanticsOwner): SemanticsNode