diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8dc6a2d --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +bin/ +out/ diff --git a/manifest.xml b/manifest.xml new file mode 100644 index 0000000..15cefab --- /dev/null +++ b/manifest.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/monkey.jungle b/monkey.jungle new file mode 100755 index 0000000..87796c7 --- /dev/null +++ b/monkey.jungle @@ -0,0 +1 @@ +project.manifest = manifest.xml diff --git a/resources/drawables/drawables.xml b/resources/drawables/drawables.xml new file mode 100755 index 0000000..a22c33c --- /dev/null +++ b/resources/drawables/drawables.xml @@ -0,0 +1,3 @@ + + + diff --git a/resources/drawables/launcher_icon.png b/resources/drawables/launcher_icon.png new file mode 100755 index 0000000..d3594e7 Binary files /dev/null and b/resources/drawables/launcher_icon.png differ diff --git a/resources/fonts/input.fnt b/resources/fonts/input.fnt new file mode 100644 index 0000000..e971ee0 --- /dev/null +++ b/resources/fonts/input.fnt @@ -0,0 +1,101 @@ +info face="InputMono" size=24 bold=1 italic=0 charset="" unicode=1 stretchH=100 smooth=1 aa=1 padding=0,0,0,0 spacing=1,1 outline=0 +common lineHeight=24 base=19 scaleW=256 scaleH=256 pages=1 packed=0 alphaChnl=0 redChnl=0 greenChnl=0 blueChnl=0 +page id=0 file="input_0.png" +chars count=97 +char id=0 x=113 y=18 width=1 height=1 xoffset=0 yoffset=0 xadvance=0 page=0 chnl=15 +char id=13 x=253 y=0 width=1 height=1 xoffset=0 yoffset=0 xadvance=0 page=0 chnl=15 +char id=32 x=251 y=0 width=1 height=1 xoffset=0 yoffset=0 xadvance=13 page=0 chnl=15 +char id=33 x=31 y=52 width=6 height=15 xoffset=3 yoffset=4 xadvance=13 page=0 chnl=15 +char id=34 x=19 y=69 width=10 height=9 xoffset=1 yoffset=4 xadvance=13 page=0 chnl=15 +char id=35 x=181 y=0 width=13 height=15 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=15 +char id=36 x=126 y=0 width=12 height=16 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=15 +char id=37 x=14 y=20 width=13 height=15 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=15 +char id=38 x=28 y=20 width=13 height=15 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=15 +char id=39 x=250 y=48 width=5 height=9 xoffset=4 yoffset=4 xadvance=13 page=0 chnl=15 +char id=40 x=90 y=0 width=9 height=19 xoffset=2 yoffset=4 xadvance=13 page=0 chnl=15 +char id=41 x=60 y=0 width=9 height=19 xoffset=1 yoffset=4 xadvance=13 page=0 chnl=15 +char id=42 x=74 y=52 width=12 height=12 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=15 +char id=43 x=87 y=52 width=11 height=12 xoffset=1 yoffset=6 xadvance=13 page=0 chnl=15 +char id=44 x=39 y=66 width=7 height=9 xoffset=3 yoffset=14 xadvance=13 page=0 chnl=15 +char id=45 x=79 y=65 width=11 height=3 xoffset=1 yoffset=11 xadvance=13 page=0 chnl=15 +char id=46 x=72 y=65 width=6 height=5 xoffset=3 yoffset=14 xadvance=13 page=0 chnl=15 +char id=47 x=24 y=0 width=11 height=19 xoffset=1 yoffset=4 xadvance=13 page=0 chnl=15 +char id=48 x=72 y=36 width=11 height=15 xoffset=1 yoffset=4 xadvance=13 page=0 chnl=15 +char id=49 x=120 y=34 width=11 height=15 xoffset=1 yoffset=4 xadvance=13 page=0 chnl=15 +char id=50 x=156 y=32 width=11 height=15 xoffset=1 yoffset=4 xadvance=13 page=0 chnl=15 +char id=51 x=94 y=20 width=12 height=15 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=15 +char id=52 x=209 y=0 width=13 height=15 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=15 +char id=53 x=107 y=20 width=12 height=15 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=15 +char id=54 x=60 y=36 width=11 height=15 xoffset=1 yoffset=4 xadvance=13 page=0 chnl=15 +char id=55 x=228 y=32 width=11 height=15 xoffset=1 yoffset=4 xadvance=13 page=0 chnl=15 +char id=56 x=171 y=16 width=11 height=15 xoffset=1 yoffset=4 xadvance=13 page=0 chnl=15 +char id=57 x=240 y=32 width=11 height=15 xoffset=1 yoffset=4 xadvance=13 page=0 chnl=15 +char id=58 x=12 y=69 width=6 height=11 xoffset=3 yoffset=8 xadvance=13 page=0 chnl=15 +char id=59 x=23 y=53 width=7 height=15 xoffset=3 yoffset=8 xadvance=13 page=0 chnl=15 +char id=60 x=49 y=52 width=10 height=13 xoffset=1 yoffset=6 xadvance=13 page=0 chnl=15 +char id=61 x=60 y=65 width=11 height=8 xoffset=1 yoffset=9 xadvance=13 page=0 chnl=15 +char id=62 x=38 y=52 width=10 height=13 xoffset=1 yoffset=6 xadvance=13 page=0 chnl=15 +char id=63 x=68 y=20 width=12 height=15 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=15 +char id=64 x=113 y=0 width=12 height=17 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=15 +char id=65 x=195 y=0 width=13 height=15 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=15 +char id=66 x=183 y=16 width=11 height=15 xoffset=1 yoffset=4 xadvance=13 page=0 chnl=15 +char id=67 x=195 y=16 width=11 height=15 xoffset=1 yoffset=4 xadvance=13 page=0 chnl=15 +char id=68 x=207 y=16 width=11 height=15 xoffset=1 yoffset=4 xadvance=13 page=0 chnl=15 +char id=69 x=219 y=16 width=11 height=15 xoffset=1 yoffset=4 xadvance=13 page=0 chnl=15 +char id=70 x=231 y=16 width=11 height=15 xoffset=1 yoffset=4 xadvance=13 page=0 chnl=15 +char id=71 x=243 y=16 width=11 height=15 xoffset=1 yoffset=4 xadvance=13 page=0 chnl=15 +char id=72 x=0 y=37 width=11 height=15 xoffset=1 yoffset=4 xadvance=13 page=0 chnl=15 +char id=73 x=12 y=37 width=11 height=15 xoffset=1 yoffset=4 xadvance=13 page=0 chnl=15 +char id=74 x=120 y=18 width=12 height=15 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=15 +char id=75 x=81 y=20 width=12 height=15 xoffset=1 yoffset=4 xadvance=13 page=0 chnl=15 +char id=76 x=12 y=53 width=10 height=15 xoffset=2 yoffset=4 xadvance=13 page=0 chnl=15 +char id=77 x=42 y=20 width=12 height=15 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=15 +char id=78 x=36 y=36 width=11 height=15 xoffset=1 yoffset=4 xadvance=13 page=0 chnl=15 +char id=79 x=159 y=16 width=11 height=15 xoffset=1 yoffset=4 xadvance=13 page=0 chnl=15 +char id=80 x=0 y=53 width=11 height=15 xoffset=1 yoffset=4 xadvance=13 page=0 chnl=15 +char id=81 x=0 y=0 width=11 height=20 xoffset=1 yoffset=4 xadvance=13 page=0 chnl=15 +char id=82 x=133 y=17 width=12 height=15 xoffset=1 yoffset=4 xadvance=13 page=0 chnl=15 +char id=83 x=55 y=20 width=12 height=15 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=15 +char id=84 x=223 y=0 width=13 height=15 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=15 +char id=85 x=48 y=36 width=11 height=15 xoffset=1 yoffset=4 xadvance=13 page=0 chnl=15 +char id=86 x=237 y=0 width=13 height=15 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=15 +char id=87 x=167 y=0 width=13 height=15 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=15 +char id=88 x=153 y=0 width=13 height=15 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=15 +char id=89 x=139 y=0 width=13 height=15 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=15 +char id=90 x=24 y=36 width=11 height=15 xoffset=1 yoffset=4 xadvance=13 page=0 chnl=15 +char id=91 x=70 y=0 width=9 height=19 xoffset=2 yoffset=4 xadvance=13 page=0 chnl=15 +char id=92 x=12 y=0 width=11 height=19 xoffset=1 yoffset=4 xadvance=13 page=0 chnl=15 +char id=93 x=100 y=0 width=8 height=19 xoffset=2 yoffset=4 xadvance=13 page=0 chnl=15 +char id=94 x=60 y=52 width=13 height=12 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=15 +char id=95 x=91 y=65 width=11 height=3 xoffset=1 yoffset=20 xadvance=13 page=0 chnl=15 +char id=96 x=30 y=69 width=8 height=9 xoffset=2 yoffset=4 xadvance=13 page=0 chnl=15 +char id=97 x=113 y=52 width=13 height=11 xoffset=0 yoffset=8 xadvance=13 page=0 chnl=15 +char id=98 x=84 y=36 width=11 height=15 xoffset=1 yoffset=4 xadvance=13 page=0 chnl=15 +char id=99 x=0 y=69 width=11 height=11 xoffset=1 yoffset=8 xadvance=13 page=0 chnl=15 +char id=100 x=96 y=36 width=11 height=15 xoffset=1 yoffset=4 xadvance=13 page=0 chnl=15 +char id=101 x=166 y=48 width=11 height=11 xoffset=1 yoffset=8 xadvance=13 page=0 chnl=15 +char id=102 x=108 y=36 width=11 height=15 xoffset=1 yoffset=4 xadvance=13 page=0 chnl=15 +char id=103 x=0 y=21 width=13 height=15 xoffset=0 yoffset=8 xadvance=13 page=0 chnl=15 +char id=104 x=132 y=34 width=11 height=15 xoffset=1 yoffset=4 xadvance=13 page=0 chnl=15 +char id=105 x=144 y=33 width=11 height=15 xoffset=1 yoffset=4 xadvance=13 page=0 chnl=15 +char id=106 x=80 y=0 width=9 height=19 xoffset=1 yoffset=4 xadvance=13 page=0 chnl=15 +char id=107 x=168 y=32 width=11 height=15 xoffset=1 yoffset=4 xadvance=13 page=0 chnl=15 +char id=108 x=180 y=32 width=11 height=15 xoffset=1 yoffset=4 xadvance=13 page=0 chnl=15 +char id=109 x=127 y=50 width=12 height=11 xoffset=0 yoffset=8 xadvance=13 page=0 chnl=15 +char id=110 x=178 y=48 width=11 height=11 xoffset=1 yoffset=8 xadvance=13 page=0 chnl=15 +char id=111 x=190 y=48 width=11 height=11 xoffset=1 yoffset=8 xadvance=13 page=0 chnl=15 +char id=112 x=192 y=32 width=11 height=15 xoffset=1 yoffset=8 xadvance=13 page=0 chnl=15 +char id=113 x=204 y=32 width=11 height=15 xoffset=1 yoffset=8 xadvance=13 page=0 chnl=15 +char id=114 x=202 y=48 width=11 height=11 xoffset=1 yoffset=8 xadvance=13 page=0 chnl=15 +char id=115 x=214 y=48 width=11 height=11 xoffset=1 yoffset=8 xadvance=13 page=0 chnl=15 +char id=116 x=216 y=32 width=11 height=15 xoffset=1 yoffset=4 xadvance=13 page=0 chnl=15 +char id=117 x=226 y=48 width=11 height=11 xoffset=1 yoffset=8 xadvance=13 page=0 chnl=15 +char id=118 x=140 y=50 width=12 height=11 xoffset=0 yoffset=8 xadvance=13 page=0 chnl=15 +char id=119 x=99 y=52 width=13 height=11 xoffset=0 yoffset=8 xadvance=13 page=0 chnl=15 +char id=120 x=153 y=49 width=12 height=11 xoffset=0 yoffset=8 xadvance=13 page=0 chnl=15 +char id=121 x=146 y=16 width=12 height=15 xoffset=0 yoffset=8 xadvance=13 page=0 chnl=15 +char id=122 x=238 y=48 width=11 height=11 xoffset=1 yoffset=8 xadvance=13 page=0 chnl=15 +char id=123 x=36 y=0 width=11 height=19 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=15 +char id=124 x=109 y=0 width=3 height=19 xoffset=5 yoffset=4 xadvance=13 page=0 chnl=15 +char id=125 x=48 y=0 width=11 height=19 xoffset=2 yoffset=4 xadvance=13 page=0 chnl=15 +char id=126 x=47 y=66 width=12 height=8 xoffset=0 yoffset=8 xadvance=13 page=0 chnl=15 diff --git a/resources/fonts/input.xml b/resources/fonts/input.xml new file mode 100644 index 0000000..94cfc4f --- /dev/null +++ b/resources/fonts/input.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/resources/fonts/input_0.png b/resources/fonts/input_0.png new file mode 100644 index 0000000..c9d912d Binary files /dev/null and b/resources/fonts/input_0.png differ diff --git a/resources/fonts/input_1.png b/resources/fonts/input_1.png new file mode 100644 index 0000000..de30095 Binary files /dev/null and b/resources/fonts/input_1.png differ diff --git a/resources/layouts/layout.xml b/resources/layouts/layout.xml new file mode 100755 index 0000000..8d50fca --- /dev/null +++ b/resources/layouts/layout.xml @@ -0,0 +1,3 @@ + + \ No newline at end of file diff --git a/resources/strings/strings.xml b/resources/strings/strings.xml new file mode 100644 index 0000000..95a0bf5 --- /dev/null +++ b/resources/strings/strings.xml @@ -0,0 +1,3 @@ + + terminalface + diff --git a/source/terminalfaceApp.mc b/source/terminalfaceApp.mc new file mode 100644 index 0000000..4c4d3fb --- /dev/null +++ b/source/terminalfaceApp.mc @@ -0,0 +1,28 @@ +import Toybox.Application; +import Toybox.Lang; +import Toybox.WatchUi; + +class terminalfaceApp extends Application.AppBase { + + function initialize() { + AppBase.initialize(); + } + + // onStart() is called on application start up + function onStart(state as Dictionary?) as Void { + } + + // onStop() is called when your application is exiting + function onStop(state as Dictionary?) as Void { + } + + // Return the initial view of your application here + function getInitialView() as Array? { + return [ new terminalfaceView() ] as Array; + } + +} + +function getApp() as terminalfaceApp { + return Application.getApp() as terminalfaceApp; +} \ No newline at end of file diff --git a/source/terminalfaceView.mc b/source/terminalfaceView.mc new file mode 100644 index 0000000..194040f --- /dev/null +++ b/source/terminalfaceView.mc @@ -0,0 +1,152 @@ +import Toybox.Graphics; +import Toybox.Lang; +import Toybox.System; +import Toybox.WatchUi; +import Toybox.Time.Gregorian; + +using Toybox.ActivityMonitor; + +class terminalfaceView extends WatchUi.WatchFace { + private var font as FontResource?; + private var curY as Number?; + private var lineSpace as Number?; + private var blinking as Boolean?; + private var lastBlink as Boolean?; + + function initialize() { + WatchFace.initialize(); + font = WatchUi.loadResource(Rez.Fonts.id_font_input) as FontResource; + lineSpace = 23; + blinking = false; + lastBlink = false; + } + + // Load your resources here + function onLayout(dc as Dc) as Void { + setLayout(Rez.Layouts.WatchFace(dc)); + } + + // Called when this View is brought to the foreground. Restore + // the state of this View and prepare it to be shown. This includes + // loading resources into memory. + function onShow() as Void { + } + + private function prompt(dc as Dc, cmd as String) as Void { + dc.setColor(Graphics.COLOR_GREEN, Graphics.COLOR_TRANSPARENT); + dc.drawText(25, curY, font, "si", Graphics.TEXT_JUSTIFY_LEFT); + + dc.setColor(Graphics.COLOR_BLUE, Graphics.COLOR_TRANSPARENT); + dc.drawText(50, curY, font, "@", Graphics.TEXT_JUSTIFY_LEFT); + + dc.setColor(Graphics.COLOR_RED, Graphics.COLOR_TRANSPARENT); + dc.drawText(63, curY, font, "fnx", Graphics.TEXT_JUSTIFY_LEFT); + + dc.setColor(Graphics.COLOR_BLUE, Graphics.COLOR_TRANSPARENT); + dc.drawText(113, curY, font, "~>", Graphics.TEXT_JUSTIFY_LEFT); + + dc.setColor(Graphics.COLOR_WHITE, Graphics.COLOR_TRANSPARENT); + dc.drawText(150, curY, font, Lang.format("$1$", [cmd]), Graphics.TEXT_JUSTIFY_LEFT); + + curY += lineSpace; + } + + private function response(dc as Dc, text as String) as Void { + dc.setColor(Graphics.COLOR_WHITE, Graphics.COLOR_TRANSPARENT); + dc.drawText(25, curY, font, text, Graphics.TEXT_JUSTIFY_LEFT); + + curY += lineSpace; + } + + private function makeBatteryString() { + var stats = System.getSystemStats(); + var batteryLevel = stats.battery; + var batteryDays = stats.batteryInDays; + + var bar = new [10]; + for (var i = 0; i < 10; i += 1) + { + if (batteryLevel > i*10) + { + bar[i] = '#'; + } + else + { + bar[i] = '-'; + } + } + + bar.add(batteryDays.toNumber()); + + return Lang.format("[$1$$2$$3$$4$$5$$6$$7$$8$$9$$10$] ($11$d)", bar); + } + + // Update the view + function onUpdate(dc as Dc) as Void { + curY = 50; + + dc.setColor(Graphics.COLOR_TRANSPARENT, Graphics.COLOR_BLACK); + dc.clear(); + + prompt(dc, "date"); + + var today = Gregorian.info(Time.now(), Time.FORMAT_MEDIUM); + var dateString = Lang.format("$1$ $2$ $3$ $4$:$5$", + [ + today.day_of_week, + today.month, + today.day, + today.hour.format("%02d"), + today.min.format("%02d"), + ]); + + response(dc, dateString); + + prompt(dc, "steps"); + var info = ActivityMonitor.getInfo(); + var steps = info.steps.toFloat(); + var stepGoal = info.stepGoal.toFloat(); + var ratio = (steps/stepGoal)*100; + response(dc, Lang.format("$1$/$2$ ($3$%)", [steps.toNumber(), stepGoal.toNumber(), ratio.toNumber()])); + + prompt(dc, "battery"); + var batteryString = makeBatteryString(); + response(dc, batteryString); + + if (blinking) + { + if (lastBlink) + { + prompt(dc, ""); + lastBlink = false; + } + else + { + prompt(dc, "_"); + lastBlink = true; + } + } + else + { + prompt(dc, "_"); + } + + } + + // Called when this View is removed from the screen. Save the + // state of this View here. This includes freeing resources from + // memory. + function onHide() as Void { + } + + // The user has just looked at their watch. Timers and animations may be started here. + function onExitSleep() as Void { + blinking = true; + } + + // Terminate any active timers and prepare for slow updates. + function onEnterSleep() as Void { + blinking = false; + } + +}