Google is committed to advancing racial equity for Black communities. See how.

Builder

class Builder
kotlin.Any
   ↳ androidx.wear.complications.data.TimeFormatComplicationText.Builder

A builder for TimeFormatComplicationText.

Summary

Public constructors
<init>(format: String)

A builder for TimeFormatComplicationText.

Public methods
TimeFormatComplicationText

Builds a TimeFormatComplicationText.

TimeFormatComplicationText.Builder

Sets the style in which the time format part will be displayed.

TimeFormatComplicationText.Builder

Sets the text within which the time difference will be displayed.

TimeFormatComplicationText.Builder
setTimeZone(timeZone: TimeZone)

Sets the time zone that will be used for the formatted time.

Public constructors

<init>

Builder(format: String)

A builder for TimeFormatComplicationText.

Parameters
format: String the format in which the time should be displayed. This should be a pattern as used by java.text.SimpleDateFormat.

Public methods

setStyle

fun setStyle(style: TimeFormatStyle): TimeFormatComplicationText.Builder

Sets the style in which the time format part will be displayed.

If not set, defaults to TimeFormatStyle.DEFAULT, which leaves the formatted date unchanged.

setText

fun setText(text: CharSequence): TimeFormatComplicationText.Builder

Sets the text within which the time difference will be displayed.

Within the text, ^1 will be replaced with the time difference, so for example to show a result like "2 mins: meeting" the text would be "^1: meeting"

To use the ^ character within the text, escape it as ^^.

The text may contain spans, but ther watch face is not required to respect them.

The allowed spans are ForegroundColorSpan, LocaleSpan, SubscriptSpan, SuperscriptSpan, StyleSpan, StrikethroughSpan, TypefaceSpan and UnderlineSpan.

setTimeZone

fun setTimeZone(timeZone: TimeZone): TimeFormatComplicationText.Builder

Sets the time zone that will be used for the formatted time. If not set, the system's default time zone will be used.