Note: The Wearable Support Library classes under the android.support.wearable
package are subject to change. For the full Android API reference, see Reference.
java.lang.Object | |||
↳ | android.service.wallpaper.WallpaperService.Engine | ||
↳ | android.support.wearable.watchface.WatchFaceService.Engine | ||
↳ | android.support.wearable.watchface.Gles2WatchFaceService.Engine |
The actual implementation of a watch face that draws using OpenGL ES 2.0. You must implement
onCreateEngine()
to return your concrete Engine
implementation.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Returns the desired EGL config to use.
| |||||||||||
Creates the EGL context and returns it.
| |||||||||||
Creates and returns a new EGL window surface for
surfaceHolder .
| |||||||||||
Initializes the display.
| |||||||||||
Schedules a call to
onDraw() to draw the next frame.
| |||||||||||
Draws the watch face.
| |||||||||||
Called when a new GL context is created.
| |||||||||||
Called when a new GL surface is created.
| |||||||||||
Posts a message to schedule a call to
onDraw() to draw the next frame.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
android.support.wearable.watchface.WatchFaceService.Engine
| |||||||||||
From class
android.service.wallpaper.WallpaperService.Engine
| |||||||||||
From class
java.lang.Object
|
Returns the desired EGL config to use. By default, uses a config that:
Watch faces can override this method to call eglChooseConfig(EGLDisplay, int[], int, EGLConfig[], int, int, int[], int)
with
different attributes. By passing in a large array, eglChooseConfig
can return
multiple matching configs and the watch face can choose among them by using
eglGetConfigAttrib(EGLDisplay, EGLConfig, int, int[], int)
to fetch their attributes.
eglDisplay | the EGL display to use |
---|
Creates the EGL context and returns it. By default, creates an EGL 2.0 context using
eglCreateContext(EGLDisplay, EGLConfig, EGLContext, int[], int)
.
Watch faces can override this method to call eglCreateContext(EGLDisplay, EGLConfig, EGLContext, int[], int)
with
different attributes.
Creates and returns a new EGL window surface for surfaceHolder
. By default, this
surface has no attributes.
Watch faces can override this method to call eglCreateWindowSurface(EGLDisplay, EGLConfig, Object, int[], int)
with
different attributes.
Initializes the display. Calls eglGetDisplay(int)
and
eglInitialize(EGLDisplay, int[], int, int[], int)
.
Schedules a call to onDraw()
to draw the next frame. Must be called on the main
thread.
Draws the watch face. It's safe to use GL APIs in this method.
Called when a new GL context is created. It's safe to use GL APIs in this method.
Called when a new GL surface is created. It's safe to use GL APIs in this method.
width | width of surface in pixels |
---|---|
height | height of surface in pixels |
Posts a message to schedule a call to onDraw()
to draw the next frame. Unlike
invalidate()
, this method is thread-safe and may be called on any thread.