Added separate tint colours for sleep times
This commit is contained in:
parent
91f0d0eb31
commit
5ea87e0d32
@ -1,7 +1,9 @@
|
|||||||
{
|
{
|
||||||
"ArmHourTintHi": 9708837,
|
"ArmHourTintHi": 9708837,
|
||||||
"ArmHourTintLo": 14429228,
|
"ArmHourTintLo": 14429228,
|
||||||
|
"ArmHourTintSleep": 14429228,
|
||||||
"ArmMinuteTintHi": 9708837,
|
"ArmMinuteTintHi": 9708837,
|
||||||
"ArmMinuteTintLo": 14429228,
|
"ArmMinuteTintLo": 14429228,
|
||||||
|
"ArmMinuteTintSleep": 14429228,
|
||||||
"MinuteOrnamentOffset": 0
|
"MinuteOrnamentOffset": 0
|
||||||
}
|
}
|
@ -1,7 +1,9 @@
|
|||||||
{
|
{
|
||||||
"ArmHourTintHi": 9708837,
|
"ArmHourTintHi": 9708837,
|
||||||
"ArmHourTintLo": 3583350,
|
"ArmHourTintLo": 3583350,
|
||||||
|
"ArmHourTintSleep": 1194278,
|
||||||
"ArmMinuteTintHi": 9708837,
|
"ArmMinuteTintHi": 9708837,
|
||||||
"ArmMinuteTintLo": 6804128,
|
"ArmMinuteTintLo": 6804128,
|
||||||
|
"ArmMinuteTintSleep": 2311732,
|
||||||
"MinuteOrnamentOffset": 130
|
"MinuteOrnamentOffset": 130
|
||||||
}
|
}
|
@ -28,7 +28,7 @@ class KittieCatsView extends WatchUi.WatchFace
|
|||||||
private var sleepTime;
|
private var sleepTime;
|
||||||
private var wakeTime;
|
private var wakeTime;
|
||||||
|
|
||||||
private var sleeping = false;
|
private var highPowerMode = true;
|
||||||
|
|
||||||
|
|
||||||
function initialize()
|
function initialize()
|
||||||
@ -87,7 +87,9 @@ class KittieCatsView extends WatchUi.WatchFace
|
|||||||
|
|
||||||
function onUpdate(dc as Dc) as Void
|
function onUpdate(dc as Dc) as Void
|
||||||
{
|
{
|
||||||
var highPowerMode = self.isHighPowerMode();
|
var isSleepMode = self.isSleepMode();
|
||||||
|
var highPowerMode = !isSleepMode && self.highPowerMode;
|
||||||
|
|
||||||
|
|
||||||
var clockTime = System.getClockTime();
|
var clockTime = System.getClockTime();
|
||||||
var complications = ComplicationSubscriber.getSnapshot();
|
var complications = ComplicationSubscriber.getSnapshot();
|
||||||
@ -110,10 +112,13 @@ class KittieCatsView extends WatchUi.WatchFace
|
|||||||
|
|
||||||
|
|
||||||
// --- Arms ---
|
// --- Arms ---
|
||||||
|
var hourTint = highPowerMode ? self.theme.ArmHourTintHi : isSleepMode ? self.theme.ArmHourTintSleep : self.theme.ArmHourTintLo;
|
||||||
|
var minuteTint = highPowerMode ? self.theme.ArmMinuteTintHi : isSleepMode ? self.theme.ArmMinuteTintSleep : self.theme.ArmMinuteTintLo;
|
||||||
|
|
||||||
// Base the hour arm on minutes as well, to prevent the arm from staying on the
|
// Base the hour arm on minutes as well, to prevent the arm from staying on the
|
||||||
// current hour tick mark right up until the 59th minute
|
// current hour tick mark right up until the 59th minute
|
||||||
self.drawArm(dc, self.armHour, 0, (clockTime.hour * 60) + clockTime.min, 720, highPowerMode ? self.theme.ArmHourTintHi : self.theme.ArmHourTintLo);
|
self.drawArm(dc, self.armHour, 0, (clockTime.hour * 60) + clockTime.min, 720, hourTint);
|
||||||
self.drawArm(dc, self.armMinute, 0, clockTime.min, 60, highPowerMode ? self.theme.ArmMinuteTintHi : self.theme.ArmMinuteTintLo);
|
self.drawArm(dc, self.armMinute, 0, clockTime.min, 60, minuteTint);
|
||||||
|
|
||||||
if (highPowerMode)
|
if (highPowerMode)
|
||||||
{
|
{
|
||||||
@ -148,23 +153,18 @@ class KittieCatsView extends WatchUi.WatchFace
|
|||||||
|
|
||||||
function onExitSleep() as Void
|
function onExitSleep() as Void
|
||||||
{
|
{
|
||||||
self.sleeping = false;
|
self.highPowerMode = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function onEnterSleep() as Void
|
function onEnterSleep() as Void
|
||||||
{
|
{
|
||||||
self.sleeping = true;
|
self.highPowerMode = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private function isHighPowerMode() as Boolean
|
private function isSleepMode() as Boolean
|
||||||
{
|
{
|
||||||
if (self.sleeping)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Since isSleepMode is deprecated, base it on the wake and sleep times. Unfortunately this means
|
// Since isSleepMode is deprecated, base it on the wake and sleep times. Unfortunately this means
|
||||||
// the display will never be in high power mode between those times even if desired.
|
// the display will never be in high power mode between those times even if desired.
|
||||||
// Can't figure out how to check for the locked state either.
|
// Can't figure out how to check for the locked state either.
|
||||||
@ -174,10 +174,10 @@ class KittieCatsView extends WatchUi.WatchFace
|
|||||||
|
|
||||||
if (now.greaterThan(today.add(self.sleepTime)) || now.lessThan(today.add(self.wakeTime)))
|
if (now.greaterThan(today.add(self.sleepTime)) || now.lessThan(today.add(self.wakeTime)))
|
||||||
{
|
{
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,8 +15,10 @@ class Theme
|
|||||||
|
|
||||||
public var ArmHourTintHi;
|
public var ArmHourTintHi;
|
||||||
public var ArmHourTintLo;
|
public var ArmHourTintLo;
|
||||||
|
public var ArmHourTintSleep;
|
||||||
public var ArmMinuteTintHi;
|
public var ArmMinuteTintHi;
|
||||||
public var ArmMinuteTintLo;
|
public var ArmMinuteTintLo;
|
||||||
|
public var ArmMinuteTintSleep;
|
||||||
|
|
||||||
|
|
||||||
function initialize(backgroundHi, backgroundLo, armHour, armMinute, armSecond, minuteOrnamentLo, variablesJsonResource)
|
function initialize(backgroundHi, backgroundLo, armHour, armMinute, armSecond, minuteOrnamentLo, variablesJsonResource)
|
||||||
@ -33,8 +35,10 @@ class Theme
|
|||||||
var variables = Application.loadResource(variablesJsonResource) as Dictionary<String, Object>;
|
var variables = Application.loadResource(variablesJsonResource) as Dictionary<String, Object>;
|
||||||
self.ArmHourTintHi = variables["ArmHourTintHi"];
|
self.ArmHourTintHi = variables["ArmHourTintHi"];
|
||||||
self.ArmHourTintLo = variables["ArmHourTintLo"];
|
self.ArmHourTintLo = variables["ArmHourTintLo"];
|
||||||
|
self.ArmHourTintSleep = variables["ArmHourTintSleep"];
|
||||||
self.ArmMinuteTintHi = variables["ArmMinuteTintHi"];
|
self.ArmMinuteTintHi = variables["ArmMinuteTintHi"];
|
||||||
self.ArmMinuteTintLo = variables["ArmMinuteTintLo"];
|
self.ArmMinuteTintLo = variables["ArmMinuteTintLo"];
|
||||||
|
self.ArmMinuteTintSleep = variables["ArmMinuteTintSleep"];
|
||||||
self.MinuteOrnamentOffset = variables["MinuteOrnamentOffset"];
|
self.MinuteOrnamentOffset = variables["MinuteOrnamentOffset"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user