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. |
| Constants | |
|---|---|
| static String |
Key used for writing the type of the view that generated the virtual structure of its children. |
| static String |
Key used for specifying the version of the view that generated the virtual structure for itself and its children |
| 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. |
Constants
EXTRA_VIRTUAL_STRUCTURE_TYPE
static val EXTRA_VIRTUAL_STRUCTURE_TYPE: String
Key used for writing the type of the view that generated the virtual structure of its children.
For example, if the virtual structure is generated by a webview, the value would be "WebView". If the virtual structure is generated by a compose view, then the value would be "ComposeView". The value is of type String.
This value is added to mainly help with debugging purpose.
Value: "android.view.extra.VIRTUAL_STRUCTURE_TYPE"EXTRA_VIRTUAL_STRUCTURE_VERSION_NUMBER
static val EXTRA_VIRTUAL_STRUCTURE_VERSION_NUMBER: String
Key used for specifying the version of the view that generated the virtual structure for itself and its children
For example, if the virtual structure is generated by a webview of version "104.0.5112.69", then the value should be "104.0.5112.69"
Value: "android.view.extra.VIRTUAL_STRUCTURE_VERSION_NUMBER"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(CharSequence).
getTextSelectionEnd
abstract fun getTextSelectionEnd(): Int
Retrieve the last selection end set by setText(CharSequence,int,int).
getTextSelectionStart
abstract fun getTextSelectionStart(): Int
Retrieve the last selection start set by setText(CharSequence,int,int).