mirror of
https://github.com/dyuri/garmin-repafield.git
synced 2025-12-16 19:24:01 +00:00
refactor
This commit is contained in:
parent
10f31ffb96
commit
2eaae26106
BIN
repafield1.png
BIN
repafield1.png
Binary file not shown.
|
Before Width: | Height: | Size: 293 KiB After Width: | Height: | Size: 292 KiB |
@ -23,10 +23,6 @@
|
|||||||
<!-- time/timer -->
|
<!-- time/timer -->
|
||||||
<label id="timerHM" x="132" y="258" color="Graphics.COLOR_WHITE" justification="Graphics.TEXT_JUSTIFY_RIGHT" font="Graphics.FONT_MEDIUM" />
|
<label id="timerHM" x="132" y="258" color="Graphics.COLOR_WHITE" justification="Graphics.TEXT_JUSTIFY_RIGHT" font="Graphics.FONT_MEDIUM" />
|
||||||
<label id="timerS" x="134" y="278" color="Graphics.COLOR_LT_GRAY" justification="Graphics.TEXT_JUSTIFY_LEFT" font="Graphics.FONT_XTINY" />
|
<label id="timerS" x="134" y="278" color="Graphics.COLOR_LT_GRAY" justification="Graphics.TEXT_JUSTIFY_LEFT" font="Graphics.FONT_XTINY" />
|
||||||
<label id="timeS1" x="212" y="330" color="0x0088FF" justification="Graphics.TEXT_JUSTIFY_CENTER" font="Graphics.FONT_LARGE" />
|
|
||||||
<label id="timeS2" x="214" y="330" color="0x0088FF" justification="Graphics.TEXT_JUSTIFY_CENTER" font="Graphics.FONT_LARGE" />
|
|
||||||
<label id="timeS3" x="213" y="328" color="0x0088FF" justification="Graphics.TEXT_JUSTIFY_CENTER" font="Graphics.FONT_LARGE" />
|
|
||||||
<label id="timeS4" x="213" y="332" color="0x0088FF" justification="Graphics.TEXT_JUSTIFY_CENTER" font="Graphics.FONT_LARGE" />
|
|
||||||
<label id="time" x="213" y="330" color="0x000000" justification="Graphics.TEXT_JUSTIFY_CENTER" font="Graphics.FONT_LARGE" />
|
<label id="time" x="213" y="330" color="0x000000" justification="Graphics.TEXT_JUSTIFY_CENTER" font="Graphics.FONT_LARGE" />
|
||||||
|
|
||||||
<!-- distance/pace/avg pace -->
|
<!-- distance/pace/avg pace -->
|
||||||
@ -54,12 +50,24 @@
|
|||||||
<!-- Layouts used for the for the four quadrants. -->
|
<!-- Layouts used for the for the four quadrants. -->
|
||||||
<layout id="TopLayout">
|
<layout id="TopLayout">
|
||||||
<drawable class="Background" />
|
<drawable class="Background" />
|
||||||
<label id="label" x="14" y="75" color="0x888888" justification="Graphics.TEXT_JUSTIFY_LEFT" font="Graphics.FONT_TINY" />
|
<drawable class="HeartRate" id="HeartRate">
|
||||||
<label id="value" x="14" y="42" color="Graphics.COLOR_WHITE" justification="Graphics.TEXT_JUSTIFY_LEFT" font="Graphics.FONT_LARGE" />
|
<param name="y">64</param>
|
||||||
|
</drawable>
|
||||||
|
|
||||||
|
<!-- hr labels -->
|
||||||
|
<label id="hr" x="center" y="6" color="Graphics.COLOR_WHITE" justification="Graphics.TEXT_JUSTIFY_CENTER" font="Graphics.FONT_MEDIUM" />
|
||||||
|
<label id="ahr" x="32%" y="18" color="0x888888" justification="Graphics.TEXT_JUSTIFY_CENTER" font="Graphics.FONT_TINY" />
|
||||||
|
<label id="mhr" x="68%" y="18" color="0x888888" justification="Graphics.TEXT_JUSTIFY_CENTER" font="Graphics.FONT_TINY" />
|
||||||
</layout>
|
</layout>
|
||||||
<layout id="BottomLayout">
|
<layout id="BottomLayout">
|
||||||
<drawable class="Background" />
|
<drawable class="Background" />
|
||||||
<label id="label" x="95" y="10" color="0x888888" justification="Graphics.TEXT_JUSTIFY_RIGHT" font="Graphics.FONT_TINY" />
|
<drawable class="HeartRate" id="HeartRate">
|
||||||
<label id="value" x="95" y="27" color="Graphics.COLOR_WHITE" justification="Graphics.TEXT_JUSTIFY_RIGHT" font="Graphics.FONT_LARGE" />
|
<param name="y">64</param>
|
||||||
|
</drawable>
|
||||||
|
|
||||||
|
<!-- hr labels -->
|
||||||
|
<label id="hr" x="center" y="72" color="Graphics.COLOR_WHITE" justification="Graphics.TEXT_JUSTIFY_CENTER" font="Graphics.FONT_MEDIUM" />
|
||||||
|
<label id="ahr" x="32%" y="72" color="0x888888" justification="Graphics.TEXT_JUSTIFY_CENTER" font="Graphics.FONT_TINY" />
|
||||||
|
<label id="mhr" x="68%" y="72" color="0x888888" justification="Graphics.TEXT_JUSTIFY_CENTER" font="Graphics.FONT_TINY" />
|
||||||
</layout>
|
</layout>
|
||||||
</layouts>
|
</layouts>
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
<properties>
|
<properties>
|
||||||
<property id="appVersion" type="string">0.8.0</property>
|
<property id="appVersion" type="string">0.8.0</property>
|
||||||
<property id="themeColor" type="string">0088FF</property>
|
<property id="themeColor" type="string">0088FF</property>
|
||||||
|
<property id="themeColor2" type="string">0088FF</property>
|
||||||
|
<property id="themeColor3" type="string">FFFF00</property>
|
||||||
</properties>
|
</properties>
|
||||||
@ -6,5 +6,11 @@
|
|||||||
<setting propertyKey="@Properties.themeColor" title="@Strings.ThemeColorTitle">
|
<setting propertyKey="@Properties.themeColor" title="@Strings.ThemeColorTitle">
|
||||||
<settingConfig type="alphaNumeric" />
|
<settingConfig type="alphaNumeric" />
|
||||||
</setting>
|
</setting>
|
||||||
|
<setting propertyKey="@Properties.themeColor2" title="@Strings.ThemeColor2Title">
|
||||||
|
<settingConfig type="alphaNumeric" />
|
||||||
|
</setting>
|
||||||
|
<setting propertyKey="@Properties.themeColor3" title="@Strings.ThemeColor3Title">
|
||||||
|
<settingConfig type="alphaNumeric" />
|
||||||
|
</setting>
|
||||||
|
|
||||||
</settings>
|
</settings>
|
||||||
@ -1,7 +1,7 @@
|
|||||||
<strings>
|
<strings>
|
||||||
<string id="AppName">RepaField</string>
|
<string id="AppName">RepaField</string>
|
||||||
<string id="AppVersionTitle">Version</string>
|
<string id="AppVersionTitle">Version</string>
|
||||||
<string id="ThemeColorTitle">Theme Color</string>
|
<string id="ThemeColorTitle">Primary Theme Color</string>
|
||||||
|
<string id="ThemeColor2Title">Secondary Theme Color</string>
|
||||||
<string id="label">My Value</string>
|
<string id="ThemeColor3Title">Clock Color</string>
|
||||||
</strings>
|
</strings>
|
||||||
|
|||||||
@ -8,15 +8,37 @@ import Toybox.Application;
|
|||||||
|
|
||||||
class RepaFieldView extends WatchUi.DataField {
|
class RepaFieldView extends WatchUi.DataField {
|
||||||
|
|
||||||
|
// settings
|
||||||
hidden var themeColor as Numeric;
|
hidden var themeColor as Numeric;
|
||||||
|
hidden var themeColor2 as Numeric;
|
||||||
hidden var hrValue as Numeric;
|
hidden var themeColor3 as Numeric;
|
||||||
hidden var ahrValue as Numeric;
|
|
||||||
hidden var mhrValue as Numeric;
|
|
||||||
hidden var hrZones as Array<Numeric>;
|
hidden var hrZones as Array<Numeric>;
|
||||||
hidden var hrZoneColors as Array<Numeric>;
|
hidden var hrZoneColors as Array<Numeric>;
|
||||||
hidden var cadenceZones as Array<Numeric>;
|
hidden var cadenceZones as Array<Numeric>;
|
||||||
hidden var cadenceZoneColors as Array<Numeric>;
|
hidden var cadenceZoneColors as Array<Numeric>;
|
||||||
|
|
||||||
|
// fields
|
||||||
|
hidden var fBgOverlay;
|
||||||
|
hidden var fTrack;
|
||||||
|
hidden var fPace;
|
||||||
|
hidden var fAPace;
|
||||||
|
hidden var fElevation;
|
||||||
|
hidden var fElevationGain;
|
||||||
|
hidden var fElevationLoss;
|
||||||
|
hidden var fCadence;
|
||||||
|
hidden var fDistance;
|
||||||
|
hidden var fTime;
|
||||||
|
hidden var fTimer;
|
||||||
|
hidden var fTimerSec;
|
||||||
|
hidden var fHr;
|
||||||
|
hidden var fAHr;
|
||||||
|
hidden var fMHr;
|
||||||
|
hidden var fHrGraph;
|
||||||
|
|
||||||
|
// values
|
||||||
|
hidden var hrValue as Numeric;
|
||||||
|
hidden var ahrValue as Numeric;
|
||||||
|
hidden var mhrValue as Numeric;
|
||||||
hidden var toDestination as Float;
|
hidden var toDestination as Float;
|
||||||
hidden var distance as Float;
|
hidden var distance as Float;
|
||||||
hidden var timer as Numeric;
|
hidden var timer as Numeric;
|
||||||
@ -33,6 +55,8 @@ class RepaFieldView extends WatchUi.DataField {
|
|||||||
DataField.initialize();
|
DataField.initialize();
|
||||||
|
|
||||||
themeColor = Application.Properties.getValue("themeColor").toNumberWithBase(16);
|
themeColor = Application.Properties.getValue("themeColor").toNumberWithBase(16);
|
||||||
|
themeColor2 = Application.Properties.getValue("themeColor2").toNumberWithBase(16);
|
||||||
|
themeColor3 = Application.Properties.getValue("themeColor3").toNumberWithBase(16);
|
||||||
|
|
||||||
hrValue = 0;
|
hrValue = 0;
|
||||||
ahrValue = 0;
|
ahrValue = 0;
|
||||||
@ -78,39 +102,46 @@ class RepaFieldView extends WatchUi.DataField {
|
|||||||
function onLayout(dc as Dc) as Void {
|
function onLayout(dc as Dc) as Void {
|
||||||
var obscurityFlags = DataField.getObscurityFlags();
|
var obscurityFlags = DataField.getObscurityFlags();
|
||||||
|
|
||||||
// TODO ?
|
|
||||||
// Top layout
|
// Top layout
|
||||||
if (obscurityFlags == (OBSCURE_TOP | OBSCURE_LEFT | OBSCURE_RIGHT)) {
|
if (obscurityFlags == (OBSCURE_TOP | OBSCURE_LEFT | OBSCURE_RIGHT)) {
|
||||||
View.setLayout(Rez.Layouts.TopLayout(dc));
|
View.setLayout(Rez.Layouts.TopLayout(dc));
|
||||||
|
return;
|
||||||
|
|
||||||
// Bottom layout
|
// Bottom layout
|
||||||
} else if (obscurityFlags == (OBSCURE_BOTTOM | OBSCURE_LEFT | OBSCURE_RIGHT)) {
|
} else if (obscurityFlags == (OBSCURE_BOTTOM | OBSCURE_LEFT | OBSCURE_RIGHT)) {
|
||||||
View.setLayout(Rez.Layouts.BottomLayout(dc));
|
View.setLayout(Rez.Layouts.BottomLayout(dc));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Use the generic, centered layout
|
// Use the generic, centered layout
|
||||||
} else {
|
View.setLayout(Rez.Layouts.MainLayout(dc));
|
||||||
View.setLayout(Rez.Layouts.MainLayout(dc));
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO remove
|
// fields
|
||||||
var label = View.findDrawableById("label") as Text;
|
fBgOverlay = View.findDrawableById("BgOverlay") as BgOverlay;
|
||||||
if (label != null) {
|
fTrack = View.findDrawableById("Track") as Track;
|
||||||
label.setText(Rez.Strings.label);
|
fPace = View.findDrawableById("pace") as Text;
|
||||||
}
|
fAPace = View.findDrawableById("apace") as Text;
|
||||||
|
fElevation = View.findDrawableById("elevation") as Text;
|
||||||
|
fElevationGain = View.findDrawableById("elevationGain") as Text;
|
||||||
|
fElevationLoss = View.findDrawableById("elevationLoss") as Text;
|
||||||
|
fTime = View.findDrawableById("time") as Text;
|
||||||
|
fTimer = View.findDrawableById("timerHM") as Text;
|
||||||
|
fTimerSec = View.findDrawableById("timerS") as Text;
|
||||||
|
fCadence = View.findDrawableById("cadence") as Text;
|
||||||
|
fDistance = View.findDrawableById("distance") as Text;
|
||||||
|
fHr = View.findDrawableById("hr") as Text;
|
||||||
|
fAHr = View.findDrawableById("ahr") as Text;
|
||||||
|
fMHr = View.findDrawableById("mhr") as Text;
|
||||||
|
fHrGraph = View.findDrawableById("HeartRate") as HeartRate;
|
||||||
|
|
||||||
// theme color
|
// theme setup
|
||||||
var bgo = View.findDrawableById("BgOverlay") as BgOverlay;
|
fBgOverlay.setColor1(darken(themeColor, 4));
|
||||||
bgo.setColor1(darken(themeColor, 4));
|
fBgOverlay.setColor2(darken(themeColor, 2));
|
||||||
bgo.setColor2(darken(themeColor, 2));
|
fAPace.setColor(themeColor);
|
||||||
|
fElevation.setColor(themeColor2);
|
||||||
var elevationField = View.findDrawableById("elevation") as Text;
|
fElevationGain.setColor(themeColor2);
|
||||||
elevationField.setColor(themeColor);
|
fElevationLoss.setColor(themeColor2);
|
||||||
var elevationGainField = View.findDrawableById("elevationGain") as Text;
|
fTime.setColor(themeColor3);
|
||||||
elevationGainField.setColor(themeColor);
|
|
||||||
var elevationLossField = View.findDrawableById("elevationLoss") as Text;
|
|
||||||
elevationLossField.setColor(themeColor);
|
|
||||||
var aPaceField = View.findDrawableById("apace") as Text;
|
|
||||||
aPaceField.setColor(themeColor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function compute(info as Activity.Info) as Void {
|
function compute(info as Activity.Info) as Void {
|
||||||
@ -189,60 +220,36 @@ class RepaFieldView extends WatchUi.DataField {
|
|||||||
// Display the value you computed here. This will be called
|
// Display the value you computed here. This will be called
|
||||||
// once a second when the data field is visible.
|
// once a second when the data field is visible.
|
||||||
function onUpdate(dc as Dc) as Void {
|
function onUpdate(dc as Dc) as Void {
|
||||||
// Set the background color - don't ;)
|
|
||||||
// (View.findDrawableById("Background") as Background).setColor(getBackgroundColor());
|
|
||||||
|
|
||||||
// HR value
|
// HR value
|
||||||
var hrColor = calculateZoneColor(hrValue, hrZones, hrZoneColors);
|
var hrColor = calculateZoneColor(hrValue, hrZones, hrZoneColors);
|
||||||
var hr = View.findDrawableById("hr") as Text;
|
fHr.setColor(hrColor);
|
||||||
hr.setColor(hrColor);
|
fHr.setText(hrValue.format("%d"));
|
||||||
hr.setText(hrValue.format("%d"));
|
fAHr.setColor(darken(calculateZoneColor(ahrValue, hrZones, hrZoneColors), 2));
|
||||||
var ahr = View.findDrawableById("ahr") as Text;
|
fAHr.setText(ahrValue.format("%d"));
|
||||||
ahr.setColor(darken(calculateZoneColor(ahrValue, hrZones, hrZoneColors), 2));
|
fMHr.setColor(darken(calculateZoneColor(mhrValue, hrZones, hrZoneColors), 2));
|
||||||
ahr.setText(ahrValue.format("%d"));
|
fMHr.setText(mhrValue.format("%d"));
|
||||||
var mhr = View.findDrawableById("mhr") as Text;
|
if (fHrGraph != null) {
|
||||||
mhr.setColor(darken(calculateZoneColor(mhrValue, hrZones, hrZoneColors), 2));
|
fHrGraph.setHRColor(hrColor);
|
||||||
mhr.setText(mhrValue.format("%d"));
|
fHrGraph.setHRZones(hrZones);
|
||||||
var hrGraph = View.findDrawableById("HeartRate") as HeartRate;
|
fHrGraph.setHRValue(hrValue);
|
||||||
if (hrGraph != null) {
|
|
||||||
hrGraph.setHRColor(hrColor);
|
|
||||||
hrGraph.setHRZones(hrZones);
|
|
||||||
hrGraph.setHRValue(hrValue);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// track
|
// track
|
||||||
var track = View.findDrawableById("Track") as Track;
|
if (fTrack != null) {
|
||||||
if (track != null) {
|
fTrack.setToDestination(toDestination);
|
||||||
track.setToDestination(toDestination);
|
fTrack.setDistance(distance);
|
||||||
track.setDistance(distance);
|
fTrack.setOffCourse(offCourse);
|
||||||
track.setOffCourse(offCourse);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// time
|
// time
|
||||||
var time = System.getClockTime();
|
if (fTime != null) {
|
||||||
var tstr = time.hour.format("%02d") + ":" + time.min.format("%02d");
|
var time = System.getClockTime();
|
||||||
var timeField = View.findDrawableById("time") as Text;
|
var tstr = time.hour.format("%02d") + ":" + time.min.format("%02d");
|
||||||
if (timeField != null) {
|
fTime.setText(tstr);
|
||||||
timeField.setText(tstr);
|
|
||||||
}
|
}
|
||||||
// TODO ?
|
|
||||||
var ts1 = View.findDrawableById("timeS1") as Text;
|
|
||||||
var ts2 = View.findDrawableById("timeS2") as Text;
|
|
||||||
var ts3 = View.findDrawableById("timeS3") as Text;
|
|
||||||
var ts4 = View.findDrawableById("timeS4") as Text;
|
|
||||||
ts1.setColor(themeColor);
|
|
||||||
ts1.setText(tstr);
|
|
||||||
ts2.setColor(themeColor);
|
|
||||||
ts2.setText(tstr);
|
|
||||||
ts3.setColor(themeColor);
|
|
||||||
ts3.setText(tstr);
|
|
||||||
ts4.setColor(themeColor);
|
|
||||||
ts4.setText(tstr);
|
|
||||||
|
|
||||||
// timer
|
// timer
|
||||||
var timerField = View.findDrawableById("timerHM") as Text;
|
if (fTimer != null) {
|
||||||
var timerSecField = View.findDrawableById("timerS") as Text;
|
|
||||||
if (timerField != null) {
|
|
||||||
var trh = timer / 3600;
|
var trh = timer / 3600;
|
||||||
var trm = (timer % 3600) / 60;
|
var trm = (timer % 3600) / 60;
|
||||||
var trs = timer % 60;
|
var trs = timer % 60;
|
||||||
@ -252,90 +259,72 @@ class RepaFieldView extends WatchUi.DataField {
|
|||||||
} else if (timerState == Activity.TIMER_STATE_PAUSED) {
|
} else if (timerState == Activity.TIMER_STATE_PAUSED) {
|
||||||
timerColor = Graphics.COLOR_YELLOW;
|
timerColor = Graphics.COLOR_YELLOW;
|
||||||
}
|
}
|
||||||
timerField.setColor(timerColor);
|
fTimer.setColor(timerColor);
|
||||||
if (trh > 0) {
|
if (trh > 0) {
|
||||||
timerField.setText(trh.format("%d") + ":" + trm.format("%02d"));
|
fTimer.setText(trh.format("%d") + ":" + trm.format("%02d"));
|
||||||
} else {
|
} else {
|
||||||
timerField.setText(trm.format("%02d"));
|
fTimer.setText(trm.format("%02d"));
|
||||||
}
|
}
|
||||||
if (timerSecField != null) {
|
if (fTimerSec != null) {
|
||||||
timerSecField.setColor(darken(timerColor, 1.5));
|
fTimerSec.setColor(darken(timerColor, 1.5));
|
||||||
timerSecField.setText(trs.format("%02d"));
|
fTimerSec.setText(trs.format("%02d"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// distance
|
// distance
|
||||||
var dstField = View.findDrawableById("distance") as Text;
|
if (fDistance != null) {
|
||||||
if (dstField != null) {
|
|
||||||
if (distance >= 10000) {
|
if (distance >= 10000) {
|
||||||
dstField.setText((distance / 1000).format("%.1f"));
|
fDistance.setText((distance / 1000).format("%.1f"));
|
||||||
} else {
|
} else {
|
||||||
dstField.setText((distance / 1000).format("%.2f"));
|
fDistance.setText((distance / 1000).format("%.2f"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// pace
|
// pace
|
||||||
var paceField = View.findDrawableById("pace") as Text;
|
if (fPace != null) {
|
||||||
if (paceField != null) {
|
|
||||||
if (speed != 0) {
|
if (speed != 0) {
|
||||||
var pace = 1000 / 60 / speed; // mps -> min/km
|
var pace = 1000 / 60 / speed; // mps -> min/km
|
||||||
var pmin = pace.toNumber();
|
var pmin = pace.toNumber();
|
||||||
var psec = (pace - pmin) * 60;
|
var psec = (pace - pmin) * 60;
|
||||||
paceField.setText(pmin.format("%2d") + ":" + psec.format("%02d"));
|
fPace.setText(pmin.format("%2d") + ":" + psec.format("%02d"));
|
||||||
} else {
|
} else {
|
||||||
paceField.setText("--:--");
|
fPace.setText("--:--");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var apaceField = View.findDrawableById("apace") as Text;
|
if (fAPace != null) {
|
||||||
if (apaceField != null) {
|
|
||||||
if (aspeed != 0) {
|
if (aspeed != 0) {
|
||||||
var apace = 1000 / 60 / aspeed; // mps -> min/km
|
var apace = 1000 / 60 / aspeed; // mps -> min/km
|
||||||
var apmin = apace.toNumber();
|
var apmin = apace.toNumber();
|
||||||
var apsec = (apace - apmin) * 60;
|
var apsec = (apace - apmin) * 60;
|
||||||
apaceField.setText(apmin.format("%2d") + ":" + apsec.format("%02d"));
|
fAPace.setText(apmin.format("%2d") + ":" + apsec.format("%02d"));
|
||||||
} else {
|
} else {
|
||||||
apaceField.setText("--:--");
|
fAPace.setText("--:--");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// alt/egain/edrop
|
// alt/egain/edrop
|
||||||
var altField = View.findDrawableById("elevation") as Text;
|
if (fElevation != null) {
|
||||||
if (altField != null) {
|
|
||||||
// draw icon
|
// draw icon
|
||||||
altField.setText(altitude.format("%.0f"));
|
fElevation.setText(altitude.format("%.0f"));
|
||||||
}
|
}
|
||||||
var eGainField = View.findDrawableById("elevationGain") as Text;
|
if (fElevationGain != null) {
|
||||||
if (eGainField != null) {
|
fElevationGain.setText(egain.format("%d"));
|
||||||
eGainField.setText(egain.format("%d"));
|
|
||||||
}
|
}
|
||||||
var eDropField = View.findDrawableById("elevationLoss") as Text;
|
if (fElevationLoss != null) {
|
||||||
if (eDropField != null) {
|
fElevationLoss.setText(edrop.format("%d"));
|
||||||
eDropField.setText(edrop.format("%d"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// cadence
|
// cadence
|
||||||
var cadenceColor = darken(calculateZoneColor(cadence, cadenceZones, cadenceZoneColors), 1.5);
|
if (fCadence != null) {
|
||||||
var cadenceField = View.findDrawableById("cadence") as Text;
|
var cadenceColor = darken(calculateZoneColor(cadence, cadenceZones, cadenceZoneColors), 1.5);
|
||||||
cadenceField.setColor(cadenceColor);
|
fCadence.setColor(cadenceColor);
|
||||||
if (cadenceField != null) {
|
|
||||||
if (cadence != 0) {
|
if (cadence != 0) {
|
||||||
cadenceField.setText(cadence.format("%d"));
|
fCadence.setText(cadence.format("%d"));
|
||||||
} else {
|
} else {
|
||||||
cadenceField.setText("-");
|
fCadence.setText("-");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the foreground color and value
|
|
||||||
var value = View.findDrawableById("value") as Text;
|
|
||||||
if (value != null) {
|
|
||||||
if (getBackgroundColor() == Graphics.COLOR_BLACK) {
|
|
||||||
value.setColor(Graphics.COLOR_WHITE);
|
|
||||||
} else {
|
|
||||||
value.setColor(Graphics.COLOR_BLACK);
|
|
||||||
}
|
|
||||||
value.setText(hrValue.format("%d"));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Call parent's onUpdate(dc) to redraw the layout
|
// Call parent's onUpdate(dc) to redraw the layout
|
||||||
View.onUpdate(dc);
|
View.onUpdate(dc);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user