Added in API level 23

ViewNode


open class ViewNode
kotlin.Any
   ↳ android.app.assist.AssistStructure.ViewNode

Describes a single view in the assist data.

Summary

Constants
static Int

Magic value for text color that has not been defined, which is very unlikely to be confused with a real text color.

static Int

static Int

static Int

static Int

Public methods
open Float

Returns the alpha transformation of the view, used to reduce the overall opacity of the view's contents, as set by ViewStructure.setAlpha(float).

open Array<String!>?

Describes the content of a view so that a autofill service can fill in the appropriate data.

open AutofillId?

Gets the id that can be used to autofill the view contents.

open Array<CharSequence!>?

Gets the options that can be used to autofill this view.

open Int

Gets the type of value that can be used to autofill the view contents.

open AutofillValue?

Gets the value of this view.

open AssistStructure.ViewNode!
getChildAt(index: Int)

Return a child of this node, given an index value from 0 to getChildCount()-1.

open Int

Return the number of children this node has.

open String?

Returns the class name of the node's implementation, indicating its behavior.

open CharSequence?

Returns any content description associated with the node, which semantically describes its purpose for accessibility and other uses.

open Float

Returns the visual elevation of the view, used for shadowing and other visual characterstics, as set by ViewStructure.setElevation(float).

open Bundle?

Return a Bundle containing optional vendor-specific extension information.

open Int

Returns the height of this view, in pixels.

open String?

Return additional hint text associated with the node; this is typically used with a node that takes user input, describing to the user what the input means.

open String?

Gets the identifier used to set the hint associated with this view.

open ViewStructure.HtmlInfo?

Returns the HTML properties associated with this view.

open Int

Returns the ID associated with this view, as per View.getId().

open String?

If getId() is a resource identifier, this is the entry name of that identifier.

open String?

If getId() is a resource identifier, this is the package name of that identifier.

open String?

If getId() is a resource identifier, this is the type name of that identifier.

open Int

Gets the importantForAutofill mode of the view associated with this node.

open Int

Gets the android.text.InputType bits of this structure.

open Int

Returns the left edge of this view, in pixels, relative to the left edge of its parent.

open LocaleList?

Returns the list of locales associated with this view.

open Int

Returns the maximum width in ems of the text associated with this node, or -1 if not supported by the node.

open Int

Returns the maximum length of the text associated with this node, or -1 if not supported by the node or not set.

open Int

Returns the minimum width in ems of the text associated with this node, or -1 if not supported by the node.

open Array<String!>?

Returns the MIME types accepted by View#performReceiveContent for this view.

open Int

Returns the current X scroll offset of this view, as per View.getScrollX().

open Int

Returns the current Y scroll offset of this view, as per View.getScrollY().

open CharSequence?

Returns any text associated with the node that is displayed to the user, or null if there is none.

open Int

If getText() is non-null, this is the main text background color associated with it.

open Int

If getText() is non-null, this is the main text color associated with it.

open String?

Gets the identifier used to set the text associated with this view.

open IntArray?

Return per-line baselines into the text returned by getText().

open IntArray?

Return per-line offsets into the text returned by getText().

open Int

If getText() is non-null, this is where the current selection starts.

open Int

If getText() is non-null, this is where the current selection starts.

open Float

If getText() is non-null, this is the main text size (in pixels) associated with it.

open Int

If getText() is non-null, this is the main text style associated with it, containing a bit mask of TEXT_STYLE_BOLD, TEXT_STYLE_BOLD, TEXT_STYLE_STRIKE_THRU, and/or TEXT_STYLE_UNDERLINE.

open Int

Returns the top edge of this view, in pixels, relative to the top edge of its parent.

open Matrix!

Returns the transformation that has been applied to this view, such as a translation or scaling.

open Int

Returns the visibility mode of this view, as per View.getVisibility().

open String?

Returns the domain of the HTML document represented by this view.

open String?

Returns the scheme of the HTML document represented by this view.

open Int

Returns the width of this view, in pixels.

open Boolean

Returns true if this node currently had accessibility focus at the time that the structure was collected.

open Boolean

Returns true if this node has currently been activated by the user.

open Boolean

Returns true if assist data has been blocked starting at this node in the hierarchy.

open Boolean

Returns true if this node represents something that is checkable by the user.

open Boolean

Returns true if this node is currently in a checked state.

open Boolean

Returns true if this node is clickable by the user.

open Boolean

Returns true if this node is something the user can perform a context click on.

open Boolean

Returns true if this node is in an enabled state.

open Boolean

Returns true if this node can take input focus.

open Boolean

Returns true if this node currently had input focus at the time that the structure was collected.

open Boolean

Returns true if this node is something the user can perform a long click/press on.

open Boolean

Returns true if this node is opaque.

open Boolean

Returns true if this node has currently been selected by the user.

Constants

TEXT_COLOR_UNDEFINED

Added in API level 23
static val TEXT_COLOR_UNDEFINED: Int

Magic value for text color that has not been defined, which is very unlikely to be confused with a real text color.

Value: 1

TEXT_STYLE_BOLD

Added in API level 23
static val TEXT_STYLE_BOLD: Int
Value: 1

TEXT_STYLE_ITALIC

Added in API level 23
static val TEXT_STYLE_ITALIC: Int
Value: 2

TEXT_STYLE_STRIKE_THRU

Added in API level 23
static val TEXT_STYLE_STRIKE_THRU: Int
Value: 8

TEXT_STYLE_UNDERLINE

Added in API level 23
static val TEXT_STYLE_UNDERLINE: Int
Value: 4

Public methods

getAlpha

Added in API level 23
open fun getAlpha(): Float

Returns the alpha transformation of the view, used to reduce the overall opacity of the view's contents, as set by ViewStructure.setAlpha(float).

It's only relevant when the AssistStructure is used for assist purposes, not for autofill purposes.

getAutofillHints

Added in API level 26
open fun getAutofillHints(): Array<String!>?

Describes the content of a view so that a autofill service can fill in the appropriate data.

It's only relevant when the AssistStructure is used for autofill purposes, not for Assist - see View#getAutofillHints() for more info.

Return
Array<String!>? The autofill hints for this view, or null if the structure was created for assist purposes.

getAutofillId

Added in API level 26
open fun getAutofillId(): AutofillId?

Gets the id that can be used to autofill the view contents.

It's only relevant when the AssistStructure is used for autofill purposes.

Return
AutofillId? id that can be used to autofill the view contents, or null if the structure was created for assist purposes.

getAutofillOptions

Added in API level 26
open fun getAutofillOptions(): Array<CharSequence!>?

Gets the options that can be used to autofill this view.

Typically used by nodes whose View#getAutofillType() is a list to indicate the meaning of each possible value in the list.

It's relevant when the AssistStructure is used for autofill purposes, not for assist purposes.

Return
Array<CharSequence!>? the options that can be used to autofill this view, or null if the structure was created for assist purposes.

getAutofillType

Added in API level 26
open fun getAutofillType(): Int

Gets the type of value that can be used to autofill the view contents.

It's only relevant when the AssistStructure is used for autofill purposes.

Return
Int autofill type as defined by View#getAutofillType(), or View#AUTOFILL_TYPE_NONE if the structure was created for assist purposes. Value is android.view.View#AUTOFILL_TYPE_NONE, android.view.View#AUTOFILL_TYPE_TEXT, android.view.View#AUTOFILL_TYPE_TOGGLE, android.view.View#AUTOFILL_TYPE_LIST, or android.view.View#AUTOFILL_TYPE_DATE

getAutofillValue

Added in API level 26
open fun getAutofillValue(): AutofillValue?

Gets the value of this view.

It's only relevant when the AssistStructure is used for autofill purposes, not for assist purposes.

Return
AutofillValue? the autofill value of this view, or null if the structure was created for assist purposes.

getChildAt

Added in API level 23
open fun getChildAt(index: Int): AssistStructure.ViewNode!

Return a child of this node, given an index value from 0 to getChildCount()-1.

getChildCount

Added in API level 23
open fun getChildCount(): Int

Return the number of children this node has.

getClassName

Added in API level 23
open fun getClassName(): String?

Returns the class name of the node's implementation, indicating its behavior. For example, a button will report "android.widget.Button" meaning it behaves like a android.widget.Button.

Return
String? This value may be null.

getContentDescription

Added in API level 23
open fun getContentDescription(): CharSequence?

Returns any content description associated with the node, which semantically describes its purpose for accessibility and other uses.

Return
CharSequence? This value may be null.

getElevation

Added in API level 23
open fun getElevation(): Float

Returns the visual elevation of the view, used for shadowing and other visual characterstics, as set by ViewStructure.setElevation(float).

It's only relevant when the AssistStructure is used for assist purposes, not for autofill purposes.

getExtras

Added in API level 23
open fun getExtras(): Bundle?

Return a Bundle containing optional vendor-specific extension information.

Return
Bundle? This value may be null.

getHeight

Added in API level 23
open fun getHeight(): Int

Returns the height of this view, in pixels.

getHint

Added in API level 23
open fun getHint(): String?

Return additional hint text associated with the node; this is typically used with a node that takes user input, describing to the user what the input means.

Return
String? This value may be null.

getHintIdEntry

Added in API level 30
open fun getHintIdEntry(): String?

Gets the identifier used to set the hint associated with this view.

It's only relevant when the AssistStructure is used for autofill purposes, not for assist purposes.

Return
String? This value may be null.

getHtmlInfo

Added in API level 26
open fun getHtmlInfo(): ViewStructure.HtmlInfo?

Returns the HTML properties associated with this view.

It's only relevant when the AssistStructure is used for autofill purposes, not for assist purposes.

Return
ViewStructure.HtmlInfo? the HTML properties associated with this view, or null if the structure was created for assist purposes.

getId

Added in API level 23
open fun getId(): Int

Returns the ID associated with this view, as per View.getId().

getIdEntry

Added in API level 23
open fun getIdEntry(): String?

If getId() is a resource identifier, this is the entry name of that identifier. See ViewStructure.setId for more information.

Return
String? This value may be null.

getIdPackage

Added in API level 23
open fun getIdPackage(): String?

If getId() is a resource identifier, this is the package name of that identifier. See ViewStructure.setId for more information.

Return
String? This value may be null.

getIdType

Added in API level 23
open fun getIdType(): String?

If getId() is a resource identifier, this is the type name of that identifier. See ViewStructure.setId for more information.

Return
String? This value may be null.

getInputType

Added in API level 26
open fun getInputType(): Int

Gets the android.text.InputType bits of this structure.

Return
Int bits as defined by android.text.InputType.

getLeft

Added in API level 23
open fun getLeft(): Int

Returns the left edge of this view, in pixels, relative to the left edge of its parent.

getLocaleList

Added in API level 26
open fun getLocaleList(): LocaleList?

Returns the list of locales associated with this view.

Return
LocaleList? This value may be null.

getMaxTextEms

Added in API level 28
open fun getMaxTextEms(): Int

Returns the maximum width in ems of the text associated with this node, or -1 if not supported by the node.

It's only relevant when the AssistStructure is used for autofill purposes, not for assist purposes.

getMaxTextLength

Added in API level 28
open fun getMaxTextLength(): Int

Returns the maximum length of the text associated with this node, or -1 if not supported by the node or not set. System may set a default value if the text length is not set.

It's only relevant when the AssistStructure is used for autofill purposes, not for assist purposes.

getMinTextEms

Added in API level 28
open fun getMinTextEms(): Int

Returns the minimum width in ems of the text associated with this node, or -1 if not supported by the node.

It's only relevant when the AssistStructure is used for autofill purposes, not for assist purposes.

getReceiveContentMimeTypes

Added in API level 31
open fun getReceiveContentMimeTypes(): Array<String!>?

Returns the MIME types accepted by View#performReceiveContent for this view. See View#getReceiveContentMimeTypes() for details.

Return
Array<String!>? This value may be null.

getScrollX

Added in API level 23
open fun getScrollX(): Int

Returns the current X scroll offset of this view, as per View.getScrollX().

getScrollY

Added in API level 23
open fun getScrollY(): Int

Returns the current Y scroll offset of this view, as per View.getScrollY().

getText

Added in API level 23
open fun getText(): CharSequence?

Returns any text associated with the node that is displayed to the user, or null if there is none.

The text will be stripped of any spans that could potentially contain reference to the activity context, to avoid memory leak. If the text contained a span, a plain string version of the text will be returned.

getTextBackgroundColor

Added in API level 23
open fun getTextBackgroundColor(): Int

If getText() is non-null, this is the main text background color associated with it. If there is no text background color, TEXT_COLOR_UNDEFINED is returned. Note that the text may also contain style spans that modify the color of specific parts of the text.

It's only relevant when the AssistStructure is used for assist purposes, not for autofill purposes.

getTextColor

Added in API level 23
open fun getTextColor(): Int

If getText() is non-null, this is the main text color associated with it. If there is no text color, TEXT_COLOR_UNDEFINED is returned. Note that the text may also contain style spans that modify the color of specific parts of the text.

getTextIdEntry

Added in API level 28
open fun getTextIdEntry(): String?

Gets the identifier used to set the text associated with this view.

It's only relevant when the AssistStructure is used for autofill purposes, not for assist purposes.

Return
String? This value may be null.

getTextLineBaselines

Added in API level 23
open fun getTextLineBaselines(): IntArray?

Return per-line baselines into the text returned by getText(). Each entry in the array is a formatted line of text, and the value it contains is the baseline where that text appears in the view. May return null if there is no line information.

It's only relevant when the AssistStructure is used for assist purposes, not for autofill purposes.

getTextLineCharOffsets

Added in API level 23
open fun getTextLineCharOffsets(): IntArray?

Return per-line offsets into the text returned by getText(). Each entry in the array is a formatted line of text, and the value it contains is the offset into the text string where that line starts. May return null if there is no line information.

It's only relevant when the AssistStructure is used for assist purposes, not for autofill purposes.

getTextSelectionEnd

Added in API level 23
open fun getTextSelectionEnd(): Int

If getText() is non-null, this is where the current selection starts. If there is no selection, returns the same value as getTextSelectionStart(), indicating the cursor position.

It's only relevant when the AssistStructure is used for assist purposes, not for autofill purposes.

getTextSelectionStart

Added in API level 23
open fun getTextSelectionStart(): Int

If getText() is non-null, this is where the current selection starts.

It's only relevant when the AssistStructure is used for assist purposes, not for autofill purposes.

getTextSize

Added in API level 23
open fun getTextSize(): Float

If getText() is non-null, this is the main text size (in pixels) associated with it. Note that the text may also contain style spans that modify the size of specific parts of the text.

It's only relevant when the AssistStructure is used for assist purposes, not for autofill purposes.

getTextStyle

Added in API level 23
open fun getTextStyle(): Int

If getText() is non-null, this is the main text style associated with it, containing a bit mask of TEXT_STYLE_BOLD, TEXT_STYLE_BOLD, TEXT_STYLE_STRIKE_THRU, and/or TEXT_STYLE_UNDERLINE. Note that the text may also contain style spans that modify the style of specific parts of the text.

It's only relevant when the AssistStructure is used for assist purposes, not for autofill purposes.

getTop

Added in API level 23
open fun getTop(): Int

Returns the top edge of this view, in pixels, relative to the top edge of its parent.

getTransformation

Added in API level 23
open fun getTransformation(): Matrix!

Returns the transformation that has been applied to this view, such as a translation or scaling. The returned Matrix object is owned by ViewNode; do not modify it. Returns null if there is no transformation applied to the view.

It's only relevant when the AssistStructure is used for assist purposes, not for autofill purposes.

getVisibility

Added in API level 23
open fun getVisibility(): Int

Returns the visibility mode of this view, as per View.getVisibility().

getWebDomain

Added in API level 26
open fun getWebDomain(): String?

Returns the domain of the HTML document represented by this view.

Typically used when the view associated with the view is a container for an HTML document.

Warning: an autofill service cannot trust the value reported by this method without verifing its authenticity—see the "Web security" section of android.service.autofill.AutofillService for more details.

Return
String? domain-only part of the document. For example, if the full URL is https://example.com/login?user=my_user, it returns example.com. This value may be null.

getWebScheme

Added in API level 28
open fun getWebScheme(): String?

Returns the scheme of the HTML document represented by this view.

Typically used when the view associated with the view is a container for an HTML document.

Return
String? scheme-only part of the document. For example, if the full URL is https://example.com/login?user=my_user, it returns https. This value may be null.

getWidth

Added in API level 23
open fun getWidth(): Int

Returns the width of this view, in pixels.

isAccessibilityFocused

Added in API level 23
open fun isAccessibilityFocused(): Boolean

Returns true if this node currently had accessibility focus at the time that the structure was collected.

isActivated

Added in API level 23
open fun isActivated(): Boolean

Returns true if this node has currently been activated by the user.

isAssistBlocked

Added in API level 23
open fun isAssistBlocked(): Boolean

Returns true if assist data has been blocked starting at this node in the hierarchy.

isCheckable

Added in API level 23
open fun isCheckable(): Boolean

Returns true if this node represents something that is checkable by the user.

isChecked

Added in API level 23
open fun isChecked(): Boolean

Returns true if this node is currently in a checked state.

isClickable

Added in API level 23
open fun isClickable(): Boolean

Returns true if this node is clickable by the user.

isContextClickable

Added in API level 23
open fun isContextClickable(): Boolean

Returns true if this node is something the user can perform a context click on.

isEnabled

Added in API level 23
open fun isEnabled(): Boolean

Returns true if this node is in an enabled state.

isFocusable

Added in API level 23
open fun isFocusable(): Boolean

Returns true if this node can take input focus.

isFocused

Added in API level 23
open fun isFocused(): Boolean

Returns true if this node currently had input focus at the time that the structure was collected.

isLongClickable

Added in API level 23
open fun isLongClickable(): Boolean

Returns true if this node is something the user can perform a long click/press on.

isOpaque

Added in API level 26
open fun isOpaque(): Boolean

Returns true if this node is opaque.

isSelected

Added in API level 23
open fun isSelected(): Boolean

Returns true if this node has currently been selected by the user.