From 2a5f8be527b111dee12ca602b300df5bbce8403b Mon Sep 17 00:00:00 2001 From: cod Date: Wed, 10 Jun 2020 21:16:07 +0200 Subject: [PATCH] Data format (Issue #3); Managing status of activity (Issue #2); --- resources/strings/strings.xml | 2 +- source/lapElevationView.mc | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/resources/strings/strings.xml b/resources/strings/strings.xml index 819dae4..252fdb6 100644 --- a/resources/strings/strings.xml +++ b/resources/strings/strings.xml @@ -1,3 +1,3 @@ - lapElevation + Lap Elevation diff --git a/source/lapElevationView.mc b/source/lapElevationView.mc index f18c8d6..eac5704 100644 --- a/source/lapElevationView.mc +++ b/source/lapElevationView.mc @@ -9,6 +9,7 @@ class lapElevationView extends WatchUi.SimpleDataField { // Set the label of the data field here. function initialize() { SimpleDataField.initialize(); + //label = "Lap Elevation"; //Rez.Strings.FieldName; label = "Lap Elevation"; elevation = 0; prev_altitude = 0; @@ -29,7 +30,13 @@ class lapElevationView extends WatchUi.SimpleDataField { } } - return elevation; + if (elevation < 10.0 && elevation > -10.0) { + return elevation.format("%.2f"); + } else if (elevation >= 100 && elevation > -100) { + return elevation.toNumber(); + } + + return elevation.format("%.1f"); } // Get the field layout