FileDocCategorySizeDatePackage
TtsSpan.javaAPI DocAndroid 5.1 API53382Thu Mar 12 22:22:10 GMT 2015android.text.style

TtsSpan

public class TtsSpan extends Object implements android.text.ParcelableSpan
A span that supplies additional meta-data for the associated text intended for text-to-speech engines. If the text is being processed by a text-to-speech engine, the engine may use the data in this span in addition to or instead of its associated text. Each instance of a TtsSpan has a type, for example {@link #TYPE_DATE} or {@link #TYPE_MEASURE}. And a list of arguments, provided as key-value pairs in a bundle. The inner classes are there for convenience and provide builders for each TtsSpan type.

Fields Summary
private final String
mType
private final android.os.PersistableBundle
mArgs
public static final String
TYPE_TEXT
This span type can be used to add morphosyntactic features to the text it spans over, or synthesize a something else than the spanned text. Use the argument {@link #ARG_TEXT} to set a different text. Accepts the arguments {@link #ARG_GENDER}, {@link #ARG_ANIMACY}, {@link #ARG_MULTIPLICITY} and {@link #ARG_CASE}.
public static final String
TYPE_CARDINAL
The text associated with this span is a cardinal. Must include the number to be synthesized with {@link #ARG_NUMBER}. Also accepts the arguments {@link #ARG_GENDER}, {@link #ARG_ANIMACY}, {@link #ARG_MULTIPLICITY} and {@link #ARG_CASE}.
public static final String
TYPE_ORDINAL
The text associated with this span is an ordinal. Must include the number to be synthesized with {@link #ARG_NUMBER}. Also accepts the arguments {@link #ARG_GENDER}, {@link #ARG_ANIMACY}, {@link #ARG_MULTIPLICITY} and {@link #ARG_CASE}.
public static final String
TYPE_DECIMAL
The text associated with this span is a decimal number. Must include the number to be synthesized with {@link #ARG_INTEGER_PART} and {@link #ARG_FRACTIONAL_PART}. Also accepts the arguments {@link #ARG_GENDER}, {@link #ARG_ANIMACY}, {@link #ARG_MULTIPLICITY} and {@link #ARG_CASE}.
public static final String
TYPE_FRACTION
The text associated with this span is a fractional number. Must include the number to be synthesized with {@link #ARG_NUMERATOR} and {@link #ARG_DENOMINATOR}. {@link #ARG_INTEGER_PART} is optional Also accepts the arguments {@link #ARG_GENDER}, {@link #ARG_ANIMACY}, {@link #ARG_MULTIPLICITY} and {@link #ARG_CASE}.
public static final String
TYPE_MEASURE
The text associated with this span is a measure, consisting of a number and a unit. The number can be a cardinal, decimal or a fraction. Set the number with the same arguments as {@link #TYPE_CARDINAL}, {@link #TYPE_DECIMAL} or {@link #TYPE_FRACTION}. The unit can be specified with {@link #ARG_UNIT}. Also accepts the arguments {@link #ARG_GENDER}, {@link #ARG_ANIMACY}, {@link #ARG_MULTIPLICITY} and {@link #ARG_CASE}.
public static final String
TYPE_TIME
The text associated with this span is a time, consisting of a number of hours and minutes, specified with {@link #ARG_HOURS} and {@link #ARG_MINUTES}. Also accepts the arguments {@link #ARG_GENDER}, {@link #ARG_ANIMACY}, {@link #ARG_MULTIPLICITY} and {@link #ARG_CASE}.
public static final String
TYPE_DATE
The text associated with this span is a date. At least one of the arguments {@link #ARG_MONTH} and {@link #ARG_YEAR} has to be provided. The argument {@link #ARG_DAY} is optional if {@link #ARG_MONTH} is set. The argument {@link #ARG_WEEKDAY} is optional if {@link #ARG_DAY} is set. Also accepts the arguments {@link #ARG_GENDER}, {@link #ARG_ANIMACY}, {@link #ARG_MULTIPLICITY} and {@link #ARG_CASE}.
public static final String
TYPE_TELEPHONE
The text associated with this span is a telephone number. The argument {@link #ARG_NUMBER_PARTS} is required. {@link #ARG_COUNTRY_CODE} and {@link #ARG_EXTENSION} are optional. Also accepts the arguments {@link #ARG_GENDER}, {@link #ARG_ANIMACY}, {@link #ARG_MULTIPLICITY} and {@link #ARG_CASE}.
public static final String
TYPE_ELECTRONIC
The text associated with this span is a URI (can be used for URLs and email addresses). The full schema for URLs, which email addresses can effectively be seen as a subset of, is: protocol://username:password@domain:port/path?query_string#fragment_id Hence populating just username and domain will read as an email address. All arguments are optional, but at least one has to be provided: {@link #ARG_PROTOCOL}, {@link #ARG_USERNAME}, {@link #ARG_PASSWORD}, {@link #ARG_DOMAIN}, {@link #ARG_PORT}, {@link #ARG_PATH}, {@link #ARG_QUERY_STRING} and {@link #ARG_FRAGMENT_ID}. Also accepts the arguments {@link #ARG_GENDER}, {@link #ARG_ANIMACY}, {@link #ARG_MULTIPLICITY} and {@link #ARG_CASE}.
public static final String
TYPE_MONEY
The text associated with this span is an amount of money. Set the amount with the same arguments as {@link #TYPE_DECIMAL}. {@link #ARG_CURRENCY} is used to set the currency. {@link #ARG_QUANTITY} is optional. Also accepts the arguments {@link #ARG_GENDER}, {@link #ARG_ANIMACY}, {@link #ARG_MULTIPLICITY} and {@link #ARG_CASE}.
public static final String
TYPE_DIGITS
The text associated with this span is a series of digits that have to be read sequentially. The digits can be set with {@link #ARG_DIGITS}. Also accepts the arguments {@link #ARG_GENDER}, {@link #ARG_ANIMACY}, {@link #ARG_MULTIPLICITY} and {@link #ARG_CASE}.
public static final String
TYPE_VERBATIM
The text associated with this span is a series of characters that have to be read verbatim. The engine will attempt to ready out any character like punctuation but excluding whitespace. {@link #ARG_VERBATIM} is required. Also accepts the arguments {@link #ARG_GENDER}, {@link #ARG_ANIMACY}, {@link #ARG_MULTIPLICITY} and {@link #ARG_CASE}.
public static final String
ARG_GENDER
String argument supplying gender information. Can be any of {@link #GENDER_NEUTRAL}, {@link #GENDER_MALE} and {@link #GENDER_FEMALE}.
public static final String
GENDER_NEUTRAL
public static final String
GENDER_MALE
public static final String
GENDER_FEMALE
public static final String
ARG_ANIMACY
String argument supplying animacy information. Can be {@link #ANIMACY_ANIMATE} or {@link #ANIMACY_INANIMATE}
public static final String
ANIMACY_ANIMATE
public static final String
ANIMACY_INANIMATE
public static final String
ARG_MULTIPLICITY
String argument supplying multiplicity information. Can be any of {@link #MULTIPLICITY_SINGLE}, {@link #MULTIPLICITY_DUAL} and {@link #MULTIPLICITY_PLURAL}
public static final String
MULTIPLICITY_SINGLE
public static final String
MULTIPLICITY_DUAL
public static final String
MULTIPLICITY_PLURAL
public static final String
ARG_CASE
String argument supplying case information. Can be any of {@link #CASE_NOMINATIVE}, {@link #CASE_ACCUSATIVE}, {@link #CASE_DATIVE}, {@link #CASE_ABLATIVE}, {@link #CASE_GENITIVE}, {@link #CASE_VOCATIVE}, {@link #CASE_LOCATIVE} and {@link #CASE_INSTRUMENTAL}
public static final String
CASE_NOMINATIVE
public static final String
CASE_ACCUSATIVE
public static final String
CASE_DATIVE
public static final String
CASE_ABLATIVE
public static final String
CASE_GENITIVE
public static final String
CASE_VOCATIVE
public static final String
CASE_LOCATIVE
public static final String
CASE_INSTRUMENTAL
public static final String
ARG_TEXT
String supplying the text to be synthesized. The synthesizer is free to decide how to interpret the text. Can be used with {@link #TYPE_TEXT}.
public static final String
ARG_NUMBER
Argument used to specify a whole number. The value can be a string of digits of any size optionally prefixed with a - or +. Can be used with {@link #TYPE_CARDINAL} and {@link #TYPE_ORDINAL}.
public static final String
ARG_INTEGER_PART
Argument used to specify the integer part of a decimal or fraction. The value can be a string of digits of any size optionally prefixed with a - or +. Can be used with {@link #TYPE_DECIMAL} and {@link #TYPE_FRACTION}.
public static final String
ARG_FRACTIONAL_PART
Argument used to specify the fractional part of a decimal. The value can be a string of digits of any size. Can be used with {@link #TYPE_DECIMAL}.
public static final String
ARG_QUANTITY
Argument used to choose the suffix (thousand, million, etc) that is used to pronounce large amounts of money. For example it can be used to disambiguate between "two thousand five hundred dollars" and "two point five thousand dollars". If implemented, engines should support at least "1000", "1000000", "1000000000" and "1000000000000". Example: if the {@link #ARG_INTEGER_PART} argument is "10", the {@link #ARG_FRACTIONAL_PART} argument is "4", the {@link #ARG_QUANTITY} argument is "1000" and the {@link #ARG_CURRENCY} argument is "usd", the TTS engine may pronounce the span as "ten point four thousand dollars". With the same example but with the quantity set as "1000000" the TTS engine may pronounce the span as "ten point four million dollars". Can be used with {@link #TYPE_MONEY}.
public static final String
ARG_NUMERATOR
Argument used to specify the numerator of a fraction. The value can be a string of digits of any size optionally prefixed with a - or +. Can be used with {@link #TYPE_FRACTION}.
public static final String
ARG_DENOMINATOR
Argument used to specify the denominator of a fraction. The value can be a string of digits of any size optionally prefixed with a + or -. Can be used with {@link #TYPE_FRACTION}.
public static final String
ARG_UNIT
Argument used to specify the unit of a measure. The unit should always be specified in English singular form. Prefixes may be used. Engines will do their best to pronounce them correctly in the language used. Engines are expected to at least support the most common ones like "meter", "second", "degree celsius" and "degree fahrenheit" with some common prefixes like "milli" and "kilo". Can be used with {@link #TYPE_MEASURE}.
public static final String
ARG_HOURS
Argument used to specify the hours of a time. The hours should be provided as an integer in the range from 0 up to and including 24. Can be used with {@link #TYPE_TIME}.
public static final String
ARG_MINUTES
Argument used to specify the minutes of a time. The hours should be provided as an integer in the range from 0 up to and including 59. Can be used with {@link #TYPE_TIME}.
public static final String
ARG_WEEKDAY
Argument used to specify the weekday of a date. The value should be provided as an integer and can be any of {@link #WEEKDAY_SUNDAY}, {@link #WEEKDAY_MONDAY}, {@link #WEEKDAY_TUESDAY}, {@link #WEEKDAY_WEDNESDAY}, {@link #WEEKDAY_THURSDAY}, {@link #WEEKDAY_FRIDAY} and {@link #WEEKDAY_SATURDAY}. Can be used with {@link #TYPE_DATE}.
public static final int
WEEKDAY_SUNDAY
public static final int
WEEKDAY_MONDAY
public static final int
WEEKDAY_TUESDAY
public static final int
WEEKDAY_WEDNESDAY
public static final int
WEEKDAY_THURSDAY
public static final int
WEEKDAY_FRIDAY
public static final int
WEEKDAY_SATURDAY
public static final String
ARG_DAY
Argument used to specify the day of the month of a date. The value should be provided as an integer in the range from 1 up to and including 31. Can be used with {@link #TYPE_DATE}.
public static final String
ARG_MONTH
Argument used to specify the month of a date. The value should be provided as an integer and can be any of {@link #MONTH_JANUARY}, {@link #MONTH_FEBRUARY}, {@link #MONTH_MARCH}, {@link #MONTH_APRIL}, {@link #MONTH_MAY}, {@link #MONTH_JUNE}, {@link #MONTH_JULY}, {@link #MONTH_AUGUST}, {@link #MONTH_SEPTEMBER}, {@link #MONTH_OCTOBER}, {@link #MONTH_NOVEMBER} and {@link #MONTH_DECEMBER}. Can be used with {@link #TYPE_DATE}.
public static final int
MONTH_JANUARY
public static final int
MONTH_FEBRUARY
public static final int
MONTH_MARCH
public static final int
MONTH_APRIL
public static final int
MONTH_MAY
public static final int
MONTH_JUNE
public static final int
MONTH_JULY
public static final int
MONTH_AUGUST
public static final int
MONTH_SEPTEMBER
public static final int
MONTH_OCTOBER
public static final int
MONTH_NOVEMBER
public static final int
MONTH_DECEMBER
public static final String
ARG_YEAR
Argument used to specify the year of a date. The value should be provided as a positive integer. Can be used with {@link #TYPE_DATE}.
public static final String
ARG_COUNTRY_CODE
Argument used to specify the country code of a telephone number. Can be a string of digits optionally prefixed with a "+". Can be used with {@link #TYPE_TELEPHONE}.
public static final String
ARG_NUMBER_PARTS
Argument used to specify the main number part of a telephone number. Can be a string of digits where the different parts of the telephone number can be separated with a space, '-', '/' or '.'. Can be used with {@link #TYPE_TELEPHONE}.
public static final String
ARG_EXTENSION
Argument used to specify the extension part of a telephone number. Can be a string of digits. Can be used with {@link #TYPE_TELEPHONE}.
public static final String
ARG_PROTOCOL
Argument used to specify the protocol of a URI. Examples are "http" and "ftp". Can be used with {@link #TYPE_ELECTRONIC}.
public static final String
ARG_USERNAME
Argument used to specify the username part of a URI. Should be set as a string. Can be used with {@link #TYPE_ELECTRONIC}.
public static final String
ARG_PASSWORD
Argument used to specify the password part of a URI. Should be set as a string. Can be used with {@link #TYPE_ELECTRONIC}.
public static final String
ARG_DOMAIN
Argument used to specify the domain part of a URI. For example "source.android.com". Can be used with {@link #TYPE_ELECTRONIC}.
public static final String
ARG_PORT
Argument used to specify the port number of a URI. Should be specified as an integer. Can be used with {@link #TYPE_ELECTRONIC}.
public static final String
ARG_PATH
Argument used to specify the path part of a URI. For example "source/index.html". Can be used with {@link #TYPE_ELECTRONIC}.
public static final String
ARG_QUERY_STRING
Argument used to specify the query string of a URI. For example "arg=value&argtwo=value". Can be used with {@link #TYPE_ELECTRONIC}.
public static final String
ARG_FRAGMENT_ID
Argument used to specify the fragment id of a URI. Should be specified as a string. Can be used with {@link #TYPE_ELECTRONIC}.
public static final String
ARG_CURRENCY
Argument used to specify the currency. Should be a ISO4217 currency code, e.g. "USD". Can be used with {@link #TYPE_MONEY}.
public static final String
ARG_DIGITS
Argument used to specify a string of digits. Can be used with {@link #TYPE_DIGITS}.
public static final String
ARG_VERBATIM
Argument used to specify a string where the characters are read verbatim, except whitespace. Can be used with {@link #TYPE_VERBATIM}.
Constructors Summary
public TtsSpan(String type, android.os.PersistableBundle args)


         
        mType = type;
        mArgs = args;
    
public TtsSpan(android.os.Parcel src)

        mType = src.readString();
        mArgs = src.readPersistableBundle();
    
Methods Summary
public intdescribeContents()

        return 0;
    
public android.os.PersistableBundlegetArgs()
Returns a bundle of the arguments set.

return
The bundle of the arguments set.

        return mArgs;
    
public intgetSpanTypeId()

        return TextUtils.TTS_SPAN;
    
public java.lang.StringgetType()
Returns the type.

return
The type of this instance.

        return mType;
    
public voidwriteToParcel(android.os.Parcel dest, int flags)

        dest.writeString(mType);
        dest.writePersistableBundle(mArgs);