Class: Toybox::WatchUi::WatchFace

Inherits:
View show all

Overview

Create a Watch Face that supports exiting/entering low power mode.

A WatchFace is a special View that responds to gestures (i.e. raising the watch to check the time) that trigger high power mode, during which a Watch Face updates at approximately once per second. The app will return to low power mode when the device is either lowered or high power mode times out (typically about ten seconds).

Since:

  • 1.0.0

Instance Method Summary collapse

Methods inherited from View

findDrawableById, onHide, onLayout, onShow, onUpdate, setKeyToSelectableInteraction, setLayout

Methods inherited from Lang::Object

equals, hashCode, method, toString, weak

Constructor Details

initializeWatchFace

Returns a new instance of WatchFace

Since:

  • 1.0.0


12325
12326
# File 'Monkeybrains.rb', line 12325

def initialize()
end

Instance Method Details

onEnterSleepObject

The device is entering sleep mode.

Terminate any active timers and prepare for once-per-minute updates.

Since:

  • 1.0.0


12332
12333
# File 'Monkeybrains.rb', line 12332

def onEnterSleep()
end

onExitSleepObject

The device is exiting sleep mode.

Timers and animations may be started here in preparation for once-per- second updates.

Since:

  • 1.0.0


12340
12341
# File 'Monkeybrains.rb', line 12340

def onExitSleep()
end

onPartialUpdate(dc) ⇒ Object

Note:

See the Analog sample distributed with the SDK for an example of onPartialUpdate() using clipping regions

Update a portion of the screen.

Partial updates can be used to update a small part of the screen to allow for Always On Watch Faces.

This method is called each second as long as the device power budget is not exceeded. It is important to update as small of a portion of the display as possible in this method to avoid exceeding the allowed power budget. To do this, the application must set the clipping region for the Graphics.Dc object using the setClip() method. Calls to System.println() and System.print() will not execute on devices when this function is being invoked, but can be used in the device simulator.

If the call to this method exceeds the power budget of the device, the partial update will not draw and a call to onPowerBudgetExceeded() is made to report the limits that were exceeded.

Parameters:

See Also:

Since:

  • 2.3.0


12369
12370
# File 'Monkeybrains.rb', line 12369

def onPartialUpdate(dc)
end