using Toybox.WatchUi as Ui;
using Toybox.Graphics as Gfx;
using Toybox.System as Sys;
using Toybox.Lang as Lang;
using Toybox.Timer as Timer;
class TimerTestView extends Ui.WatchFace {
var timer1;
var updateCount = 0;
function callback1()
{
Ui.requestUpdate();
}
function onLayout(dc)
{
timer1 = new Timer.Timer();
}
function onUpdate(dc)
{
var string;
dc.setColor( Gfx.COLOR_BLACK, Gfx.COLOR_BLACK );
dc.clear();
dc.setColor( Gfx.COLOR_WHITE, Gfx.COLOR_TRANSPARENT );
string = "Count: " + updateCount;
dc.drawText( 40, (dc.getHeight() / 2) - 30, Gfx.FONT_MEDIUM, string, Gfx.TEXT_JUSTIFY_LEFT );
updateCount++;
timer1.start( method(:callback1), 200, false );
}
//! The user has just looked at their watch. Timers and animations may be started here.
function onExitSleep() {
}
//! Terminate any active timers and prepare for slow updates.
function onEnterSleep() {
timer1.stop();
}
}