Join us for ⁠#Android11: The Beta Launch Show on June 3!
Added in API level R

AbstractMessageParser

abstract class AbstractMessageParser
kotlin.Any
   ↳ com.google.android.util.AbstractMessageParser

Logic for parsing a text message typed by the user looking for smileys, urls, acronyms,formatting (e.g., '*'s for bold), me commands (e.g., "/me is asleep"), and punctuation. It constructs an array, which breaks the text up into its constituent pieces, which we return to the client.

Summary

Nested classes

open

Represents an acronym that was found in the input.

open

Represents a link to a Flickr photo or album.

open

Represents a character that changes formatting.

open

Represents a simple string of html text.

open

Represents a link that was found in the input.

open

Represents a music track token at the beginning.

open

Represents set of tokens that are delivered as a single message.

open

Represents a link to a Picasa photo or album.

abstract

Interface representing the set of resources needed by a message parser

open

Represents a smiley that was found in the input.

abstract

Represents a unit of parsed output.

open

open

Represents a link to a Google Video.

open

Represents a link to a YouTube video.

Constants

static String

Music note that indicates user is listening to a music track.

Public constructors

<init>(text: String!)

Create a message parser to parse urls, formatting, acronyms, smileys, /me text and music

<init>(text: String!, parseSmilies: Boolean, parseAcronyms: Boolean, parseFormatting: Boolean, parseUrls: Boolean, parseMusic: Boolean, parseMeText: Boolean)

Create a message parser, specifying the kinds of text to parse

Public methods

AbstractMessageParser.Part!
getPart(index: Int)

Return the part at the given index.

Int

Return the number of parts.

MutableList<AbstractMessageParser.Part!>!

Return the list of parts from the parsed text

String!

Returns the raw text being parsed.

open Unit

Parses the text string into an internal representation.

open String!

Converts the entire message into a single HTML display string.

open static AbstractMessageParser.Token!
tokenForUrl(url: String!, text: String!)

Get a the appropriate Token for a given URL

Protected methods

abstract AbstractMessageParser.Resources!

Subclasses must define the schemes, domains, smileys and acronyms that are necessary for parsing

open static String!
reverse(str: String!)

Returns the reverse of the given string.

Constants

musicNote

Added in API level R
static val musicNote: String

Music note that indicates user is listening to a music track.

Value: "\u266b "

Public constructors

<init>

Added in API level R
AbstractMessageParser(text: String!)

Create a message parser to parse urls, formatting, acronyms, smileys, /me text and music

Parameters
text String!: the text to parse

<init>

Added in API level R
AbstractMessageParser(
    text: String!,
    parseSmilies: Boolean,
    parseAcronyms: Boolean,
    parseFormatting: Boolean,
    parseUrls: Boolean,
    parseMusic: Boolean,
    parseMeText: Boolean)

Create a message parser, specifying the kinds of text to parse

Parameters
text String!: the text to parse

Public methods

getPart

Added in API level R
fun getPart(index: Int): AbstractMessageParser.Part!

Return the part at the given index.

getPartCount

Added in API level R
fun getPartCount(): Int

Return the number of parts.

getParts

Added in API level R
fun getParts(): MutableList<AbstractMessageParser.Part!>!

Return the list of parts from the parsed text

getRawText

Added in API level R
fun getRawText(): String!

Returns the raw text being parsed.

parse

Added in API level R
open fun parse(): Unit

Parses the text string into an internal representation.

toHtml

Added in API level R
open fun toHtml(): String!

Converts the entire message into a single HTML display string.

tokenForUrl

Added in API level R
open static fun tokenForUrl(
    url: String!,
    text: String!
): AbstractMessageParser.Token!

Get a the appropriate Token for a given URL

Parameters
text String!: the anchor text
url String!: the url

Protected methods

getResources

Added in API level R
protected abstract fun getResources(): AbstractMessageParser.Resources!

Subclasses must define the schemes, domains, smileys and acronyms that are necessary for parsing

reverse

Added in API level R
protected open static fun reverse(str: String!): String!

Returns the reverse of the given string.