AccessibilityNodeInfo.MathInfo


public static final class AccessibilityNodeInfo.MathInfo
extends AccessibilityNodeInfo.StructuredDataInfo implements Parcelable

java.lang.Object
   ↳ 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

String MATH_ATTRIBUTE_ARG

An attribute used to associate a child element with one of the arguments in its parent's MATH_ATTRIBUTE_INTENT value.

String MATH_ATTRIBUTE_INTENT

An attribute that provides a semantic annotation for the element on which it is specified.

String MATH_TAG_FRACTION

An element for creating fractions.

String MATH_TAG_IDENTIFIER

An element for symbolic names or arbitrary text to be rendered as an identifier.

String MATH_TAG_MATH

The top-level root element that encapsulates a MathML expression.

String MATH_TAG_MULTISCRIPTS

An element for attaching any number of prescripts and postscripts to a base expression.

String MATH_TAG_NONE_SCRIPT

Represents an empty element, often used as a placeholder in elements like mmultiscripts.

String MATH_TAG_NUMBER

An element for a numeric literal.

String MATH_TAG_OPERATOR

An element for an operator, fence, separator, or accent.

String MATH_TAG_OVER

An element that attaches an accent or a limit over a base expression.

String MATH_TAG_PRESCRIPT_DELIMITER

An empty element used within mmultiscripts to separate postscripts from prescripts.

String MATH_TAG_ROOT

An element for radicals with an explicit index, such as a cube root.

String MATH_TAG_ROW

An element for grouping sub-expressions horizontally.

String MATH_TAG_SQUARE_ROOT

An element for a square root.

String MATH_TAG_STRING_LITERAL

An element for representing string literals, often for computer algebra systems.

String MATH_TAG_SUB

An element that attaches a subscript to a base expression.

String MATH_TAG_SUB_SUP

An element that attaches both a subscript and a superscript to a base expression.

String MATH_TAG_SUP

An element that attaches a superscript to a base expression.

String MATH_TAG_TABLE

An element for creating tables or matrices.

String MATH_TAG_TABLE_CELL

An element representing a single cell in a table or matrix.

String MATH_TAG_TABLE_ROW

An element representing a single row in a a table or matrix.

String MATH_TAG_TEXT

An element for arbitrary text to be rendered as itself, often used for commentary.

String MATH_TAG_UNDER

An element that attaches an accent or a limit under a base expression.

String MATH_TAG_UNDER_OVER

An element that attaches scripts both under and over a base expression.

Inherited constants

Fields

public static final Creator<AccessibilityNodeInfo.MathInfo> CREATOR

Public constructors

MathInfo(String tag)

Creates a new MathInfo.

Public methods

int describeContents()

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.

String getAttribute(String attributeKey)

Gets the value of an attribute.

String getTag()

void putAttribute(String attributeKey, String value)

Adds an attribute.

void removeAttribute(String attributeKey)

Removes an attribute.

void writeToParcel(Parcel dest, int flags)

Flatten this object in to a Parcel.

Inherited methods

Constants

MATH_ATTRIBUTE_ARG

Added in API level 37
public static final String MATH_ATTRIBUTE_ARG

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".

Constant Value: "arg"

MATH_ATTRIBUTE_INTENT

Added in API level 37
public static final String MATH_ATTRIBUTE_INTENT

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.

Constant Value: "intent"

MATH_TAG_FRACTION

Added in API level 37
public static final String MATH_TAG_FRACTION

An element for creating fractions.

Constant Value: "mfrac"

MATH_TAG_IDENTIFIER

Added in API level 37
public static final String MATH_TAG_IDENTIFIER

An element for symbolic names or arbitrary text to be rendered as an identifier.

Constant Value: "mi"

MATH_TAG_MATH

Added in API level 37
public static final String MATH_TAG_MATH

The top-level root element that encapsulates a MathML expression.

Constant Value: "math"

MATH_TAG_MULTISCRIPTS

Added in API level 37
public static final String MATH_TAG_MULTISCRIPTS

An element for attaching any number of prescripts and postscripts to a base expression.

Constant Value: "mmultiscripts"

MATH_TAG_NONE_SCRIPT

Added in API level 37
public static final String MATH_TAG_NONE_SCRIPT

