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

addLayer, clearLayers, findDrawableById, getLayerIndex, getLayers, insertLayer, onHide, onLayout, onShow, onUpdate, removeLayer, 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


13692
13693
# File 'Monkeybrains.rb', line 13692

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


13699
13700
# File 'Monkeybrains.rb', line 13699

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


13707
13708
# File 'Monkeybrains.rb', line 13707

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.


13736
13737
# File 'Monkeybrains.rb', line 13736

def onPartialUpdate(dc)
end