WatchFaceStyle.Builder

public static class WatchFaceStyle.Builder
extends Object

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


This class is deprecated.
Use androidx.wear.watchface.LegacyWatchFaceOverlayStyle from the Jetpack Wear Watch Face libraries instead.

Builder for WatchFaceStyle objects.

Summary

Public constructors

Builder(Service service)

Public methods

WatchFaceStyle build()

Constructs read only WatchFaceStyle object.

WatchFaceStyle.Builder setAccentColor(int color)

Sets the accent color which can be set by developers to customise watch face.

WatchFaceStyle.Builder setAcceptsTapEvents(boolean acceptsTapEvents)

Sets whether this watchface accepts tap events.

WatchFaceStyle.Builder setAmbientPeekMode(int ambientPeekMode)

This method is deprecated. Wear 2.0 doesn't have peeking cards

WatchFaceStyle.Builder setBackgroundVisibility(int backgroundVisibility)

This method is deprecated. Wear 2.0 doesn't have peeking cards

WatchFaceStyle.Builder setCardPeekMode(int peekMode)

This method is deprecated. Wear 2.0 doesn't have peeking cards

WatchFaceStyle.Builder setHideNotificationIndicator(boolean hide)

Sets whether to hide the dot indicator that is displayed at the bottom of the watch face if there are any unread notifications.

WatchFaceStyle.Builder setHotwordIndicatorGravity(int hotwordIndicatorGravity)

This method is deprecated. Wear 2.0 doesn't show hotword indication on the watch face

WatchFaceStyle.Builder setPeekOpacityMode(int peekOpacityMode)

This method is deprecated. Wear 2.0 doesn't have peeking cards

WatchFaceStyle.Builder setShowSystemUiTime(boolean showSystemUiTime)

This method is deprecated. this will be removed in a future version of the Wear platform

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

Public constructors

Builder

public Builder (Service service)

Parameters
service Service

Public methods

build

public WatchFaceStyle build ()

Constructs read only WatchFaceStyle object.

Returns
WatchFaceStyle

setAccentColor

public WatchFaceStyle.Builder setAccentColor (int color)

Sets the accent color which can be set by developers to customise watch face. It will be used when drawing the unread notification indicator. Default color is white.

This API is a no-op for devices running with Android version >= Build.VERSION_CODES.R

Parameters
color int

Returns
WatchFaceStyle.Builder

setAcceptsTapEvents

public 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 WatchFaceService.TAP_TYPE_TOUCH, WatchFaceService.TAP_TYPE_TOUCH_CANCEL, and WatchFaceService.TAP_TYPE_TAP

Parameters
acceptsTapEvents boolean: whether to receive touch events.

Returns
WatchFaceStyle.Builder

setAmbientPeekMode

public WatchFaceStyle.Builder setAmbientPeekMode (int ambientPeekMode)

This method is deprecated.
Wear 2.0 doesn't have peeking cards

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

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

Returns
WatchFaceStyle.Builder

setBackgroundVisibility

public WatchFaceStyle.Builder setBackgroundVisibility (int backgroundVisibility)

This method is deprecated.
Wear 2.0 doesn't have peeking cards

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

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

Returns
WatchFaceStyle.Builder

setCardPeekMode

public WatchFaceStyle.Builder setCardPeekMode (int peekMode)

This method is deprecated.
Wear 2.0 doesn't have peeking cards

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

setHideNotificationIndicator

public WatchFaceStyle.Builder setHideNotificationIndicator (boolean hide)

Sets whether to hide the dot indicator that is displayed at the bottom of the watch face if there are any unread notifications. The default value is false, but note that the dot will not be displayed if the numerical unread count indicator is being shown (i.e. if WatchFaceStyle.getShowUnreadCountIndicator() is true).

This API is a no-op for devices running with Android version >= Build.VERSION_CODES.R

Parameters
hide boolean

Returns
WatchFaceStyle.Builder

setHotwordIndicatorGravity

public WatchFaceStyle.Builder setHotwordIndicatorGravity (int hotwordIndicatorGravity)

This method is deprecated.
Wear 2.0 doesn't show hotword indication on the watch face

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

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

Returns
WatchFaceStyle.Builder

setPeekOpacityMode

public WatchFaceStyle.Builder setPeekOpacityMode (int peekOpacityMode)

This method is deprecated.
Wear 2.0 doesn't have peeking cards

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

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

Returns
WatchFaceStyle.Builder

setShowSystemUiTime

public WatchFaceStyle.Builder setShowSystemUiTime (boolean showSystemUiTime)

This method is deprecated.
this will be removed in a future version of the Wear platform

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

public 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).

This API is a no-op for devices running with Android version >= Build.VERSION_CODES.R

Parameters
show boolean: if true an indicator will be shown

Returns
WatchFaceStyle.Builder

setStatusBarGravity

public WatchFaceStyle.Builder setStatusBarGravity (int statusBarGravity)

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

This API is a no-op for devices running with Android version >= Build.VERSION_CODES.R

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

Returns
WatchFaceStyle.Builder

setViewProtection

public 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 WatchFaceStyle.PROTECT_STATUS_BAR, WatchFaceStyle.PROTECT_HOTWORD_INDICATOR and WatchFaceStyle.PROTECT_WHOLE_SCREEN, e.g. PROTECT_STATUS_BAR | PROTECT_HOTWORD_INDICATOR

Returns
WatchFaceStyle.Builder

setViewProtectionMode

public 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.

This API will only consider WatchFaceStyle.PROTECT_WHOLE_SCREEN for devices running with Android version >= Build.VERSION_CODES.R

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

Returns
WatchFaceStyle.Builder