WatchFaceStyle.Builder

public static class WatchFaceStyle.Builder
extends Object

java.lang.Object
   ↳ android.support.wearable.watchface.WatchFaceStyle.Builder


Builder for WatchFaceStyle objects.

Summary

Public constructors

WatchFaceStyle.Builder(Service service)

Public methods

WatchFaceStyle build()

Constructs read only WatchFaceStyle object.

WatchFaceStyle.Builder setAcceptsTapEvents(boolean acceptsTapEvents)

Sets whether this watchface accepts tap events.

WatchFaceStyle.Builder setAmbientPeekMode(int ambientPeekMode)

Sets how the first, peeking card will be displayed while the watch is in ambient, black & white mode.

WatchFaceStyle.Builder setBackgroundVisibility(int backgroundVisibility)

Set how to display background of the first, peeking card.

WatchFaceStyle.Builder setCardPeekMode(int peekMode)

Sets how far into the screen the first card will peek while the watch face is displayed.

WatchFaceStyle.Builder setHotwordIndicatorGravity(int hotwordIndicatorGravity)

Sets position of hotword (OK Google) on the screen.

WatchFaceStyle.Builder setPeekOpacityMode(int peekOpacityMode)

Sets whether the first, peeking card should be opaque when the watch face is displayed.

WatchFaceStyle.Builder setShowSystemUiTime(boolean showSystemUiTime)

Sets if the system will draw the system-style time over the watch face.

WatchFaceStyle.Builder setShowUnreadCountIndicator(boolean show)

Sets whether to add an indicator of how many unread cards there are in the stream.

WatchFaceStyle.Builder setStatusBarGravity(int statusBarGravity)

Sets position of status icons (battery state, lack of connection) on the screen.

WatchFaceStyle.Builder setViewProtection(int viewProtection)

This method is deprecated. Use setViewProtectionMode(int) instead.

WatchFaceStyle.Builder setViewProtectionMode(int viewProtectionMode)

Adds background color to UI elements of the home screen, so they are readable on the watch face.

Inherited methods

From class java.lang.Object

Public constructors

WatchFaceStyle.Builder

WatchFaceStyle.Builder (Service service)

Parameters
service Service

Public methods

build

WatchFaceStyle build ()

Constructs read only WatchFaceStyle object.

Returns
WatchFaceStyle

setAcceptsTapEvents

WatchFaceStyle.Builder setAcceptsTapEvents (boolean acceptsTapEvents)

Sets whether this watchface accepts tap events. The default is false.

Watchfaces that set this true are indicating they are prepared to receive TAP_TYPE_TOUCH, TAP_TYPE_TOUCH_CANCEL, and TAP_TYPE_TAP

Parameters
acceptsTapEvents boolean: whether to receive touch events.
Returns
WatchFaceStyle.Builder

setAmbientPeekMode

WatchFaceStyle.Builder setAmbientPeekMode (int ambientPeekMode)

Sets how the first, peeking card will be displayed while the watch is in ambient, black & white mode.

Parameters
ambientPeekMode int: must be either AMBIENT_PEEK_MODE_VISIBLE or AMBIENT_PEEK_MODE_HIDDEN
Returns
WatchFaceStyle.Builder

setBackgroundVisibility

WatchFaceStyle.Builder setBackgroundVisibility (int backgroundVisibility)

Set how to display background of the first, peeking card.

Parameters
backgroundVisibility int: must be either BACKGROUND_VISIBILITY_INTERRUPTIVE or BACKGROUND_VISIBILITY_PERSISTENT
Returns
WatchFaceStyle.Builder

setCardPeekMode

WatchFaceStyle.Builder setCardPeekMode (int peekMode)

Sets how far into the screen the first card will peek while the watch face is displayed.

Parameters
peekMode int: must be either PEEK_MODE_VARIABLE or PEEK_MODE_SHORT
Returns
WatchFaceStyle.Builder

setHotwordIndicatorGravity

WatchFaceStyle.Builder setHotwordIndicatorGravity (int hotwordIndicatorGravity)

Sets position of hotword (OK Google) on the screen.

Parameters
hotwordIndicatorGravity int: This must be any combination of horizontal Gravity constant (LEFT, CENTER_HORIZONTAL, RIGHT) and vertical Gravity constants (TOP, CENTER_VERTICAL, BOTTOM), e.g. Gravity.LEFT | Gravity.BOTTOM. On circular screens, only the vertical gravity is respected.
Returns
WatchFaceStyle.Builder

setPeekOpacityMode

WatchFaceStyle.Builder setPeekOpacityMode (int peekOpacityMode)

Sets whether the first, peeking card should be opaque when the watch face is displayed.

Parameters
peekOpacityMode int: must be either PEEK_OPACITY_MODE_OPAQUE or PEEK_OPACITY_MODE_TRANSLUCENT
Returns
WatchFaceStyle.Builder

setShowSystemUiTime

WatchFaceStyle.Builder setShowSystemUiTime (boolean showSystemUiTime)

Sets if the system will draw the system-style time over the watch face.

Parameters
showSystemUiTime boolean: Set this to false if you already draw or clearly represent the time on your watch face.
Returns
WatchFaceStyle.Builder

setShowUnreadCountIndicator

WatchFaceStyle.Builder setShowUnreadCountIndicator (boolean show)

Sets whether to add an indicator of how many unread cards there are in the stream. The indicator will be displayed next to status icons (battery state, lack of connection).

Parameters
show boolean: if true an indicator will be shown
Returns
WatchFaceStyle.Builder

setStatusBarGravity

WatchFaceStyle.Builder setStatusBarGravity (int statusBarGravity)

Sets position of status icons (battery state, lack of connection) on the screen.

Parameters
statusBarGravity int: This must be any combination of horizontal Gravity constant (LEFT, CENTER_HORIZONTAL, RIGHT) and vertical Gravity constants (TOP, CENTER_VERTICAL, BOTTOM), e.g. Gravity.LEFT | Gravity.BOTTOM. On circular screens, only the vertical gravity is respected.
Returns
WatchFaceStyle.Builder

setViewProtection

WatchFaceStyle.Builder setViewProtection (int viewProtection)

This method is deprecated.
Use setViewProtectionMode(int) instead.

Adds background color to UI elements of the home screen, so they are readable on the watch face. This should be used if the watch face color is close to being white.

Parameters
viewProtection int: must be any combination of PROTECT_STATUS_BAR, PROTECT_HOTWORD_INDICATOR and PROTECT_WHOLE_SCREEN, e.g. PROTECT_STATUS_BAR | PROTECT_HOTWORD_INDICATOR
Returns
WatchFaceStyle.Builder

setViewProtectionMode

WatchFaceStyle.Builder setViewProtectionMode (int viewProtectionMode)

Adds background color to UI elements of the home screen, so they are readable on the watch face. This should be used if the watch face color is close to being white.

Parameters
viewProtectionMode int: must be any combination of PROTECT_STATUS_BAR, PROTECT_HOTWORD_INDICATOR and PROTECT_WHOLE_SCREEN, e.g. PROTECT_STATUS_BAR | PROTECT_HOTWORD_INDICATOR
Returns
WatchFaceStyle.Builder