ListenableGlesRenderer

public abstract class ListenableGlesRenderer extends Renderer, Renderer.GlesRenderer

Object
   ↳ Renderer
     ↳ Renderer.GlesRenderer
       ↳ ListenableGlesRenderer

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

Summary

Public constructors

ListenableGlesRenderer(
    SurfaceHolder surfaceHolder,
    CurrentUserStyleRepository currentUserStyleRepository,
    WatchState watchState,
    @IntRange(from = 0, to = 60000) long interactiveDrawModeUpdateDelayMillis,
    int[] eglConfigAttribList,
    int[] eglSurfaceAttribList
)

Public methods

void

Called once a background thread when a new GL context is created on the background thread, before any subsequent calls to render.

void
onUiThreadGlSurfaceCreated(@Px int width, @Px int height)

Called when a new GL surface is created on the UiThread, before any subsequent calls to render or in response to SurfaceHolder.Callback.surfaceChanged.

final @WorkerThread void

Inside of a Mutex this function sets the GL context associated with the WatchFaceService.getBackgroundThreadHandler's looper thread as the current one, executes runnable and finally unsets the GL context.

final @UiThread void

Inside of a Mutex this function sets the UiThread GL context as the current one, executes runnable and finally unsets the GL context.

Inherited methods

From class Renderer
@UiThread @NonNull Rect

This method is used for accessibility support to describe the portion of the screen containing the main clock element.

final @UiThread void

Schedules a call to either CanvasRenderer.render or GlesRenderer.render to draw the next frame.

final void

Posts a message to schedule a call to either CanvasRenderer.render or GlesRenderer.render to draw the next frame.

@UiThread boolean

The system periodically (at least once per minute) calls onTimeTick() to trigger a display update.

From class Renderer.GlesRenderer
@CallSuper void

Called when the Renderer is destroyed.

void

Called when adb shell dumpsys is invoked for the WatchFaceService, allowing the renderer to optionally record state for debugging purposes.

abstract @UiThread void
render(ZonedDateTime zonedDateTime)

Sub-classes should override this to implement their watch face rendering logic which should respect the current renderParameters.

abstract @UiThread void

Sub-classes should override this to implement their watch face highlight layer rendering logic for the RenderParameters.highlightLayer aspect of renderParameters.

final @WorkerThread void

Inside of a Mutex this function sets the GL context associated with the WatchFaceService.getBackgroundThreadHandler's looper thread as the current one, executes commands and finally unsets the GL context.

final void

Inside of a Mutex this function sets the UiThread GL context as the current one, executes commands and finally unsets the GL context.

Public constructors

ListenableGlesRenderer

public final ListenableGlesRenderer(
    SurfaceHolder surfaceHolder,
    CurrentUserStyleRepository currentUserStyleRepository,
    WatchState watchState,
    @IntRange(from = 0, to = 60000) long interactiveDrawModeUpdateDelayMillis,
    int[] eglConfigAttribList,
    int[] eglSurfaceAttribList
)

Public methods

onBackgroundThreadGlContextCreated

public void onBackgroundThreadGlContextCreated()

Called once a background thread when a new GL context is created on the background thread, before any subsequent calls to render. Note this function is called inside a lambda passed to runBackgroundThreadGlCommands which has synchronized access to the GL context.

If you need to override this method in java, consider using androidx.wear.watchface.ListenableGlesRenderer instead.

onUiThreadGlSurfaceCreated

public void onUiThreadGlSurfaceCreated(@Px int width, @Px int height)

Called when a new GL surface is created on the UiThread, before any subsequent calls to render or in response to SurfaceHolder.Callback.surfaceChanged. Note this