CanvasRenderer
abstract class CanvasRenderer : Renderer
Watch faces that require Canvas rendering should extend their Renderer from this
class.
Summary
Public constructors |
Watch faces that require Canvas rendering should extend their Renderer from this
class.
|
Public methods |
abstract Unit |
Sub-classes should override this to implement their rendering logic which should respect
the current DrawMode.
|
Inherited functions |
From class Renderer
Rect |
getMainClockElementBounds()
This method is used for accessibility support to describe the portion of the screen
containing the main clock element. By default we assume this is contained in the central
half of the watch face. Watch faces should override this to return the correct bounds for
the main clock element.
|
Unit |
invalidate()
Schedules a call to renderInternal to draw the next frame.
|
Unit |
onDestroy()
Called when the Renderer is destroyed.
|
Unit |
onRenderParametersChanged(renderParameters: RenderParameters)
Called when the DrawMode has been updated. Will always be called before the first
call to onDraw().
|
Unit |
postInvalidate()
Posts a message to schedule a call to renderInternal to draw the next frame. Unlike
invalidate, this method is thread-safe and may be called on any thread.
|
Boolean |
shouldAnimate()
The system periodically (at least once per minute) calls onTimeTick() to trigger a display
update. If the watch face needs to animate with an interactive frame rate, calls to
invalidate must be scheduled. This method controls whether or not we should do that and if
shouldAnimate returns true we inhibit entering DrawMode.AMBIENT.
By default we remain at an interactive frame rate when the watch face is visible and we're
not in ambient mode. Watchfaces with animated transitions for entering ambient mode may
need to override this to ensure they play smoothly.
|
|
Public constructors
Public methods
render
@UiThread abstract fun render(
canvas: Canvas,
bounds: Rect,
calendar: Calendar
): Unit
Sub-classes should override this to implement their rendering logic which should respect
the current DrawMode. For correct functioning watch faces must use the supplied
Calendar and avoid using any other ways of getting the time.