commit
e47884baf7
|
|
@ -1,2 +1,3 @@
|
||||||
0.01: Initial upload
|
0.01: Initial upload
|
||||||
0.2: Added scrollable calendar and swipe gestures
|
0.2: Added scrollable calendar and swipe gestures
|
||||||
|
0.3: Configurable drag gestures
|
||||||
|
|
|
||||||
|
|
@ -9,25 +9,24 @@ I know that it seems redundant because there already **is** a *time&cal*-app, bu
|
||||||
||unlocked: smaller clock, but with seconds|
|
||unlocked: smaller clock, but with seconds|
|
||||||
||swipe up for big calendar, (up down to scroll, left/right to exit)|
|
||swipe up for big calendar, (up down to scroll, left/right to exit)|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Configurable Features
|
## Configurable Features
|
||||||
- Number of calendar rows (weeks)
|
- Number of calendar rows (weeks)
|
||||||
- Buzz on connect/disconnect (I know, this should be an extra widget, but for now, it is included)
|
- Buzz on connect/disconnect (I know, this should be an extra widget, but for now, it is included)
|
||||||
- Clock Mode (24h/12h). Doesn't have an am/pm indicator. It's only there because it was easy.
|
- Clock Mode (24h/12h). (No am/pm indicator)
|
||||||
- First day of the week
|
- First day of the week
|
||||||
- Red Saturday
|
- Red Saturday/Sunday
|
||||||
- Red Sunday
|
- Swipe/Drag gestures to launch features or apps.
|
||||||
- Swipes (to disable all gestures)
|
|
||||||
- Swipes: music (swipe down)
|
|
||||||
- Spipes: messages (swipe right)
|
|
||||||
|
|
||||||
## Auto detects your message/music apps:
|
## Auto detects your message/music apps:
|
||||||
- swiping down will search your files for an app with the string "music" in its filename and launch it
|
- swiping down will search your files for an app with the string "message" in its filename and launch it. (configurable)
|
||||||
- swiping right will search your files for an app with the string "message" in its filename and launch it.
|
- swiping right will search your files for an app with the string "music" in its filename and launch it. (configurable)
|
||||||
- Configurable apps coming soon.
|
|
||||||
|
|
||||||
## Feedback
|
## Feedback
|
||||||
The clock works for me in a 24h/MondayFirst/WeekendFree environment but is not well-tested with other settings.
|
The clock works for me in a 24h/MondayFirst/WeekendFree environment but is not well-tested with other settings.
|
||||||
So if something isn't working, please tell me: https://github.com/foostuff/BangleApps/issues
|
So if something isn't working, please tell me: https://github.com/foostuff/BangleApps/issues
|
||||||
|
|
||||||
|
## Planned features:
|
||||||
|
- Internal lightweight music control, because switching apps has a loading time.
|
||||||
|
- Clean up settings
|
||||||
|
- Maybe am/pm indicator for 12h-users
|
||||||
|
- Step count (optional)
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,13 @@ var s = Object.assign({
|
||||||
CAL_ROWS: 4, //number of calendar rows.(weeks) Shouldn't exceed 5 when using widgets.
|
CAL_ROWS: 4, //number of calendar rows.(weeks) Shouldn't exceed 5 when using widgets.
|
||||||
BUZZ_ON_BT: true, //2x slow buzz on disconnect, 2x fast buzz on connect. Will be extra widget eventually
|
BUZZ_ON_BT: true, //2x slow buzz on disconnect, 2x fast buzz on connect. Will be extra widget eventually
|
||||||
MODE24: true, //24h mode vs 12h mode
|
MODE24: true, //24h mode vs 12h mode
|
||||||
FIRSTDAYOFFSET: 6, //First day of the week: 0-6: Sun, Sat, Fri, Thu, Wed, Tue, Mon
|
FIRSTDAY: 6, //First day of the week: mo, tu, we, th, fr, sa, su
|
||||||
REDSUN: true, // Use red color for sunday?
|
REDSUN: true, // Use red color for sunday?
|
||||||
REDSAT: true, // Use red color for saturday?
|
REDSAT: true, // Use red color for saturday?
|
||||||
DRAGENABLED: true,
|
DRAGDOWN: "[AI:messg]",
|
||||||
DRAGMUSIC: true,
|
DRAGRIGHT: "[AI:music]",
|
||||||
DRAGMESSAGES: true
|
DRAGLEFT: "[ignore]",
|
||||||
|
DRAGUP: "[calend.]"
|
||||||
}, require('Storage').readJSON("clockcal.json", true) || {});
|
}, require('Storage').readJSON("clockcal.json", true) || {});
|
||||||
|
|
||||||
const h = g.getHeight();
|
const h = g.getHeight();
|
||||||
|
|
@ -50,11 +51,11 @@ function drawFullCalendar(monthOffset) {
|
||||||
g.reset();
|
g.reset();
|
||||||
g.setBgColor(0);
|
g.setBgColor(0);
|
||||||
g.clear();
|
g.clear();
|
||||||
var prevmonth = addMonths(d, -1)
|
var prevmonth = addMonths(d, -1);
|
||||||
const today = prevmonth.getDate();
|
const today = prevmonth.getDate();
|
||||||
var rD = new Date(prevmonth.getTime());
|
var rD = new Date(prevmonth.getTime());
|
||||||
rD.setDate(rD.getDate() - (today - 1));
|
rD.setDate(rD.getDate() - (today - 1));
|
||||||
const dow = (s.FIRSTDAYOFFSET + rD.getDay()) % 7;
|
const dow = (s.FIRSTDAY + rD.getDay()) % 7;
|
||||||
rD.setDate(rD.getDate() - dow);
|
rD.setDate(rD.getDate() - dow);
|
||||||
var rDate = rD.getDate();
|
var rDate = rD.getDate();
|
||||||
bottomrightY = c_y - 3;
|
bottomrightY = c_y - 3;
|
||||||
|
|
@ -163,7 +164,7 @@ function drawWatch() {
|
||||||
g.clear();
|
g.clear();
|
||||||
drawMinutes();
|
drawMinutes();
|
||||||
if (!dimSeconds) drawSeconds();
|
if (!dimSeconds) drawSeconds();
|
||||||
const dow = (s.FIRSTDAYOFFSET + d.getDay()) % 7; //MO=0, SU=6
|
const dow = (s.FIRSTDAY + d.getDay()) % 7; //MO=0, SU=6
|
||||||
const today = d.getDate();
|
const today = d.getDate();
|
||||||
var rD = new Date(d.getTime());
|
var rD = new Date(d.getTime());
|
||||||
rD.setDate(rD.getDate() - dow);
|
rD.setDate(rD.getDate() - dow);
|
||||||
|
|
@ -205,27 +206,52 @@ function BTevent() {
|
||||||
setTimeout(function () { Bangle.buzz(interval); }, interval * 3);
|
setTimeout(function () { Bangle.buzz(interval); }, interval * 3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function action(a) {
|
||||||
|
g.reset();
|
||||||
|
if (typeof secondInterval !== "undefined") clearTimeout(secondInterval);
|
||||||
|
if (DEBUG) console.log("action:" + a);
|
||||||
|
switch (a) {
|
||||||
|
case "[ignore]":
|
||||||
|
break;
|
||||||
|
case "[calend.]":
|
||||||
|
drawFullCalendar();
|
||||||
|
break;
|
||||||
|
case "[AI:music]":
|
||||||
|
l = require("Storage").list(RegExp("music.*app.js"));
|
||||||
|
if (l.length > 0) {
|
||||||
|
load(l[0]);
|
||||||
|
} else E.showAlert("Music app not found", "Not found").then(drawWatch);
|
||||||
|
break;
|
||||||
|
case "[AI:messg]":
|
||||||
|
l = require("Storage").list(RegExp("message.*app.js"));
|
||||||
|
if (l.length > 0) {
|
||||||
|
load(l[0]);
|
||||||
|
} else E.showAlert("Message app not found", "Not found").then(drawWatch);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
l = require("Storage").list(RegExp(a + ".app.js"));
|
||||||
|
if (l.length > 0) {
|
||||||
|
load(l[0]);
|
||||||
|
} else E.showAlert(a + ": App not found", "Not found").then(drawWatch);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
function input(dir) {
|
function input(dir) {
|
||||||
if (s.DRAGENABLED) {
|
|
||||||
Bangle.buzz(100, 1);
|
Bangle.buzz(100, 1);
|
||||||
console.log("swipe:"+dir);
|
if (DEBUG) console.log("swipe:" + dir);
|
||||||
switch (dir) {
|
switch (dir) {
|
||||||
case "r":
|
case "r":
|
||||||
if (state == "calendar") {
|
if (state == "calendar") {
|
||||||
drawWatch();
|
drawWatch();
|
||||||
} else {
|
} else {
|
||||||
if (s.DRAGMUSIC) {
|
action(s.DRAGRIGHT);
|
||||||
l=require("Storage").list(RegExp("music.*app"));
|
|
||||||
if (l.length > 0) {
|
|
||||||
load(l[0]);
|
|
||||||
} else Bangle.buzz(3000,1);//not found
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "l":
|
case "l":
|
||||||
if (state == "calendar") {
|
if (state == "calendar") {
|
||||||
drawWatch();
|
drawWatch();
|
||||||
|
} else {
|
||||||
|
action(s.DRAGLEFT);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "d":
|
case "d":
|
||||||
|
|
@ -233,21 +259,15 @@ function input(dir) {
|
||||||
monthOffset--;
|
monthOffset--;
|
||||||
drawFullCalendar(monthOffset);
|
drawFullCalendar(monthOffset);
|
||||||
} else {
|
} else {
|
||||||
if (s.DRAGMESSAGES) {
|
action(s.DRAGDOWN);
|
||||||
l=require("Storage").list(RegExp("message.*app"));
|
|
||||||
if (l.length > 0) {
|
|
||||||
load(l[0]);
|
|
||||||
} else Bangle.buzz(3000,1);//not found
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "u":
|
case "u":
|
||||||
if (state == "watch") {
|
if (state == "calendar") {
|
||||||
state = "calendar";
|
|
||||||
drawFullCalendar(0);
|
|
||||||
} else if (state == "calendar") {
|
|
||||||
monthOffset++;
|
monthOffset++;
|
||||||
drawFullCalendar(monthOffset);
|
drawFullCalendar(monthOffset);
|
||||||
|
} else {
|
||||||
|
action(s.DRAGUP);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
@ -255,27 +275,25 @@ function input(dir) {
|
||||||
drawWatch();
|
drawWatch();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let drag;
|
let drag;
|
||||||
Bangle.on("drag", e => {
|
Bangle.on("drag", e => {
|
||||||
if (s.DRAGENABLED) {
|
|
||||||
if (!drag) {
|
if (!drag) {
|
||||||
drag = { x: e.x, y: e.y };
|
drag = { x: e.x, y: e.y };
|
||||||
} else if (!e.b) {
|
} else if (!e.b) {
|
||||||
const dx = e.x - drag.x, dy = e.y - drag.y;
|
const dx = e.x - drag.x, dy = e.y - drag.y;
|
||||||
var dir = "t";
|
var dir = "t";
|
||||||
if (Math.abs(dx) > Math.abs(dy) + 10) {
|
if (Math.abs(dx) > Math.abs(dy) + 20) {
|
||||||
dir = (dx > 0) ? "r" : "l";
|
dir = (dx > 0) ? "r" : "l";
|
||||||
} else if (Math.abs(dy) > Math.abs(dx) + 10) {
|
} else if (Math.abs(dy) > Math.abs(dx) + 20) {
|
||||||
dir = (dy > 0) ? "d" : "u";
|
dir = (dy > 0) ? "d" : "u";
|
||||||
}
|
}
|
||||||
drag = null;
|
drag = null;
|
||||||
input(dir);
|
input(dir);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
//register events
|
//register events
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"id": "clockcal",
|
"id": "clockcal",
|
||||||
"name": "Clock & Calendar",
|
"name": "Clock & Calendar",
|
||||||
"version": "0.2",
|
"version": "0.3",
|
||||||
"description": "Clock with Calendar",
|
"description": "Clock with Calendar",
|
||||||
"readme":"README.md",
|
"readme":"README.md",
|
||||||
"icon": "app.png",
|
"icon": "app.png",
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,21 @@
|
||||||
(function (back) {
|
(function (back) {
|
||||||
var FILE = "clockcal.json";
|
var FILE = "clockcal.json";
|
||||||
|
defaults={
|
||||||
settings = Object.assign({
|
|
||||||
CAL_ROWS: 4, //number of calendar rows.(weeks) Shouldn't exceed 5 when using widgets.
|
CAL_ROWS: 4, //number of calendar rows.(weeks) Shouldn't exceed 5 when using widgets.
|
||||||
BUZZ_ON_BT: true, //2x slow buzz on disconnect, 2x fast buzz on connect. Will be extra widget eventually
|
BUZZ_ON_BT: true, //2x slow buzz on disconnect, 2x fast buzz on connect. Will be extra widget eventually
|
||||||
MODE24: true, //24h mode vs 12h mode
|
MODE24: true, //24h mode vs 12h mode
|
||||||
FIRSTDAY: 6, //First day of the week: mo, tu, we, th, fr, sa, su
|
FIRSTDAY: 6, //First day of the week: mo, tu, we, th, fr, sa, su
|
||||||
REDSUN: true, // Use red color for sunday?
|
REDSUN: true, // Use red color for sunday?
|
||||||
REDSAT: true, // Use red color for saturday?
|
REDSAT: true, // Use red color for saturday?
|
||||||
DRAGENABLED: true, //Enable drag gestures (bigger calendar etc)
|
DRAGDOWN: "[AI:messg]",
|
||||||
DRAGMUSIC: true, //Enable drag down for music (looks for "music*app")
|
DRAGRIGHT: "[AI:music]",
|
||||||
DRAGMESSAGES: true //Enable drag right for messages (looks for "message*app")
|
DRAGLEFT: "[ignore]",
|
||||||
}, require('Storage').readJSON(FILE, true) || {});
|
DRAGUP: "[calend.]"
|
||||||
|
};
|
||||||
|
settings = Object.assign(defaults, require('Storage').readJSON(FILE, true) || {});
|
||||||
|
|
||||||
|
actions = ["[ignore]","[calend.]","[AI:music]","[AI:messg]"];
|
||||||
|
require("Storage").list(RegExp(".app.js")).forEach(element => actions.push(element.replace(".app.js","")));
|
||||||
|
|
||||||
function writeSettings() {
|
function writeSettings() {
|
||||||
require('Storage').writeJSON(FILE, settings);
|
require('Storage').writeJSON(FILE, settings);
|
||||||
|
|
@ -70,27 +73,39 @@
|
||||||
writeSettings();
|
writeSettings();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'Swipes (big cal.)?': {
|
'Drag Up ': {
|
||||||
value: settings.DRAGENABLED,
|
min:0, max:actions.length-1,
|
||||||
format: v => v ? "On" : "Off",
|
value: actions.indexOf(settings.DRAGUP),
|
||||||
|
format: v => actions[v],
|
||||||
onchange: v => {
|
onchange: v => {
|
||||||
settings.DRAGENABLED = v;
|
settings.DRAGUP = actions[v];
|
||||||
writeSettings();
|
writeSettings();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'Swipes (music)?': {
|
'Drag Right': {
|
||||||
value: settings.DRAGMUSIC,
|
min:0, max:actions.length-1,
|
||||||
format: v => v ? "On" : "Off",
|
value: actions.indexOf(settings.DRAGRIGHT),
|
||||||
|
format: v => actions[v],
|
||||||
onchange: v => {
|
onchange: v => {
|
||||||
settings.DRAGMUSIC = v;
|
settings.DRAGRIGHT = actions[v];
|
||||||
writeSettings();
|
writeSettings();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'Swipes (messg)?': {
|
'Drag Down': {
|
||||||
value: settings.DRAGMESSAGES,
|
min:0, max:actions.length-1,
|
||||||
format: v => v ? "On" : "Off",
|
value: actions.indexOf(settings.DRAGDOWN),
|
||||||
|
format: v => actions[v],
|
||||||
onchange: v => {
|
onchange: v => {
|
||||||
settings.DRAGMESSAGES = v;
|
settings.DRGDOWN = actions[v];
|
||||||
|
writeSettings();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'Drag Left': {
|
||||||
|
min:0, max:actions.length-1,
|
||||||
|
value: actions.indexOf(settings.DRAGLEFT),
|
||||||
|
format: v => actions[v],
|
||||||
|
onchange: v => {
|
||||||
|
settings.DRAGLEFT = actions[v];
|
||||||
writeSettings();
|
writeSettings();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -100,17 +115,7 @@
|
||||||
format: v => ["No", "Yes"][v],
|
format: v => ["No", "Yes"][v],
|
||||||
onchange: v => {
|
onchange: v => {
|
||||||
if (v == 1) {
|
if (v == 1) {
|
||||||
settings = {
|
settings = defaults;
|
||||||
CAL_ROWS: 4, //number of calendar rows.(weeks) Shouldn't exceed 5 when using widgets.
|
|
||||||
BUZZ_ON_BT: true, //2x slow buzz on disconnect, 2x fast buzz on connect.
|
|
||||||
MODE24: true, //24h mode vs 12h mode
|
|
||||||
FIRSTDAY: 6, //First day of the week: mo, tu, we, th, fr, sa, su
|
|
||||||
REDSUN: true, // Use red color for sunday?
|
|
||||||
REDSAT: true, // Use red color for saturday?
|
|
||||||
DRAGENABLED: true,
|
|
||||||
DRAGMUSIC: true,
|
|
||||||
DRAGMESSAGES: true
|
|
||||||
};
|
|
||||||
writeSettings();
|
writeSettings();
|
||||||
load();
|
load();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue