MathInfo
class MathInfo : AccessibilityNodeInfo.StructuredDataInfo, Parcelable
| kotlin.Any | ||
| ↳ | android.view.accessibility.AccessibilityNodeInfo.StructuredDataInfo | |
| ↳ | android.view.accessibility.AccessibilityNodeInfo.MathInfo | |
A class that holds information about a node that represents a mathematical expression.
This class's structure is based on the concepts and tags defined in the W3C MathML standard. An accessibility service can use this information to provide a richer experience for users interacting with mathematical content. For example, a screen reader could use the tag and attributes to correctly pronounce a fraction and allow the user to navigate between the numerator and the denominator.
To add math information to a node, create an instance of MathInfo, set its attributes using putAttribute(String,String), and then call setStructuredDataInfo(StructuredDataInfo) on the AccessibilityNodeInfo.
Summary
| Constants | |
|---|---|
| static String |
An attribute used to associate a child element with one of the arguments in its parent's |
| static String |
An attribute that provides a semantic annotation for the element on which it is specified. |
| static String |
An element for creating fractions. |
| static String |
An element for symbolic names or arbitrary text to be rendered as an identifier. |
| static String |
The top-level root element that encapsulates a MathML expression. |
| static String |
An element for attaching any number of prescripts and postscripts to a base expression. |
| static String |
Represents an empty element, often used as a placeholder in elements like |
| static String |
An element for a numeric literal. |
| static String |
An element for an operator, fence, separator, or accent. |
| static String |
An element that attaches an accent or a limit over a base expression. |
| static String |
An empty element used within |
| static String |
An element for radicals with an explicit index, such as a cube root. |
| static String |
An element for grouping sub-expressions horizontally. |
| static String |
An element for a square root. |
| static String |
An element for representing string literals, often for computer algebra systems. |
| static String |
An element that attaches a subscript to a base expression. |
| static String |
An element that attaches both a subscript and a superscript to a base expression. |
| static String |
An element that attaches a superscript to a base expression. |
| static String |
An element for creating tables or matrices. |
| static String |
An element representing a single cell in a table or matrix. |
| static String |
An element representing a single row in a a table or matrix. |
| static String |
An element for arbitrary text to be rendered as itself, often used for commentary. |
| static String |
An element that attaches an accent or a limit under a base expression. |
| static String |
An element that attaches scripts both under and over a base expression. |
| Inherited constants | |
|---|---|
| Public constructors | |
|---|---|
|
Creates a new MathInfo. |
|
| Public methods | |
|---|---|
| Int |
Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. |
| String? |
getAttribute(attributeKey: String)Gets the value of an attribute. |
| String |
getTag() |
| Unit |
putAttribute(attributeKey: String, value: String)Adds an attribute. |
| Unit |
removeAttribute(attributeKey: String)Removes an attribute. |
| Unit |
writeToParcel(dest: Parcel, flags: Int)Flatten this object in to a Parcel. |
| Inherited functions | |
|---|---|
| Properties | |
|---|---|
| static Parcelable.Creator<AccessibilityNodeInfo.MathInfo!> | |
Constants
MATH_ATTRIBUTE_ARG
static val MATH_ATTRIBUTE_ARG: String
An attribute used to associate a child element with one of the arguments in its parent's MATH_ATTRIBUTE_INTENT value.
The value of the arg attribute is a token that must match one of the argument names in the parent's intent value.
Use this attribute on a child node to explicitly link it to one of the argument placeholders in its parent's intent string. For example, if a parent node has intent="gcd($1, $2)", the child node representing the first parameter of the function should have its arg attribute set to "1".
Value: "arg"MATH_ATTRIBUTE_INTENT
static val MATH_ATTRIBUTE_INTENT: String
An attribute that provides a semantic annotation for the element on which it is specified.
The intent attribute's value is a string that can be parsed to determine the meaning of the element and its children. An intent value is a string consisting of a single token, or a function-like expression.
Use this attribute on a container node to disambiguate mathematical notation. For example, the expression (a, b) is ambiguous; it could be a point, an open interval, or the greatest common divisor. By setting intent="open-interval($1, $2)" on the parent node, you provide a precise, machine-readable meaning that accessibility services can use to provide a better experience. The $1 and $2 are placeholders for the arguments, which are identified on child nodes using the MATH_ATTRIBUTE_ARG attribute.
Value: "intent"MATH_TAG_FRACTION
static val MATH_TAG_FRACTION: String
An element for creating fractions.
Value: "mfrac"MATH_TAG_IDENTIFIER
static val MATH_TAG_IDENTIFIER: String
An element for symbolic names or arbitrary text to be rendered as an identifier.
Value: "mi"MATH_TAG_MATH
static val MATH_TAG_MATH: String
The top-level root element that encapsulates a MathML expression.
Value: "math"MATH_TAG_MULTISCRIPTS
static val MATH_TAG_MULTISCRIPTS: String
An element for attaching any number of prescripts and postscripts to a base expression.
Value: "mmultiscripts"MATH_TAG_NONE_SCRIPT
static val MATH_TAG_NONE_SCRIPT: String
Represents an empty element, often used as a placeholder in elements like mmultiscripts.
Value: "none"MATH_TAG_NUMBER
static val MATH_TAG_NUMBER: String
An element for a numeric literal.
Value: "mn"MATH_TAG_OPERATOR
static val MATH_TAG_OPERATOR: String
An element for an operator, fence, separator, or accent.
Value: "mo"MATH_TAG_OVER
static val MATH_TAG_OVER: String
An element that attaches an accent or a limit over a base expression.
Value: "mover"MATH_TAG_PRESCRIPT_DELIMITER
static val MATH_TAG_PRESCRIPT_DELIMITER: String
An empty element used within mmultiscripts to separate postscripts from prescripts.
Value: "mprescripts"MATH_TAG_ROOT
static val MATH_TAG_ROOT: String
An element for radicals with an explicit index, such as a cube root.
Value: "mroot"MATH_TAG_ROW
static val MATH_TAG_ROW: String
An element for grouping sub-expressions horizontally.
Value: "mrow"MATH_TAG_SQUARE_ROOT
static val MATH_TAG_SQUARE_ROOT: String
An element for a square root.
Value: "msqrt"MATH_TAG_STRING_LITERAL
static val MATH_TAG_STRING_LITERAL: String
An element for representing string literals, often for computer algebra systems.
Value: "ms"MATH_TAG_SUB
static val MATH_TAG_SUB: String
An element that attaches a subscript to a base expression.
Value: "msub"MATH_TAG_SUB_SUP
static val MATH_TAG_SUB_SUP: String
An element that attaches both a subscript and a superscript to a base expression.
Value: "msubsup"MATH_TAG_SUP
static val MATH_TAG_SUP: String
An element that attaches a superscript to a base expression.
Value: "msup"MATH_TAG_TABLE
static val MATH_TAG_TABLE: String
An element for creating tables or matrices.
Value: "mtable"MATH_TAG_TABLE_CELL
static val MATH_TAG_TABLE_CELL: String
An element representing a single cell in a table or matrix.
Value: "mtd"MATH_TAG_TABLE_ROW
static val MATH_TAG_TABLE_ROW: String
An element representing a single row in a a table or matrix.
Value: "mtr"MATH_TAG_TEXT
static val MATH_TAG_TEXT: String
An element for arbitrary text to be rendered as itself, often used for commentary.
Value: "mtext"MATH_TAG_UNDER
static val MATH_TAG_UNDER: String
An element that attaches an accent or a limit under a base expression.
Value: "munder"MATH_TAG_UNDER_OVER
static val MATH_TAG_UNDER_OVER: String
An element that attaches scripts both under and over a base expression.
Value: "munderover"Public constructors
MathInfo
MathInfo(tag: String)
Creates a new MathInfo.
| Parameters | |
|---|---|
tag |
String: The MathML tag for this node. Value is one of the following:
This value cannot be null. |
Public methods
describeContents
fun describeContents(): Int
Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. For example, if the object will include a file descriptor in the output of writeToParcel(Parcel,int), the return value of this method must include the CONTENTS_FILE_DESCRIPTOR bit.
| Return | |
|---|---|
Int |
a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or
|
getAttribute
fun getAttribute(attributeKey: String): String?
Gets the value of an attribute.
| Parameters | |
|---|---|
attributeKey |
String: Value is one of the following:
This value cannot be null. |
| Return | |
|---|---|
String? |
This value may be null. |
getTag
fun getTag(): String
putAttribute
fun putAttribute(
attributeKey: String,
value: String
): Unit
Adds an attribute.
| Parameters | |
|---|---|
attributeKey |
String: Value is one of the following:
This value cannot be null. |
value |
String: This value cannot be null. |
removeAttribute
fun removeAttribute(attributeKey: String): Unit
Removes an attribute.
| Parameters | |
|---|---|
attributeKey |
String: Value is one of the following:
This value cannot be null. |
writeToParcel
fun writeToParcel(
dest: Parcel,
flags: Int
): Unit
Flatten this object in to a Parcel.
| Parameters | |
|---|---|
dest |
Parcel: This value cannot be null. |
flags |
Int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE. Value is either 0 or a combination of the following:
|
Properties
CREATOR
static val CREATOR: Parcelable.Creator<AccessibilityNodeInfo.MathInfo!>
See Also