garminBatteryIndicatorOnUpdate.mc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Update the view | |
function onUpdate(dc as Dc) as Void { | |
//Get and show the current battery percentage | |
var pwr = System.getSystemStats().battery; | |
var batStr = Lang.format( "$1$%", [ pwr.format( "%2d" ) ] ); | |
updateDisplayObject("BatteryLabel", batStr); | |
//Update battery text color | |
updateBatteryTextColor(pwr); | |
// Call the parent onUpdate function to redraw the layout | |
View.onUpdate(dc); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment