mirror of https://github.com/espruino/BangleApps
commit
1a3ffca9a1
|
@ -14,3 +14,4 @@
|
|||
0.14: cleanup code and fix fastload issue
|
||||
0.15: fix draw before widget hide
|
||||
0.16: Use 'modules/suncalc.js' to avoid it being copied 8 times for different apps
|
||||
0.17: Add fullscreen option (on by default) to show widgets, adjust sidebar 1 and 2 when fullscreen is off
|
||||
|
|
|
@ -10,14 +10,22 @@
|
|||
* Tap top or bottom right to instantly cycle to the next sidebar
|
||||
* Uses pedometer widget to get latest step count
|
||||
* Dependant apps are installed when Rebble installs
|
||||
* Uses the whole screen, widgets are made invisible but still run in the background
|
||||
* When in fullscreen widgets are made invisible but still run in the background
|
||||
* The icon is James Dean - 'Rebel Without a Cause'
|
||||
|
||||
## Fullscreen
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
## With widgets
|
||||
|
||||

|
||||

|
||||

|
||||
|
||||
## Future Enhancements
|
||||
|
||||
* Support for Weather Icons in the Steps Sidebar
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
"id": "rebble",
|
||||
"name": "Rebble Clock",
|
||||
"shortName": "Rebble",
|
||||
"version": "0.16",
|
||||
"version": "0.17",
|
||||
"description": "A Pebble style clock, with configurable background, three sidebars including steps, day, date, sunrise, sunset, long live the rebellion",
|
||||
"readme": "README.md",
|
||||
"icon": "rebble.png",
|
||||
"dependencies": {"mylocation":"app"},
|
||||
"screenshots": [{"url":"screenshot_rebble.png"}],
|
||||
"screenshots": [{"url":"screenshot_rebble.png"}, {"url":"screenshot_rebble2.png"}, {"url":"screenshot_rebble3.png"}, {"url":"screenshot_rebble4.png"}, {"url":"screenshot_rebble_w1.png"}, {"url":"screenshot_rebble_w2.png"}, {"url":"screenshot_rebble_w3.png"}],
|
||||
"type": "clock",
|
||||
"tags": "clock",
|
||||
"supports": ["BANGLEJS2"],
|
||||
|
|
|
@ -40,7 +40,7 @@ Graphics.prototype.setFontKdamThmor = function(scale) {
|
|||
}
|
||||
|
||||
let loadSettings=function() {
|
||||
settings = {'bg': '#0f0', 'color': 'Green', 'autoCycle': true,'sideTap':0};
|
||||
settings = {'bg': '#0f0', 'color': 'Green', 'autoCycle': true, 'fullScreen': true, 'sideTap':0};
|
||||
//sideTap 0 = on | 1 = sidebar1...
|
||||
|
||||
let tmp = require('Storage').readJSON(SETTINGS_FILE, 1) || settings;
|
||||
|
@ -118,32 +118,60 @@ Graphics.prototype.setFontKdamThmor = function(scale) {
|
|||
|
||||
if (drawCount % 60 == 0)
|
||||
updateSunRiseSunSet(location.lat, location.lon);
|
||||
|
||||
|
||||
g.reset();
|
||||
g.setColor(g.theme.bg);
|
||||
g.fillRect(0, 0, w2, h);
|
||||
g.setColor(settings.bg);
|
||||
g.fillRect(w2, 0, w, h);
|
||||
|
||||
if (settings.fullScreen) {
|
||||
g.setColor(g.theme.bg);
|
||||
g.fillRect(0, 0, w2, h);
|
||||
g.setColor(settings.bg);
|
||||
g.fillRect(w2, 0, w, h);
|
||||
|
||||
// time
|
||||
g.setColor(g.theme.fg);
|
||||
g.setFontKdamThmor();
|
||||
g.setFontAlign(0, -1);
|
||||
g.drawString(hh, w2/2, 10 + 0);
|
||||
g.drawString(mm, w2/2, 10 + h/2);
|
||||
// time
|
||||
g.setColor(g.theme.fg);
|
||||
g.setFontKdamThmor();
|
||||
g.setFontAlign(0, -1);
|
||||
g.drawString(hh, w2/2, 10 + 0);
|
||||
g.drawString(mm, w2/2, 10 + h/2);
|
||||
|
||||
switch(sideBar) {
|
||||
case 0:
|
||||
drawSideBar1();
|
||||
break;
|
||||
case 1:
|
||||
drawSideBar2();
|
||||
break;
|
||||
case 2:
|
||||
drawSideBar3();
|
||||
break;
|
||||
switch(sideBar) {
|
||||
case 0:
|
||||
drawSideBar1();
|
||||
break;
|
||||
case 1:
|
||||
drawSideBar2();
|
||||
break;
|
||||
case 2:
|
||||
drawSideBar3();
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
g.setColor(g.theme.bg);
|
||||
g.fillRect(0, 24, 113, 176);
|
||||
g.setColor(settings.bg);
|
||||
g.fillRect(113, 24, 176, 176);
|
||||
|
||||
// time
|
||||
g.setColor(g.theme.fg);
|
||||
g.setFontKdamThmor();
|
||||
g.setFontAlign(0, -1);
|
||||
g.drawString(hh, 57, 24);
|
||||
g.drawString(mm, 57, 100);
|
||||
|
||||
switch(sideBar) {
|
||||
case 0:
|
||||
drawSideBar1Alt();
|
||||
break;
|
||||
case 1:
|
||||
drawSideBar2Alt();
|
||||
break;
|
||||
case 2:
|
||||
drawSideBar3();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
drawCount++;
|
||||
queueDraw();
|
||||
}
|
||||
|
@ -164,6 +192,16 @@ Graphics.prototype.setFontKdamThmor = function(scale) {
|
|||
|
||||
drawDateAndCalendar(w3, h/2, dy, dd, mm);
|
||||
}
|
||||
|
||||
let drawSideBar1Alt=function() {
|
||||
let date = new Date();
|
||||
let dy= require("date_utils").dow(date.getDay(),1).toUpperCase();
|
||||
let dd= date.getDate();
|
||||
let mm= require("date_utils").month(date.getMonth()+1,1).toUpperCase();
|
||||
let yy = date.getFullYear();
|
||||
|
||||
drawDateAndCalendarAlt(145, 46, dy, dd, mm, yy);
|
||||
}
|
||||
|
||||
let drawSideBar2=function() {
|
||||
drawBattery(w2 + (w-w2-wb)/2, h/10, wb, 17);
|
||||
|
@ -178,6 +216,14 @@ Graphics.prototype.setFontKdamThmor = function(scale) {
|
|||
setSmallFont();
|
||||
g.setFontAlign(0, -1);
|
||||
g.drawString(formatSteps(), w3, 7*h/8);
|
||||
}
|
||||
|
||||
let drawSideBar2Alt=function() {
|
||||
// steps
|
||||
g.drawImage(boot_img, 113, 59, { scale: 1 });
|
||||
setSmallFont();
|
||||
g.setFontAlign(0, -1);
|
||||
g.drawString(formatSteps(), 145, 122);
|
||||
}
|
||||
|
||||
// sunrise, sunset times
|
||||
|
@ -212,6 +258,28 @@ Graphics.prototype.setFontKdamThmor = function(scale) {
|
|||
g.setFontAlign(0, -1);
|
||||
g.drawString(mm.toUpperCase(), x, y + 70);
|
||||
}
|
||||
|
||||
let drawDateAndCalendarAlt=function(x, y, dy, dd, mm, yy) {
|
||||
// day
|
||||
setTextColor();
|
||||
setSmallFont();
|
||||
g.setFontAlign(0, -1);
|
||||
g.drawString(dy.toUpperCase(), x, y);
|
||||
|
||||
drawCalendar(x - 18, y + 28, 35, 3, dd);
|
||||
|
||||
// month
|
||||
setTextColor();
|
||||
setSmallFont();
|
||||
g.setFontAlign(0, -1);
|
||||
g.drawString(mm.toUpperCase(), x, y + 70);
|
||||
|
||||
// year
|
||||
setTextColor();
|
||||
setSmallFont();
|
||||
g.setFontAlign(0, -1);
|
||||
g.drawString(yy, x, y + 94);
|
||||
}
|
||||
|
||||
// at x,y width:wi thicknes:th
|
||||
let drawCalendar=function(x,y,wi,th,str) {
|
||||
|
@ -311,7 +379,10 @@ Graphics.prototype.setFontKdamThmor = function(scale) {
|
|||
if (drawTimeout) clearTimeout(drawTimeout);
|
||||
drawTimeout = undefined;
|
||||
delete Graphics.prototype.setFontKdamThmor;
|
||||
Bangle.removeListener('charging',chargingListener);
|
||||
|
||||
if (settings.fullScreen) {
|
||||
Bangle.removeListener('charging',chargingListener);
|
||||
}
|
||||
}
|
||||
|
||||
let main=function(){
|
||||
|
@ -341,17 +412,17 @@ Graphics.prototype.setFontKdamThmor = function(scale) {
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
Bangle.on('charging',chargingListener);
|
||||
|
||||
|
||||
Bangle.loadWidgets();
|
||||
require("widget_utils").hide();
|
||||
|
||||
if (settings.fullScreen) {
|
||||
Bangle.on('charging',chargingListener);
|
||||
require("widget_utils").hide();
|
||||
} else {
|
||||
Bangle.drawWidgets();
|
||||
}
|
||||
|
||||
draw();
|
||||
|
||||
}
|
||||
|
||||
|
||||
main();
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
const SETTINGS_FILE = "rebble.json";
|
||||
|
||||
// initialize with default settings...
|
||||
let localSettings = {'bg': '#0f0', 'color': 'Green', 'autoCycle': true, 'sideTap':0};
|
||||
let localSettings = {'bg': '#0f0', 'color': 'Green', 'autoCycle': true, 'fullScreen': true, 'sideTap':0};
|
||||
//sideTap 0 = on| 1= sideBar1 | 2 = ...
|
||||
|
||||
// ...and overwrite them with any saved values
|
||||
|
@ -37,6 +37,14 @@
|
|||
localSettings.bg = bg_code[v];
|
||||
save();
|
||||
},
|
||||
},
|
||||
'Fullscreen': {
|
||||
value: localSettings.fullScreen,
|
||||
onchange: (v) => {
|
||||
localSettings.fullScreen = v;
|
||||
save();
|
||||
showMenu();
|
||||
}
|
||||
},
|
||||
'Auto Cycle': {
|
||||
value: localSettings.autoCycle,
|
||||
|
@ -74,4 +82,4 @@
|
|||
}
|
||||
|
||||
showMenu();
|
||||
})
|
||||
})
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 3.4 KiB |
Binary file not shown.
After Width: | Height: | Size: 3.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 4.0 KiB |
Loading…
Reference in New Issue