Created
April 3, 2015 10:55
-
-
Save hyakuhei/c543c41033891f8fccdf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Toybox.WatchUi as Ui; | |
using Toybox.Graphics as Gfx; | |
using Toybox.System as Sys; | |
using Toybox.Lang as Lang; | |
class TestWatchView extends Ui.WatchFace { | |
//! Load your resources here | |
function onLayout(dc) { | |
setLayout(Rez.Layouts.WatchFace(dc)); | |
} | |
//! Restore the state of the app and prepare the view to be shown | |
function onShow() { | |
} | |
//! Update the view | |
function onUpdate(dc) { | |
// Get and show the current time | |
var clockTime = Sys.getClockTime(); | |
var timeString = Lang.format("$1$:$2$:$3$", [clockTime.hour, clockTime.min.format("%.2d"), clockTime.sec.format("%.2d")]); | |
var view = View.findDrawableById("TimeLabel"); | |
view.setText(timeString); | |
// Call the parent onUpdate function to redraw the layout | |
View.onUpdate(dc); | |
System.println("End of onUpdate"); | |
} | |
//! 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() { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment