WatchFace
public final class WatchFace
The return value of WatchFaceService.createWatchFace which brings together rendering, styling, complicationSlots and state observers.
use Watch Face Format instead
Summary
Nested types |
|---|
public final class WatchFace.LegacyWatchFaceOverlayStyleThis class is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
public final class WatchFace.OverlayStyleThis class is deprecated. OverlayStyle will be removed in a future release. |
public interface WatchFace.TapListenerThis interface is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
Public constructors |
|---|
|
This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
Public methods |
|
|---|---|
final @NonNull WatchFace.LegacyWatchFaceOverlayStyle |
This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
final @NonNull WatchFace.OverlayStyle |
This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
final Instant |
This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
final @NonNull Renderer |
This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
final int |
This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
static final boolean |
This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
final @NonNull WatchFace |
This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
final @NonNull WatchFace |
This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
final @NonNull WatchFace |
This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
final @NonNull WatchFace |
This method is deprecated. OverlayStyle will be removed in a future release. |
final @NonNull WatchFace |
This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
final @NonNull WatchFace |
This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
final @NonNull WatchFace |
This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
final void |
This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
Public constructors
WatchFace
publicWatchFace(int watchFaceType, @NonNull Renderer renderer)
Public methods
getLegacyWatchFaceStyle
public final @NonNull WatchFace.LegacyWatchFaceOverlayStylegetLegacyWatchFaceStyle()
The legacy LegacyWatchFaceOverlayStyle which only affects Wear 2.0 devices.
public final @NonNull WatchFace.OverlayStylegetOverlayStyle()
The OverlayStyle. This feature is unimplemented on any platform, and will be removed.
getOverridePreviewReferenceInstant
public final InstantgetOverridePreviewReferenceInstant()
The Instant to use for preview rendering, or null if not set in which case the system chooses the Instant to use.
getRenderer
public final @NonNull RenderergetRenderer()
The Renderer for this WatchFace.
getWatchFaceType
public final int getWatchFaceType()The type of watch face, whether it's digital or analog. Used to determine the default time for editor preview screenshots.
isLegacyWatchFaceOverlayStyleSupported
public static final boolean isLegacyWatchFaceOverlayStyleSupported()Returns whether LegacyWatchFaceOverlayStyle is supported on this device.
setComplicationDeniedDialogIntent
public final @NonNull WatchFacesetComplicationDeniedDialogIntent(
Intent complicationDeniedDialogIntent
)
Sets the Intent to launch an activity which explains the watch face needs permission to display complications. It is recommended the activity have a button which launches an intent with Settings.ACTION_APPLICATION_DETAILS_SETTINGS to allow the user to grant permissions if they wish.
This complicationDeniedDialogIntent is launched when the user tries to configure a complication slot when the com.google.android.wearable.permission.RECEIVE_COMPLICATION_DATA permission has been denied. If the intent is not set or is null then no dialog will be displayed.
setComplicationRationaleDialogIntent
public final @NonNull WatchFacesetComplicationRationaleDialogIntent(
Intent complicationRationaleDialogIntent
)
Sets the Intent to launch an activity that explains the rational for the requesting the com.google.android.wearable.permission.RECEIVE_COMPLICATION_DATApermission prior to requesting it, if [Activity.shouldShowRequestPermissionRationale] returns true`.
If the intent is not set or is null then no dialog will be displayed.
setLegacyWatchFaceStyle
public final @NonNull WatchFacesetLegacyWatchFaceStyle(
@NonNull WatchFace.LegacyWatchFaceOverlayStyle legacyWatchFaceStyle
)
Sets the legacy LegacyWatchFaceOverlayStyle which only affects Wear 2.0 devices.
public final @NonNull WatchFacesetOverlayStyle(@NonNull WatchFace.OverlayStyle watchFaceOverlayStyle)
Sets the OverlayStyle which is ignored because this feature is unimplemented on any platform, and will be removed.
setOverridePreviewReferenceInstant
public final @NonNull WatchFacesetOverridePreviewReferenceInstant(
@NonNull Instant previewReferenceTimeMillis
)
Overrides the reference time for editor preview images.
setTapListener
public final @NonNull WatchFacesetTapListener(WatchFace.TapListener tapListener)
Sets an optional TapListener which if not null gets called on the ui thread whenever the user taps on the watchface.
setUpdateScreenshotOnConfigurationChange
public final @NonNull WatchFacesetUpdateScreenshotOnConfigurationChange(
boolean updateScreenshotOnConfigurationChange
)
If updateScreenshotOnConfigurationChange is true then whenever WatchFaceService.onConfigurationChanged gets called while this watch face is active then a request will be made for the system to update the watch's screenshot displayed in the picker.
By default this is off.
Note if WatchFaceService.onConfigurationChanged or Renderer.sendPreviewImageNeedsUpdateRequest get called very frequently then the system may throttle the rate at which screenshots are taken.
setWatchFaceType
public final void setWatchFaceType(int watchFaceType)| Parameters | |
|---|---|
int watchFaceType |
The type of watch face, whether it's digital or analog. Used to determine the default time for editor preview screenshots. |