mirror of https://github.com/espruino/BangleApps
update APIs
parent
1d3079528a
commit
36a1678931
18
apps.json
18
apps.json
|
@ -206,9 +206,9 @@
|
||||||
{ "id": "wclock",
|
{ "id": "wclock",
|
||||||
"name": "Word Clock",
|
"name": "Word Clock",
|
||||||
"icon": "clock-word.png",
|
"icon": "clock-word.png",
|
||||||
"version":"0.02",
|
"version":"0.03",
|
||||||
"description": "Display Time as Text",
|
"description": "Display Time as Text",
|
||||||
"tags": "clock",
|
"tags": "clock,b2",
|
||||||
"type":"clock",
|
"type":"clock",
|
||||||
"allow_emulator":true,
|
"allow_emulator":true,
|
||||||
"storage": [
|
"storage": [
|
||||||
|
@ -325,9 +325,9 @@
|
||||||
{ "id": "clock2x3",
|
{ "id": "clock2x3",
|
||||||
"name": "2x3 Pixel Clock",
|
"name": "2x3 Pixel Clock",
|
||||||
"icon": "clock2x3.png",
|
"icon": "clock2x3.png",
|
||||||
"version":"0.04",
|
"version":"0.05",
|
||||||
"description": "This is a simple clock using minimalist 2x3 pixel numerical digits",
|
"description": "This is a simple clock using minimalist 2x3 pixel numerical digits",
|
||||||
"tags": "clock",
|
"tags": "clock,b2",
|
||||||
"type": "clock",
|
"type": "clock",
|
||||||
"allow_emulator":true,
|
"allow_emulator":true,
|
||||||
"storage": [
|
"storage": [
|
||||||
|
@ -878,7 +878,7 @@
|
||||||
{ "id": "vibrclock",
|
{ "id": "vibrclock",
|
||||||
"name": "Vibrate Clock",
|
"name": "Vibrate Clock",
|
||||||
"icon": "app.png",
|
"icon": "app.png",
|
||||||
"version":"0.02",
|
"version":"0.03",
|
||||||
"description": "When BTN1 is pressed, vibrate out the time as a series of buzzes, one digit at a time. Hours, then Minutes. Zero is signified by one long buzz. Otherwise a simple digital clock.",
|
"description": "When BTN1 is pressed, vibrate out the time as a series of buzzes, one digit at a time. Hours, then Minutes. Zero is signified by one long buzz. Otherwise a simple digital clock.",
|
||||||
"tags": "clock",
|
"tags": "clock",
|
||||||
"type":"clock",
|
"type":"clock",
|
||||||
|
@ -1119,9 +1119,9 @@
|
||||||
{ "id": "boldclk",
|
{ "id": "boldclk",
|
||||||
"name": "Bold Clock",
|
"name": "Bold Clock",
|
||||||
"icon": "bold_clock.png",
|
"icon": "bold_clock.png",
|
||||||
"version":"0.03",
|
"version":"0.04",
|
||||||
"description": "Simple, readable and practical clock",
|
"description": "Simple, readable and practical clock",
|
||||||
"tags": "clock",
|
"tags": "clock,b2",
|
||||||
"type":"clock",
|
"type":"clock",
|
||||||
"allow_emulator":true,
|
"allow_emulator":true,
|
||||||
"storage": [
|
"storage": [
|
||||||
|
@ -1132,7 +1132,7 @@
|
||||||
{ "id": "widclk",
|
{ "id": "widclk",
|
||||||
"name": "Digital clock widget",
|
"name": "Digital clock widget",
|
||||||
"icon": "widget.png",
|
"icon": "widget.png",
|
||||||
"version":"0.04",
|
"version":"0.05",
|
||||||
"description": "A simple digital clock widget",
|
"description": "A simple digital clock widget",
|
||||||
"tags": "widget,clock",
|
"tags": "widget,clock",
|
||||||
"type":"widget",
|
"type":"widget",
|
||||||
|
@ -2477,7 +2477,7 @@
|
||||||
"name": "World Clock - 4 time zones",
|
"name": "World Clock - 4 time zones",
|
||||||
"shortName":"World Clock",
|
"shortName":"World Clock",
|
||||||
"icon": "app.png",
|
"icon": "app.png",
|
||||||
"version":"0.03",
|
"version":"0.04",
|
||||||
"description": "Current time zone plus up to four others",
|
"description": "Current time zone plus up to four others",
|
||||||
"tags": "clock",
|
"tags": "clock",
|
||||||
"type" : "clock",
|
"type" : "clock",
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
0.01: First commit
|
0.01: First commit
|
||||||
0.02: Made Date more visible
|
0.02: Made Date more visible
|
||||||
|
0.03: setUI and support for different screens
|
||||||
|
|
|
@ -4,7 +4,8 @@ require("Font7x11Numeric7Seg").add(Graphics);
|
||||||
// Check settings for what type our clock should be
|
// Check settings for what type our clock should be
|
||||||
var is12Hour = (require("Storage").readJSON("setting.json",1)||{})["12hour"];
|
var is12Hour = (require("Storage").readJSON("setting.json",1)||{})["12hour"];
|
||||||
// position on screen
|
// position on screen
|
||||||
const X = 160, Y = 140;
|
const big = g.getWidth()>200;
|
||||||
|
const X = big?160:135, Y = big?140:100;
|
||||||
|
|
||||||
function draw() {
|
function draw() {
|
||||||
// work out how to display the current time
|
// work out how to display the current time
|
||||||
|
@ -25,7 +26,7 @@ function draw() {
|
||||||
g.setFont("7x11Numeric7Seg",2);
|
g.setFont("7x11Numeric7Seg",2);
|
||||||
g.drawString(("0"+d.getSeconds()).substr(-2), X+35, Y, true /*clear background*/);
|
g.drawString(("0"+d.getSeconds()).substr(-2), X+35, Y, true /*clear background*/);
|
||||||
// draw the date, in a normal font
|
// draw the date, in a normal font
|
||||||
g.setFont("6x8", 3);
|
g.setFont("6x8", big?3:2);
|
||||||
g.setFontAlign(0,1); // align center bottom
|
g.setFontAlign(0,1); // align center bottom
|
||||||
// pad the date - this clears the background if the date were to change length
|
// pad the date - this clears the background if the date were to change length
|
||||||
var dateStr = " "+require("locale").date(d)+" ";
|
var dateStr = " "+require("locale").date(d)+" ";
|
||||||
|
@ -46,11 +47,14 @@ Bangle.on('lcdPower',on=>{
|
||||||
draw(); // draw immediately
|
draw(); // draw immediately
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Show launcher when button pressed
|
||||||
|
Bangle.setUI("clockupdown", btn=>{
|
||||||
|
if (btn==0) vibrateTime();
|
||||||
|
});
|
||||||
// Load widgets
|
// Load widgets
|
||||||
Bangle.loadWidgets();
|
Bangle.loadWidgets();
|
||||||
Bangle.drawWidgets();
|
Bangle.drawWidgets();
|
||||||
// Show launcher when middle button pressed
|
|
||||||
setWatch(Bangle.showLauncher, BTN2, { repeat: false, edge: "falling" });
|
|
||||||
|
|
||||||
// ====================================== Vibration
|
// ====================================== Vibration
|
||||||
// vibrate 0..9
|
// vibrate 0..9
|
||||||
|
@ -92,6 +96,3 @@ function vibrateTime() {
|
||||||
then(() => vibrateNumber(minutes.toString())).
|
then(() => vibrateNumber(minutes.toString())).
|
||||||
then(() => vibrateBusy=false);
|
then(() => vibrateBusy=false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// when BTN1 pressed, vibrate
|
|
||||||
setWatch(vibrateTime, BTN1, {repeat:true,edge:"rising"});
|
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
0.02: Modified for use with new bootloader and firmware
|
0.02: Modified for use with new bootloader and firmware
|
||||||
|
0.03: setUI and support for different screens
|
||||||
|
|
|
@ -36,16 +36,18 @@ const mins = {
|
||||||
7: ["TO", 43, 53]
|
7: ["TO", 43, 53]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var big = g.getWidth()>200
|
||||||
// offsets and incerments
|
// offsets and incerments
|
||||||
const xs = 35;
|
const xs = big ? 35 : 20;
|
||||||
const ys = 31;
|
const ys = big ? 31 : 28;
|
||||||
const dy = 22;
|
const dx = big ? 25 : 20;
|
||||||
const dx = 25;
|
const dy = big ? 22 : 16;
|
||||||
|
|
||||||
// font size and color
|
// font size and color
|
||||||
const fontSize = 3; // "6x8"
|
const fontSize = big ? 3 : 2; // "6x8"
|
||||||
const passivColor = 0x3186 /*grey*/ ;
|
const lowBPP = g.getBPP && (g.getBPP()<12);
|
||||||
const activeColor = 0xF800 /*red*/ ;
|
const passivColor = lowBPP ? "#788" : "#333" /*grey*/ ;
|
||||||
|
const activeColor = lowBPP ? "#F00" : "#F00" /*red*/ ;
|
||||||
|
|
||||||
function drawWordClock() {
|
function drawWordClock() {
|
||||||
|
|
||||||
|
@ -112,8 +114,8 @@ function drawWordClock() {
|
||||||
|
|
||||||
// display digital time
|
// display digital time
|
||||||
g.setColor(activeColor);
|
g.setColor(activeColor);
|
||||||
g.clearRect(0, 215, 240, 240);
|
g.clearRect(0, g.getHeight()-fontSize*8, g.getWidth(), g.getHeight());
|
||||||
g.drawString(time, 120, 215);
|
g.drawString(time, g.getWidth()/2, g.getHeight()-fontSize*8);
|
||||||
}
|
}
|
||||||
|
|
||||||
Bangle.on('lcdPower', function(on) {
|
Bangle.on('lcdPower', function(on) {
|
||||||
|
@ -126,5 +128,5 @@ Bangle.drawWidgets();
|
||||||
setInterval(drawWordClock, 1E4);
|
setInterval(drawWordClock, 1E4);
|
||||||
drawWordClock();
|
drawWordClock();
|
||||||
|
|
||||||
// Show launcher when middle button pressed
|
// Show launcher when button pressed
|
||||||
setWatch(Bangle.showLauncher, BTN2, {repeat:false,edge:"falling"});
|
Bangle.setUI("clock");
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
0.02: Now refresh battery monitor every minute if LCD on
|
0.02: Now refresh battery monitor every minute if LCD on
|
||||||
0.03: Ensure redrawing works with variable size widget system
|
0.03: Ensure redrawing works with variable size widget system
|
||||||
0.04: Fix regression stopping correct widget updates
|
0.04: Fix regression stopping correct widget updates
|
||||||
|
0.05: Don't show clock widget if already showing clock app
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
(() => {
|
(function() {
|
||||||
|
// don't show widget if we know we have a clock app running
|
||||||
|
if (Bangle.CLOCK) return;
|
||||||
|
|
||||||
let intervalRef = null;
|
let intervalRef = null;
|
||||||
var width = 5 * 6*2
|
var width = 5 * 6*2
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
0.01: First try
|
0.01: First try
|
||||||
0.02: Update custom.html for refactor; add README
|
0.02: Update custom.html for refactor; add README
|
||||||
0.03: Update for larger secondary timezone display (#610)
|
0.03: Update for larger secondary timezone display (#610)
|
||||||
|
0.04: setUI, different screen sizes
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
/* jshint esversion: 6 */
|
/* jshint esversion: 6 */
|
||||||
|
|
||||||
|
const big = g.getWidth()>200;
|
||||||
// Font for primary time and date
|
// Font for primary time and date
|
||||||
const primaryTimeFontSize = 6;
|
const primaryTimeFontSize = big?6:5;
|
||||||
const primaryDateFontSize = 3;
|
const primaryDateFontSize = big?3:2;
|
||||||
|
|
||||||
// Font for single secondary time
|
// Font for single secondary time
|
||||||
const secondaryTimeFontSize = 4;
|
const secondaryTimeFontSize = 4;
|
||||||
|
@ -16,9 +17,9 @@ const xcol2 = g.getWidth() - xcol1;
|
||||||
const font = "6x8";
|
const font = "6x8";
|
||||||
|
|
||||||
const xyCenter = g.getWidth() / 2;
|
const xyCenter = g.getWidth() / 2;
|
||||||
const yposTime = 75;
|
const yposTime = big ? 75 : 60;
|
||||||
const yposDate = 130;
|
const yposDate = big ? 130 : 90;
|
||||||
const yposWorld = 170;
|
const yposWorld = big ? 170 : 120;
|
||||||
|
|
||||||
const OFFSET_TIME_ZONE = 0;
|
const OFFSET_TIME_ZONE = 0;
|
||||||
const OFFSET_HOURS = 1;
|
const OFFSET_HOURS = 1;
|
||||||
|
@ -135,6 +136,8 @@ function drawSimpleClock() {
|
||||||
|
|
||||||
// clean app screen
|
// clean app screen
|
||||||
g.clear();
|
g.clear();
|
||||||
|
// Show launcher when button pressed
|
||||||
|
Bangle.setUI("clock");
|
||||||
Bangle.loadWidgets();
|
Bangle.loadWidgets();
|
||||||
Bangle.drawWidgets();
|
Bangle.drawWidgets();
|
||||||
|
|
||||||
|
@ -153,6 +156,3 @@ drawSimpleClock();
|
||||||
if (Bangle.isLCDOn()) {
|
if (Bangle.isLCDOn()) {
|
||||||
secondInterval = setInterval(drawSimpleClock, 15e3);
|
secondInterval = setInterval(drawSimpleClock, 15e3);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show launcher when middle button pressed
|
|
||||||
setWatch(Bangle.showLauncher, BTN2, { repeat: false, edge: "falling" });
|
|
||||||
|
|
Loading…
Reference in New Issue