TimeFormatComplicationText.Builder

public final class TimeFormatComplicationText.Builder


A builder for TimeFormatComplicationText.

Summary

Public constructors

Builder(String format)

Public methods

final @NonNull TimeFormatComplicationText

Builds a TimeFormatComplicationText.

final @NonNull TimeFormatComplicationText.Builder

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

final @NonNull TimeFormatComplicationText.Builder

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

final @NonNull TimeFormatComplicationText.Builder

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

Public constructors

Builder

public final Builder(String format)
Parameters
String format

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

Public methods

setStyle

public final @NonNull TimeFormatComplicationText.Builder setStyle(TimeFormatStyle style)

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

public final @NonNull TimeFormatComplicationText.Builder setText(CharSequence text)

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,