ListenableCanvasRenderer2
abstract class ListenableCanvasRenderer2<SharedAssetsT : Renderer.SharedAssets> : Renderer.CanvasRenderer2
| kotlin.Any | ||||
| ↳ | androidx.wear.watchface.Renderer | |||
| ↳ | androidx.wear.watchface.Renderer.CanvasRenderer | |||
| ↳ | androidx.wear.watchface.Renderer.CanvasRenderer2 | |||
| ↳ | androidx.wear.watchface.ListenableCanvasRenderer2 |
ListenableFuture-based compatibility wrapper around Renderer.CanvasRenderer2's suspending methods.
use Watch Face Format instead
Summary
Public constructors |
|---|
<SharedAssetsT : Renderer.SharedAssets> 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 |
||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||||||||||
|
||||||||||||||
|
Inherited properties |
||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||||||||||||
|
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
@WorkerThread
abstract funcreateSharedAssetsFuture(): 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 |
init
final suspend funinit(): 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
@UiThread
open funinitFuture(): 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 |
Protected functions
createSharedAssets
protected final suspend fun createSharedAssets(): SharedAssetsTWhen 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 |