Function

withAnnotation

Pushes an annotation to the AnnotatedString.Builder, executes block and then pops the annotation.

withAnnotation

Source set: Common
inline fun <R : Any> Builder.withAnnotation(
    tag: String,
    annotation: String,
    crossinline block: Builder.() -> R,
): R

Pushes an annotation to the AnnotatedString.Builder, executes block and then pops the annotation.

Parameters

tag the tag used to distinguish annotations
annotation the string annotation attached on this AnnotatedString
block function to be executed

Returns

result of the block

withAnnotation

Source set: Common
inline fun <R : Any> Builder.withAnnotation(
    ttsAnnotation: TtsAnnotation,
    crossinline block: Builder.() -> R,
): R

Pushes an TtsAnnotation to the AnnotatedString.Builder, executes block and then pops the annotation.

Parameters

ttsAnnotation an object that stores text to speech metadata that intended for the TTS engine.
block function to be executed

Returns

result of the block

withAnnotation

Deprecated

Use LinkAnnotation API for links instead

Source set: Common
@ExperimentalTextApi
inline fun <R : Any> Builder.withAnnotation(
    urlAnnotation: UrlAnnotation,
    crossinline block: Builder.() -> R,
): R

Pushes an UrlAnnotation to the AnnotatedString.Builder, executes block and then pops the annotation.

Parameters

urlAnnotation A UrlAnnotation object that stores the URL being linked to.
block function to be executed

Returns

result of the block

Last updated: