Hello,
I made a simple test watch face - the stock "watch face" project with an extra field for HR and a couple of custom fonts:
import Toybox.Graphics;
import Toybox.Lang;
import Toybox.System;
import Toybox.WatchUi;
import Toybox.Activity;
(:background)
class Watchface3View extends WatchUi.WatchFace {
protected var dimmed;
protected var width;
protected var height;
function initialize() {
WatchFace.initialize();
self.dimmed = false;
self.width = 0;
self.height = 0;
}
// Load your resources here
function onLayout(dc as Dc) as Void {
setLayout(Rez.Layouts.WatchFace(dc));
self.width = dc.getWidth();
self.height = dc.getHeight();
System.println("Screen size " + self.width + " x " + self.height);
}
function onShow() as Void { }
// Update the view
function onUpdate(dc as Dc) as Void {
var timeField = View.findDrawableById("time") as Text;
var miscField = View.findDrawableById("misc") as Text;
//
var time = System.getClockTime();
var hour = time.hour;
if (! System.getDeviceSettings().is24Hour)
{
hour = (hour + 23) % 12 + 1;
}
var timeStr = Lang.format("$1$:$2$", [ hour, time.min.format("%02d") ]);
timeField.setText(timeStr);
//
var sysStats = System.getSystemStats();
var miscStr = "";
if (sysStats.charging)
{
miscStr += ";";
}
else
{
var hr = Activity.getActivityInfo().currentHeartRate;
miscStr += hr ? hr : "-";
}
miscField.setText(miscStr);
dc.setAntiAlias(true);
View.onUpdate(dc);
}
function onHide() as Void { }
function onExitSleep() as Void {
self.dimmed = false;
self.requestUpdate();
}
function onEnterSleep() as Void {
self.dimmed = true;
self.requestUpdate();
}
}
Nothing complicated. layout.xml has a single <layout> with two <label>s.
Built it for Vivoactive 5, put it on the watch, confirmed it worked as expected, then went to bed. Woke up today and the face is replaced by the one I had on before.
Any ideas what happened and why ?
Thanks !