2022-07-06 12:03:35 +00:00
|
|
|
function display(text1, text2) {
|
2022-06-16 15:41:01 +00:00
|
|
|
g.reset();
|
|
|
|
g.clear();
|
2022-06-17 10:50:00 +00:00
|
|
|
var img = require("Storage").read("agpsdata.img");
|
|
|
|
if (img) {
|
2022-07-07 12:20:37 +00:00
|
|
|
g.drawImage(img, g.getWidth() - 48, g.getHeight() - 48 - 24);
|
2022-06-17 10:50:00 +00:00
|
|
|
}
|
2022-07-06 12:03:35 +00:00
|
|
|
g.setFont("Vector", 20);
|
2022-06-16 15:41:01 +00:00
|
|
|
g.setFontAlign(0, 1);
|
2022-06-17 10:50:00 +00:00
|
|
|
g.drawString(text1, g.getWidth() / 2, g.getHeight() / 3 + 24);
|
2022-07-06 12:03:35 +00:00
|
|
|
if (text2 != undefined) {
|
|
|
|
g.setFont("Vector", 15);
|
|
|
|
g.setFontAlign(-1, -1);
|
|
|
|
g.drawString(text2, 5, g.getHeight() / 3 + 29);
|
2022-06-16 15:41:01 +00:00
|
|
|
}
|
2022-07-06 12:03:35 +00:00
|
|
|
Bangle.drawWidgets();
|
2022-06-16 15:41:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Show launcher when middle button pressed
|
|
|
|
// Load widgets
|
|
|
|
Bangle.loadWidgets();
|
|
|
|
Bangle.drawWidgets();
|
|
|
|
|
2022-07-07 12:20:37 +00:00
|
|
|
function start() {
|
|
|
|
display("Updating data...");
|
|
|
|
require("agpsdata")
|
|
|
|
.pull(function() { display("Success", "AGPS data updated."); },
|
|
|
|
function(error) {
|
|
|
|
display("Error:" + error, "touch to retry");
|
|
|
|
Bangle.on("touch", () => {
|
|
|
|
start();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
start();
|