ListenableCanvasRenderer2


abstract class ListenableCanvasRenderer2<SharedAssetsT : Renderer.SharedAssets> : Renderer.CanvasRenderer2


ListenableFuture-based compatibility wrapper around Renderer.CanvasRenderer2's suspending methods.

use Watch Face Format instead

Summary

Public constructors

<SharedAssetsT : Renderer.SharedAssets> ListenableCanvasRenderer2(
    surfaceHolder: SurfaceHolder,
    currentUserStyleRepository: CurrentUserStyleRepository,
    watchState: WatchState,
    canvasType: Int,
    interactiveDrawModeUpdateDelayMillis: @IntRange(from = 0, to = 60000) Long,
    clearWithBackgroundTintBeforeRenderingHighlightLayer: Boolean
)

This function is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

Public functions

abstract ListenableFuture<SharedAssetsT>

This function is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

final suspend Unit

This function is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

open ListenableFuture<Unit>

This function is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

Protected functions

final suspend SharedAssetsT

This function is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

Inherited functions

From androidx.wear.watchface.Renderer
open Rect

This function is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

Unit

This function is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

open Unit

This function is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

open Unit

This function is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

Unit

This function is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

Unit

This function is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

open Boolean

This function is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

From androidx.wear.watchface.Renderer.CanvasRenderer
open Unit

This function is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

From androidx.wear.watchface.Renderer.CanvasRenderer2
final Unit
render(canvas: Canvas, bounds: Rect, zonedDateTime: ZonedDateTime)

This function is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

abstract Unit
@UiThread
render(
    canvas: Canvas,
    bounds: Rect,
    zonedDateTime: ZonedDateTime,
    sharedAssets: SharedAssetsT
)

This function is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

final Unit
renderHighlightLayer(
    canvas: Canvas,
    bounds: Rect,
    zonedDateTime: ZonedDateTime
)

This function is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

abstract Unit
@UiThread
renderHighlightLayer(
    canvas: Canvas,
    bounds: Rect,
    zonedDateTime: ZonedDateTime,
    sharedAssets: SharedAssetsT
)

This function is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

Inherited properties

From androidx.wear.watchface.Renderer
Collection<Pair<IntContentDescriptionLabel>>

This property is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

@Px Float

This property is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

@Px Float

This property is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

Long

This property is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

RenderParameters

This property is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

Rect

This property is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

SurfaceHolder

This property is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

WatchFaceColors?

This property is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

From androidx.wear.watchface.Renderer.CanvasRenderer
Boolean

This property is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

Public constructors

ListenableCanvasRenderer2

<SharedAssetsT : Renderer.SharedAssets> ListenableCanvasRenderer2(
    surfaceHolder: SurfaceHolder,
    currentUserStyleRepository: CurrentUserStyleRepository,
    watchState: WatchState,
    canvasType: Int,
    interactiveDrawModeUpdateDelayMillis: @IntRange(from = 0, to = 60000) Long,
    clearWithBackgroundTintBeforeRenderingHighlightLayer: Boolean = false
)

Public functions

createSharedAssetsFuture

Added in 1.1.0
Deprecated in 1.3.0-alpha06
@WorkerThread
abstract fun createSharedAssetsFuture(): ListenableFuture<SharedAssetsT>

Implement to allow your Renderers to share data with SharedAssets. When editing multiple WatchFaceService, instances and hence Renderers can exist concurrently (e.g. a headless instance and an interactive instance). Using SharedAssets allows memory to be saved by sharing immutable data (e.g. Bitmaps, shaders, etc...) between them.

To take advantage of SharedAssets, override this method. The constructed SharedAssets are passed into the render as an argument (NB you'll have to cast this to your type).

When all instances using SharedAssets have been closed, SharedAssets.onDestroy will be called.

Note that while SharedAssets are constructed on a background thread, they'll typically be used on the main thread and subsequently destroyed there.

Returns
ListenableFuture<SharedAssetsT>

A ListenableFuture for the SharedAssetsT that will be passed into render and renderHighlightLayer

init

Added in 1.1.0
Deprecated in 1.3.0-alpha06
final suspend fun init(): Unit

Perform UiThread specific initialization. Will be called once during initialization before any subsequent calls to render. If you need to override this method in java, consider using androidx.wear.watchface.ListenableCanvasRenderer instead.

initFuture

Added in 1.1.0
Deprecated in 1.3.0-alpha06
@UiThread
open fun initFuture(): ListenableFuture<Unit>

Perform UiThread specific initialization. Will be called once during initialization before any subsequent calls to render. Note cancellation of the returned future is not supported.

Returns
ListenableFuture<Unit>

A ListenableFuture which is resolved when UiThread has completed. Rendering will be blocked until this has resolved.

Protected functions

createSharedAssets

protected final suspend fun createSharedAssets(): SharedAssetsT

When editing multiple WatchFaceService instances and hence Renderers can exist concurrently (e.g. a headless instance and an interactive instance) and using SharedAssets allows memory to be saved by sharing immutable data (e.g. Bitmaps, shaders, etc...) between them.

To take advantage of SharedAssets, override this method. The constructed SharedAssets are passed into the render as an argument (NB you'll have to cast this to your type).

When all instances using SharedAssets have been closed, SharedAssets.onDestroy will be called.

Note that while SharedAssets are constructed on a background thread, they'll typically be used on the main thread and subsequently destroyed there.

Returns
SharedAssetsT

The SharedAssetsT that will be passed into render and renderHighlightLayer.