TimeFormatComplicationText.Builder


class TimeFormatComplicationText.Builder


A builder for TimeFormatComplicationText.

Summary

Public constructors

Builder(format: String)

Public functions

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

Builder

Added in 1.0.0
Builder(format: String)
Parameters
format: String

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

Public functions

setStyle

Added in 1.0.0
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

Added in 1.0.0
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

Added in 1.0.0
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.