Represents an empty element, often used as a placeholder in elements like mmultiscripts.

Constant Value: "none"

MATH_TAG_NUMBER

Added in API level 37
public static final String MATH_TAG_NUMBER

An element for a numeric literal.

Constant Value: "mn"

MATH_TAG_OPERATOR

Added in API level 37
public static final String MATH_TAG_OPERATOR

An element for an operator, fence, separator, or accent.

Constant Value: "mo"

MATH_TAG_OVER

Added in API level 37
public static final String MATH_TAG_OVER

An element that attaches an accent or a limit over a base expression.

Constant Value: "mover"

MATH_TAG_PRESCRIPT_DELIMITER

Added in API level 37
public static final String MATH_TAG_PRESCRIPT_DELIMITER

An empty element used within mmultiscripts to separate postscripts from prescripts.

Constant Value: "mprescripts"

MATH_TAG_ROOT

Added in API level 37
public static final String MATH_TAG_ROOT

An element for radicals with an explicit index, such as a cube root.

Constant Value: "mroot"

MATH_TAG_ROW

Added in API level 37
public static final String MATH_TAG_ROW

An element for grouping sub-expressions horizontally.

Constant Value: "mrow"

MATH_TAG_SQUARE_ROOT

Added in API level 37
public static final String MATH_TAG_SQUARE_ROOT

An element for a square root.

Constant Value: "msqrt"

MATH_TAG_STRING_LITERAL

Added in API level 37
public static final String MATH_TAG_STRING_LITERAL

An element for representing string literals, often for computer algebra systems.

Constant Value: "ms"

MATH_TAG_SUB

Added in API level 37
public static final String MATH_TAG_SUB

An element that attaches a subscript to a base expression.

Constant Value: "msub"

MATH_TAG_SUB_SUP

Added in API level 37
public static final String MATH_TAG_SUB_SUP

An element that attaches both a subscript and a superscript to a base expression.

Constant Value: "msubsup"

MATH_TAG_SUP

Added in API level 37
public static final String MATH_TAG_SUP

An element that attaches a superscript to a base expression.

Constant Value: "msup"

MATH_TAG_TABLE

Added in API level 37
public static final String MATH_TAG_TABLE

An element for creating tables or matrices.

Constant Value: "mtable"

MATH_TAG_TABLE_CELL

Added in API level 37
public static final String MATH_TAG_TABLE_CELL

An element representing a single cell in a table or matrix.

Constant Value: "mtd"

MATH_TAG_TABLE_ROW

Added in API level 37
public static final String MATH_TAG_TABLE_ROW

An element representing a single row in a a table or matrix.

Constant Value: "mtr"

MATH_TAG_TEXT

Added in API level 37
public static final String MATH_TAG_TEXT

An element for arbitrary text to be rendered as itself, often used for commentary.

Constant Value: "mtext"

MATH_TAG_UNDER

Added in API level 37
public static final String MATH_TAG_UNDER

An element that attaches an accent or a limit under a base expression.

Constant Value: "munder"

MATH_TAG_UNDER_OVER

Added in API level 37
public static final String MATH_TAG_UNDER_OVER

An element that attaches scripts both under and over a base expression.

Constant Value: "munderover"

Fields

CREATOR

Added in API level 37
public static final Creator<AccessibilityNodeInfo.MathInfo> CREATOR

See also:

Public constructors

Public methods

describeContents

Added in API level 37
public int describeContents ()

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.

Returns
int a bitmask indicating the set of special object types marshaled by this Parcelable object instance.
Value is either 0 or

getAttribute

Added in API level 37
public String getAttribute (String attributeKey)

Gets the value of an attribute.

Parameters
attributeKey String: Value is one of the following:
Returns
String This value may be null.

putAttribute

Added in API level 37
public void putAttribute (String attributeKey, 
                String value)

Adds an attribute.

Parameters
attributeKey String: Value is one of the following:
value String: This value cannot be null.

removeAttribute

Added in API level 37
public void removeAttribute (String attributeKey)

Removes an attribute.

Parameters
attributeKey String: Value is one of the following:

writeToParcel

Added in API level 37
public void writeToParcel (Parcel dest, 
                int flags)

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.PARCELABLE_WRITE_RETURN_VALUE.
Value is either 0 or a combination of the following: