TimeFormatComplicationText.Builder
public
static
final
class
TimeFormatComplicationText.Builder
extends Object
| java.lang.Object | |
| ↳ | com.google.wear.services.complications.TimeFormatComplicationText.Builder |
Builder for TimeFormatComplicationText.
Summary
Public constructors | |
|---|---|
Builder()
|
|
Public methods | |
|---|---|
TimeFormatComplicationText
|
build()
Builds a |
TimeFormatComplicationText.Builder
|
setFormat(String format)
Sets the format that should be applied to the date. |
TimeFormatComplicationText.Builder
|
setStyle(int style)
Sets the style in which the time format part will be displayed. |
TimeFormatComplicationText.Builder
|
setSurroundingText(CharSequence surroundingText)
Sets the string 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. |
Inherited methods | |
|---|---|
Public constructors
Builder
public Builder ()
Public methods
build
public TimeFormatComplicationText build ()
Builds a TimeFormatComplicationText.
| Returns | |
|---|---|
TimeFormatComplicationText |
|
setFormat
public TimeFormatComplicationText.Builder setFormat (String format)
Sets the format that should be applied to the date. This should be a pattern as used by
SimpleDateFormat.
| Parameters | |
|---|---|
format |
String |
| Returns | |
|---|---|
TimeFormatComplicationText.Builder |
|
setStyle
public TimeFormatComplicationText.Builder setStyle (int style)
Sets the style in which the time format part will be displayed. If not set, defaults to
TimeFormatComplicationText.STYLE_DEFAULT, which leaves the formatted date
unchanged.
| Parameters | |
|---|---|
style |
int: Value is one of the following:
|
| Returns | |
|---|---|
TimeFormatComplicationText.Builder |
this builder for chaining. |
setSurroundingText
public TimeFormatComplicationText.Builder setSurroundingText (CharSequence surroundingText)
Sets the string within which the time difference will be displayed. This is optional.
Within the text, ^1 will be replaced with the time format, so for example to
show a result like "10:00: meeting" the surrounding text would be "^1:
meeting".
To use the ^ character within the text, escape it as ^^.
If the text contains spans, some of them may not be rendered by the complication drawable. Supported spans
are ForegroundColorSpan, LocaleSpan, SubscriptSpan, SuperscriptSpan, StyleSpan, StrikethroughSpan, TypefaceSpan and
UnderlineSpan.
| Parameters | |
|---|---|
surroundingText |
CharSequence: string within which the time difference value will be displayed,
with ^1 in place of the time difference. |
| Returns | |
|---|---|
TimeFormatComplicationText.Builder |
this builder for chaining. |
setTimeZone
public TimeFormatComplicationText.Builder setTimeZone (TimeZone timeZone)
Sets the time zone that will be used for the formatted time. This is optional - if not set, the system's default time zone will be used.
| Parameters | |
|---|---|
timeZone |
TimeZone |
| Returns | |
|---|---|
TimeFormatComplicationText.Builder |
this builder for chaining. |