Skip to content

Commit

Permalink
Data format (Issue #3);
Browse files Browse the repository at this point in the history
Managing status of activity (Issue #2);
  • Loading branch information
cod committed Jun 10, 2020
1 parent e2afa45 commit 2a5f8be
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion resources/strings/strings.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<strings>
<string id="AppName">lapElevation</string>
<string id="AppName">Lap Elevation</string>
</strings>
9 changes: 8 additions & 1 deletion source/lapElevationView.mc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down

0 comments on commit 2a5f8be

Please sign in to comment.