// Author: cirakg & claude ai // Summary: M0 placeholder home screen showing the app name and version. // // HomeView: the M0 placeholder home screen. It draws the app name and version // in the centre of the screen. Milestone M4 replaces it with the entry list. // // Performance note: everything that allocates (loading the name string, // building the version text) happens once in initialize(), not in onUpdate(). import Toybox.Graphics; import Toybox.Lang; import Toybox.WatchUi; class HomeView extends WatchUi.View { private var _title as String; private var _version as String; // Set after the first complete draw, so start-up diagnostics run once. private var _firstFrameDone as Boolean = false; function initialize() { View.initialize(); _title = WatchUi.loadResource(Rez.Strings.AppName) as String; _version = "v" + AppInfo.VERSION; } function onUpdate(dc as Graphics.Dc) as Void { var centerX = dc.getWidth() / 2; var centerY = dc.getHeight() / 2; var justify = Graphics.TEXT_JUSTIFY_CENTER | Graphics.TEXT_JUSTIFY_VCENTER; dc.setColor(Graphics.COLOR_WHITE, Graphics.COLOR_BLACK); dc.clear(); dc.drawText(centerX, centerY, Graphics.FONT_MEDIUM, _title, justify); dc.drawText(centerX, centerY + dc.getFontHeight(Graphics.FONT_MEDIUM), Graphics.FONT_XTINY, _version, justify); if (!_firstFrameDone) { _firstFrameDone = true; Diag.firstFrame(); } } }