ViewStructure
abstract class ViewStructure
kotlin.Any | |
↳ | android.view.ViewStructure |
ViewStructure
is a container for storing additional per-view data generated by View.onProvideStructure
and View.onProvideAutofillStructure
.
To learn more about using Autofill in your app, read the Autofill Framework guides.
Summary
Nested classes | |
---|---|
abstract |
Simplified representation of the HTML properties of a node that represents an HTML element. |
Public constructors | |
---|---|
Public methods | |
---|---|
abstract Int |
addChildCount(num: Int) Add to this view's child count. |
abstract Unit |
Call when done populating a |
abstract ViewStructure! |
asyncNewChild(index: Int) Like |
open Unit |
Clears the credential request previously set through |
abstract AutofillId? |
Gets the |
abstract Int |
Return the child count as set by |
abstract Bundle! |
Get extra data associated with this view structure; the returned Bundle is mutable, allowing you to view and modify its contents. |
abstract CharSequence! |
getHint() Retrieve the last hint set by |
open OutcomeReceiver<GetCredentialResponse!, GetCredentialException!>? |
Gets the |
open GetCredentialRequest? |
Gets the |
abstract CharSequence! |
getText() Retrieve the last |
abstract Int |
Retrieve the last selection end set by |
abstract Int |
Retrieve the last selection start set by |
abstract Boolean |
Returns true if |
abstract ViewStructure! |
Create a new child |
abstract ViewStructure.HtmlInfo.Builder! |
newHtmlInfoBuilder(tagName: String) Creates a new |
abstract Unit |
setAccessibilityFocused(state: Boolean) Set the accessibility focused state of this view, as per |
abstract Unit |
setActivated(state: Boolean) Set the activated state of this view, as per |
abstract Unit |
Set an alpha transformation that is applied to this view, as per |
abstract Unit |
setAutofillHints(hint: Array<String!>?) Sets the a hints that helps the autofill service to select the appropriate data to fill the view. |
abstract Unit |
setAutofillId(id: AutofillId) Sets the |
abstract Unit |
setAutofillId(parentId: AutofillId, virtualId: Int) Sets the |
abstract Unit |
setAutofillOptions(options: Array<CharSequence!>!) Sets the options that can be used to autofill this node. |
abstract Unit |
setAutofillType(type: Int) Sets the |
abstract Unit |
setAutofillValue(value: AutofillValue!) Sets the |
abstract Unit |
setCheckable(state: Boolean) Set the checkable state of this view, such as whether it implements the |
abstract Unit |
setChecked(state: Boolean) Set the checked state of this view, such as |
abstract Unit |
setChildCount(num: Int) Set the number of children of this view, which defines the range of indices you can use with |
abstract Unit |
setClassName(className: String!) Set the class name of the view, as per |
abstract Unit |
setClickable(state: Boolean) Set the clickable state of this view, as per |
abstract Unit |
setContentDescription(contentDescription: CharSequence!) Set the content description of the view, as per |
abstract Unit |
setContextClickable(state: Boolean) Set the context clickable state of this view, as per |
abstract Unit |
setDataIsSensitive(sensitive: Boolean) Sets whether the data on this node is sensitive; if it is, then its content (text, autofill value, etc..) is striped before calls to |
abstract Unit |
Set the basic dimensions of this view. |
abstract Unit |
setElevation(elevation: Float) Set the visual elevation (shadow) of the view, as per |
abstract Unit |
setEnabled(state: Boolean) Set the enabled state of this view, as per |
abstract Unit |
setFocusable(state: Boolean) Set the focusable state of this view, as per |
abstract Unit |
setFocused(state: Boolean) Set the focused state of this view, as per |
abstract Unit |
setHint(hint: CharSequence!) Set optional hint text associated with this view; this is for example the text that is shown by an EditText when it is empty to indicate to the user the kind of text to input. |
open Unit |
setHintIdEntry(entryName: String) Sets the identifier used to set the hint associated with this view. |
abstract Unit |
setHtmlInfo(htmlInfo: ViewStructure.HtmlInfo) Sets the HTML properties of this node when it represents an HTML element. |
abstract Unit |
Set the identifier for this view. |
open Unit |
setImportantForAutofill(mode: Int) Sets the |
abstract Unit |
setInputType(inputType: Int) Sets the |
abstract Unit |
setLocaleList(localeList: LocaleList!) Sets the the list of locales associated with this node. |
abstract Unit |
setLongClickable(state: Boolean) Set the long clickable state of this view, as per |
open Unit |
setMaxTextEms(maxEms: Int) Sets the maximum width in ems of the text associated with this view, when supported. |
open Unit |
setMaxTextLength(maxLength: Int) Sets the maximum length of the text associated with this view, when supported. |
open Unit |
setMinTextEms(minEms: Int) Sets the minimum width in ems of the text associated with this view, when supported. |
abstract Unit |
Set the opaque state of this view, as per |
open Unit |
setPendingCredentialRequest(request: GetCredentialRequest, callback: OutcomeReceiver<GetCredentialResponse!, GetCredentialException!>) Sets a credential request to be fired to |
open Unit |
setReceiveContentMimeTypes(mimeTypes: Array<String!>?) Sets the MIME types accepted by this view. |
abstract Unit |
setSelected(state: Boolean) Set the selected state of this view, as per |
abstract Unit |
setText(text: CharSequence!) Set the text that is associated with this view. |
abstract Unit |
setText(text: CharSequence!, selectionStart: Int, selectionEnd: Int) Like |
open Unit |
setTextIdEntry(entryName: String) Sets the identifier used to set the text associated with this view. |
abstract Unit |
setTextLines(charOffsets: IntArray!, baselines: IntArray!) Set line information for test that was previously supplied through |
abstract Unit |
setTextStyle(size: Float, fgColor: Int, bgColor: Int, style: Int) Explicitly set default global style information for text that was previously set with #setText. |
abstract Unit |
setTransformation(matrix: Matrix!) Set the transformation matrix associated with this view, as per |
abstract Unit |
setVisibility(visibility: Int) Set the visibility state of this view, as per |
abstract Unit |
setWebDomain(domain: String?) Sets the Web domain represented by this node. |
Public constructors
ViewStructure
ViewStructure()
Public methods
addChildCount
abstract fun addChildCount(num: Int): Int
Add to this view's child count. This increases the current child count by num children beyond what was last set by setChildCount
or addChildCount
. The index at which the new child starts in the child array is returned.
Parameters | |
---|---|
num |
Int: The number of new children to add. |
Return | |
---|---|
Int |
Returns the index in the child array at which the new children start. |
asyncCommit
abstract fun asyncCommit(): Unit
Call when done populating a ViewStructure
returned by asyncNewChild
.
asyncNewChild
abstract fun asyncNewChild(index: Int): ViewStructure!
Like newChild
, but allows the caller to asynchronously populate the returned child. It can transfer the returned ViewStructure
to another thread for it to build its content (and children etc). Once done, some thread must call asyncCommit
to tell the containing ViewStructure
that the async population is done.
NOTE: you must pre-allocate space for the child first, by calling either addChildCount(int)
or setChildCount(int)
.
Return | |
---|---|
ViewStructure! |
Returns an fresh ViewStructure ready to be filled in. |
clearCredentialManagerRequest
open fun clearCredentialManagerRequest(): Unit
Clears the credential request previously set through ViewStructure#setPendingCredentialRequest(GetCredentialRequest, OutcomeReceiver)
getAutofillId
abstract fun getAutofillId(): AutofillId?
Gets the AutofillId
associated with this node.
Return | |
---|---|
AutofillId? |
This value may be null . |
getChildCount
abstract fun getChildCount(): Int
Return the child count as set by setChildCount
.
getExtras
abstract fun getExtras(): Bundle!
Get extra data associated with this view structure; the returned Bundle is mutable, allowing you to view and modify its contents. Keys placed in the Bundle should use an appropriate namespace prefix (such as com.google.MY_KEY) to avoid conflicts.
getHint
abstract fun getHint(): CharSequence!
Retrieve the last hint set by setHint
.
getPendingCredentialCallback
open fun getPendingCredentialCallback(): OutcomeReceiver<GetCredentialResponse!, GetCredentialException!>?
Gets the callback
associated with this node.
If null, no callback or request is associated with this node, and hence no android.credentials.CredentialManager
request will be fired when this node is focused.
For details on how a request and callback can be set, see ViewStructure#setPendingCredentialRequest(GetCredentialRequest, OutcomeReceiver)
getPendingCredentialRequest
open fun getPendingCredentialRequest(): GetCredentialRequest?
Gets the GetCredentialRequest
associated with this node.
If null, no request is associated with this node, and hence no android.credentials.CredentialManager
request will be fired when this node is focused.
For details on how a request and callback can be set, see ViewStructure#setPendingCredentialRequest(GetCredentialRequest, OutcomeReceiver)
getText
abstract fun getText(): CharSequence!
Retrieve the last setText(java.lang.CharSequence)
.
getTextSelectionEnd
abstract fun getTextSelectionEnd(): Int
Retrieve the last selection end set by setText(java.lang.CharSequence,int,int)
.
getTextSelectionStart
abstract fun getTextSelectionStart(): Int
Retrieve the last selection start set by setText(java.lang.CharSequence,int,int)
.
hasExtras
abstract fun hasExtras(): Boolean
Returns true if getExtras
has been used to create extra content.
newChild
abstract fun newChild(index: Int): ViewStructure!
Create a new child ViewStructure
in this view, putting into the list of children at index.
NOTE: you must pre-allocate space for the child first, by calling either addChildCount(int)
or setChildCount(int)
.
Return | |
---|---|
ViewStructure! |
Returns an fresh ViewStructure ready to be filled in. |
newHtmlInfoBuilder
abstract fun newHtmlInfoBuilder(tagName: String): ViewStructure.HtmlInfo.Builder!
Creates a new HtmlInfo.Builder
for the given HTML tag.
Parameters | |
---|---|
tagName |
String: name of the HTML tag. This value cannot be null . |
Return | |
---|---|
ViewStructure.HtmlInfo.Builder! |
a new builder. |
setAccessibilityFocused
abstract fun setAccessibilityFocused(state: Boolean): Unit
Set the accessibility focused state of this view, as per View.isAccessibilityFocused()
.
setActivated
abstract fun setActivated(state: Boolean): Unit
Set the activated state of this view, as per View.isActivated()
.
setAlpha
abstract fun setAlpha(alpha: Float): Unit
Set an alpha transformation that is applied to this view, as per View.getAlpha()
. Value ranges from 0 (completely transparent) to 1 (completely opaque); the default is 1, which means no transformation.
setAutofillHints
abstract fun setAutofillHints(hint: Array<String!>?): Unit
Sets the a hints that helps the autofill service to select the appropriate data to fill the view.
Parameters | |
---|---|
hint |
Array<String!>?: This value may be null . |
setAutofillId
abstract fun setAutofillId(id: AutofillId): Unit
Sets the AutofillId
associated with this node.
Parameters | |
---|---|
id |
AutofillId: This value cannot be null . |
setAutofillId
abstract fun setAutofillId(
parentId: AutofillId,
virtualId: Int
): Unit
Sets the AutofillId
for this virtual node.
Parameters | |
---|---|
parentId |
AutofillId: id of the parent node. This value cannot be null . |
virtualId |
Int: an opaque ID to the Android System; it's the same id used on View#autofill(android.util.SparseArray) . |
setAutofillOptions
abstract fun setAutofillOptions(options: Array<CharSequence!>!): Unit
Sets the options that can be used to autofill this node.
Typically used by nodes whose View#getAutofillType()
is a list to indicate the meaning of each possible value in the list.
setAutofillType
abstract fun setAutofillType(type: Int): Unit
Sets the View#getAutofillType()
that can be used to autofill this node.
setAutofillValue
abstract fun setAutofillValue(value: AutofillValue!): Unit
Sets the AutofillValue
representing the current value of this node.
setCheckable
abstract fun setCheckable(state: Boolean): Unit
Set the checkable state of this view, such as whether it implements the android.widget.Checkable
interface.
setChecked
abstract fun setChecked(state: Boolean): Unit
Set the checked state of this view, such as Checkable.isChecked()
.
setChildCount
abstract fun setChildCount(num: Int): Unit
Set the number of children of this view, which defines the range of indices you can use with newChild
and asyncNewChild
. Calling this method again resets all of the child state of the view, removing any children that had previously been added.
setClassName
abstract fun setClassName(className: String!): Unit
Set the class name of the view, as per View.getAccessibilityClassName()
.
setClickable
abstract fun setClickable(state: Boolean): Unit
Set the clickable state of this view, as per View.isClickable()
.
setContentDescription
abstract fun setContentDescription(contentDescription: CharSequence!): Unit
Set the content description of the view, as per View.getContentDescription()
.
setContextClickable
abstract fun setContextClickable(state: Boolean): Unit
Set the context clickable state of this view, as per View.isContextClickable()
.
setDataIsSensitive
abstract fun setDataIsSensitive(sensitive: Boolean): Unit
Sets whether the data on this node is sensitive; if it is, then its content (text, autofill value, etc..) is striped before calls to android.service.autofill.AutofillService#onFillRequest(android.service.autofill.FillRequest, * android.os.CancellationSignal, android.service.autofill.FillCallback)
.
By default, all nodes are assumed to be sensitive, and only nodes that does not have PII (Personally Identifiable Information - sensitive data such as email addresses, credit card numbers, passwords, etc...) should be marked as non-sensitive; a good rule of thumb is to mark as non-sensitive nodes whose value were statically set from resources.
Notice that the content of even sensitive nodes are sent to the service (through the android.service.autofill.AutofillService#onSaveRequest(android.service.autofill.SaveRequest, * android.service.autofill.SaveCallback)
call) when the user consented to save thedata, so it is important to set the content of sensitive nodes as well, but mark them as sensitive.
Should only be set when the node is used for autofill purposes - it will be ignored when used for Assist.
setDimens
abstract fun setDimens(
left: Int,
top: Int,
scrollX: Int,
scrollY: Int,
width: Int,
height: Int
): Unit
Set the basic dimensions of this view.
Parameters | |
---|---|
left |
Int: The view's left position, in pixels relative to its parent's left edge. |
top |
Int: The view's top position, in pixels relative to its parent's top edge. |
scrollX |
Int: How much the view's x coordinate space has been scrolled, in pixels. |
scrollY |
Int: How much the view's y coordinate space has been scrolled, in pixels. |
width |
Int: The view's visible width, in pixels. This is the width visible on screen, not the total data width of a scrollable view. |
height |
Int: The view's visible height, in pixels. This is the height visible on screen, not the total data height of a scrollable view. |
setElevation
abstract fun setElevation(elevation: Float): Unit
Set the visual elevation (shadow) of the view, as per View.getZ()
. Note this is not related to the physical Z-ordering of this view relative to its other siblings (that is how they overlap when drawing), it is only the visual representation for shadowing.
setEnabled
abstract fun setEnabled(state: Boolean): Unit
Set the enabled state of this view, as per View.isEnabled()
.
setFocusable
abstract fun setFocusable(state: Boolean): Unit
Set the focusable state of this view, as per View.isFocusable()
.
setFocused
abstract fun setFocused(state: Boolean): Unit
Set the focused state of this view, as per View.isFocused()
.
setHint
abstract fun setHint(hint: CharSequence!): Unit
Set optional hint text associated with this view; this is for example the text that is shown by an EditText when it is empty to indicate to the user the kind of text to input.
setHintIdEntry
open fun setHintIdEntry(entryName: String): Unit
Sets the identifier used to set the hint associated with this view.
Used as metadata for fingerprinting view nodes/structures.
Should only be set when the node is used for autofill purposes - it will be ignored when used for Assist.
Parameters | |
---|---|
entryName |
String: This value cannot be null . |
setHtmlInfo
abstract fun setHtmlInfo(htmlInfo: ViewStructure.HtmlInfo): Unit
Sets the HTML properties of this node when it represents an HTML element.
Should only be set when the node is used for autofill purposes - it will be ignored when used for assist.
Parameters | |
---|---|
htmlInfo |
ViewStructure.HtmlInfo: HTML properties. This value cannot be null . |
setId
abstract fun setId(
id: Int,
packageName: String!,
typeName: String!,
entryName: String!
): Unit
Set the identifier for this view.
Parameters | |
---|---|
id |
Int: The view's identifier, as per View.getId() . |
packageName |
String!: The package name of the view's identifier, or null if there is none. |
typeName |
String!: The type name of the view's identifier, or null if there is none. |
entryName |
String!: The entry name of the view's identifier, or null if there is none. |
setImportantForAutofill
open fun setImportantForAutofill(mode: Int): Unit
Sets the importantForAutofill mode
of the view associated with this node.
setInputType
abstract fun setInputType(inputType: Int): Unit
Sets the android.text.InputType
bits of this node.
Parameters | |
---|---|
inputType |
Int: inputType bits as defined by android.text.InputType . |
setLocaleList
abstract fun setLocaleList(localeList: LocaleList!): Unit
Sets the the list of locales associated with this node.
setLongClickable
abstract fun setLongClickable(state: Boolean): Unit
Set the long clickable state of this view, as per View.isLongClickable()
.
setMaxTextEms
open fun setMaxTextEms(maxEms: Int): Unit
Sets the maximum width in ems of the text associated with this view, when supported.
Should only be set when the node is used for autofill purposes - it will be ignored when used for Assist.
setMaxTextLength
open fun setMaxTextLength(maxLength: Int): Unit
Sets the maximum length of the text associated with this view, when supported.
Should only be set when the node is used for autofill purposes - it will be ignored when used for Assist.
setMinTextEms
open fun setMinTextEms(minEms: Int): Unit
Sets the minimum width in ems of the text associated with this view, when supported.
Should only be set when the node is used for autofill purposes - it will be ignored when used for Assist.
setOpaque
abstract fun setOpaque(opaque: Boolean): Unit
Set the opaque state of this view, as per View.isOpaque()
.
setPendingCredentialRequest
open fun setPendingCredentialRequest(
request: GetCredentialRequest,
callback: OutcomeReceiver<GetCredentialResponse!, GetCredentialException!>
): Unit
Sets a credential request to be fired to android.credentials.CredentialManager
when this node is focused
Parameters | |
---|---|
request |
GetCredentialRequest: the request to be fired This value cannot be null . |
callback |
OutcomeReceiver<GetCredentialResponse!, GetCredentialException!>: the callback where the response or exception, is returned This value cannot be null . |
setReceiveContentMimeTypes
open fun setReceiveContentMimeTypes(mimeTypes: Array<String!>?): Unit
Sets the MIME types accepted by this view. See View#getReceiveContentMimeTypes()
.
Should only be set when the node is used for Autofill or Content Capture purposes - it will be ignored when used for Assist.
Parameters | |
---|---|
mimeTypes |
Array<String!>?: This value may be null . |
setSelected
abstract fun setSelected(state: Boolean): Unit
Set the selected state of this view, as per View.isSelected()
.
setText
abstract fun setText(text: CharSequence!): Unit
Set the text that is associated with this view. There is no selection associated with the text. The text may have style spans to supply additional display and semantic information.
setText
abstract fun setText(
text: CharSequence!,
selectionStart: Int,
selectionEnd: Int
): Unit
Like setText(java.lang.CharSequence)
but with an active selection extending from selectionStart through selectionEnd.
setTextIdEntry
open fun setTextIdEntry(entryName: String): Unit
Sets the identifier used to set the text associated with this view.
Should only be set when the node is used for autofill purposes - it will be ignored when used for Assist.
Parameters | |
---|---|
entryName |
String: This value cannot be null . |
setTextLines
abstract fun setTextLines(
charOffsets: IntArray!,
baselines: IntArray!
): Unit
Set line information for test that was previously supplied through setText(java.lang.CharSequence)
. This provides the line breaking of the text as it is shown on screen. This function takes ownership of the provided arrays; you should not make further modification to them.
Parameters | |
---|---|
charOffsets |
IntArray!: The offset in to #setText where a line starts. |
baselines |
IntArray!: The baseline where the line is drawn on screen. |
setTextStyle
abstract fun setTextStyle(
size: Float,
fgColor: Int,
bgColor: Int,
style: Int
): Unit
Explicitly set default global style information for text that was previously set with #setText.
Parameters | |
---|---|
size |
Float: The size, in pixels, of the text. |
fgColor |
Int: The foreground color, packed as 0xAARRGGBB. |
bgColor |
Int: The background color, packed as 0xAARRGGBB. |
style |
Int: Style flags, as defined by android.app.assist.AssistStructure.ViewNode . |
setTransformation
abstract fun setTransformation(matrix: Matrix!): Unit
Set the transformation matrix associated with this view, as per View.getMatrix()
, or null if there is none.
setVisibility
abstract fun setVisibility(visibility: Int): Unit
Set the visibility state of this view, as per View.getVisibility()
.
setWebDomain
abstract fun setWebDomain(domain: String?): Unit
Sets the Web domain represented by this node.
Typically used when the view is a container for an HTML document.
Parameters | |
---|---|
domain |
String?: RFC 2396-compliant URI representing the domain. This value may be null . |