Files
fenix8v3-watchface/source/Fenix8V3App.mc
ericwyuan 52346bdd09 Split the face into modules, comment it, and verify every field
Architecture
  Fenix8V3View had grown to 632 lines mixing layout constants, font
  metrics, icon drawing, data lookup and orchestration.  Split into:

    Layout    the 500-canvas constants, scaling, font choice and text drawing
    Icons     the three bitmap icons plus the primitive glyphs
    Settings  every stored preference and its default, in one place
    Fields    unchanged in scope, but value() is now seven category
              functions that each return null for ids they do not own --
              the ids interleave, so dispatching on ranges does not work
    View      what is left: the drawing order

  The view is down to 359 lines and no longer reaches for a property or a
  font metric directly.

Verification
  Added a harness that walks all 75 ids in the simulator and reports each
  rendered value with its pixel width.  It caught a real one: pushDistance
  and pushes compile on every device but throw "Symbol Not Found" at
  runtime on a fenix 8 -- they are wheelchair counters that only some
  firmware carries.  Every optional ActivityMonitor, UserProfile, Weather
  and Activity member is now behind a `has` check.

  The same run showed two date fields overflowing their slot, so long
  values now step down a font size rather than running into the ring.

  Always-on mode checked against the simulator's Always-On display mode:
  band fill gone, unlit ticks gone, slots hidden, time and date dimmed.

Also: Chinese "Day Date" was missing its 日, since it built the string by
hand instead of going through the localised date format.

All 17 devices build.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-10 05:48:58 +08:00

34 lines
930 B
MonkeyC

import Toybox.Application;
import Toybox.Lang;
import Toybox.WatchUi;
// Application shell. A watch face has no menus or input of its own, so this
// only hands back the view and forces a repaint when the wearer changes
// something in the Connect IQ settings.
class Fenix8V3App extends Application.AppBase {
function initialize() {
AppBase.initialize();
}
function onStart(state as Dictionary?) as Void {
}
function onStop(state as Dictionary?) as Void {
}
function getInitialView() as [Views] or [Views, InputDelegates] {
return [new Fenix8V3View()];
}
// Fires when the phone pushes new settings down. The view reads every
// preference fresh on each draw, so a repaint is all that is needed.
function onSettingsChanged() as Void {
WatchUi.requestUpdate();
}
}
function getApp() as Fenix8V3App {
return Application.getApp() as Fenix8V3App;
}