mirror of https://github.com/espruino/BangleApps
alarm settings (incl group), drag keyboard settings fix
parent
e2d8a23672
commit
4569f52692
|
@ -45,3 +45,4 @@
|
|||
0.40: Use substring of message when it's longer than fits the designated menu entry.
|
||||
0.41: Fix a menu bug affecting alarms with empty messages.
|
||||
0.42: Fix date not getting saved in event edit menu when tapping Confirm
|
||||
0.43: New settings: Show confirm, Show Overflow, Show Type.
|
||||
|
|
|
@ -13,7 +13,7 @@ It uses the [`sched` library](https://github.com/espruino/BangleApps/blob/master
|
|||
- `Repeat` → Select when the alarm will fire. You can select a predefined option (_Once_, _Every Day_, _Workdays_ or _Weekends_ or you can configure the days freely)
|
||||
- `New Timer` → Configure a new timer (triggered based on amount of time elapsed in hours/minutes/seconds)
|
||||
- `New Event` → Configure a new event (triggered based on time and date)
|
||||
- `Repeat` → Alarm can be be fired only once or repeated (every X number of _days_, _weeks_, _months_ or _years_)
|
||||
- `Repeat` → Alarm can be fired only once or repeated (every X number of _days_, _weeks_, _months_ or _years_)
|
||||
- `Advanced`
|
||||
- `Scheduler settings` → Open the [Scheduler](https://github.com/espruino/BangleApps/tree/master/apps/sched) settings page, see its [README](https://github.com/espruino/BangleApps/blob/master/apps/sched/README.md) for details
|
||||
- `Enable All` → Enable _all_ disabled alarms & timers
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
Bangle.loadWidgets();
|
||||
Bangle.drawWidgets();
|
||||
|
||||
const settings = require('Storage').readJSON('alarm.json',1)||{};
|
||||
// 0 = Sunday (default), 1 = Monday
|
||||
const firstDayOfWeek = (require("Storage").readJSON("setting.json", true) || {}).firstDayOfWeek || 0;
|
||||
const WORKDAYS = 62;
|
||||
|
@ -51,12 +52,14 @@ function getLabel(e) {
|
|||
}
|
||||
|
||||
function trimLabel(label, maxLength) {
|
||||
if(settings.showOverflow) return label;
|
||||
return (label.length > maxLength
|
||||
? label.substring(0,maxLength-3) + "..."
|
||||
: label.substring(0,maxLength));
|
||||
}
|
||||
|
||||
function formatAlarmMessage(msg) {
|
||||
function formatAlarmProperty(msg) {
|
||||
if(settings.showOverflow) return msg;
|
||||
if (msg == null) {
|
||||
return msg;
|
||||
} else if (msg.length > 7) {
|
||||
|
@ -155,7 +158,7 @@ function showEditAlarmMenu(selectedAlarm, alarmIndex, withDate) {
|
|||
},
|
||||
/*LANG*/"Message": {
|
||||
value: alarm.msg,
|
||||
format: formatAlarmMessage,
|
||||
format: formatAlarmProperty,
|
||||
onchange: () => {
|
||||
setTimeout(() => {
|
||||
keyboard.input({text:alarm.msg}).then(result => {
|
||||
|
@ -166,6 +169,19 @@ function showEditAlarmMenu(selectedAlarm, alarmIndex, withDate) {
|
|||
}, 100);
|
||||
}
|
||||
},
|
||||
/*LANG*/"Group": {
|
||||
value: alarm.group,
|
||||
format: formatAlarmProperty,
|
||||
onchange: () => {
|
||||
setTimeout(() => {
|
||||
keyboard.input({text:alarm.group}).then(result => {
|
||||
alarm.group = result;
|
||||
prepareAlarmForSave(alarm, alarmIndex, time, date, true);
|
||||
setTimeout(showEditAlarmMenu, 10, alarm, alarmIndex, withDate);
|
||||
});
|
||||
}, 100);
|
||||
}
|
||||
},
|
||||
/*LANG*/"Enabled": {
|
||||
value: alarm.on,
|
||||
onchange: v => alarm.on = v
|
||||
|
@ -197,6 +213,10 @@ function showEditAlarmMenu(selectedAlarm, alarmIndex, withDate) {
|
|||
};
|
||||
|
||||
if (!keyboard) delete menu[/*LANG*/"Message"];
|
||||
if (!keyboard || !settings.showGroup) delete menu[/*LANG*/"Group"];
|
||||
if (!(settings.showConfirm == null ? true : settings.showConfirm)) delete menu[/*LANG*/"Confirm"];
|
||||
if (!(settings.showAutoSnooze == null ? true : settings.showAutoSnooze)) delete menu[/*LANG*/"Auto Snooze"];
|
||||
if (!(settings.showHidden == null ? true : settings.showHidden)) delete menu[/*LANG*/"Hidden"];
|
||||
if (!alarm.date) {
|
||||
delete menu[/*LANG*/"Day"];
|
||||
delete menu[/*LANG*/"Month"];
|
||||
|
@ -387,7 +407,7 @@ function showEditTimerMenu(selectedTimer, timerIndex) {
|
|||
},
|
||||
/*LANG*/"Message": {
|
||||
value: timer.msg,
|
||||
format: formatAlarmMessage,
|
||||
format: formatAlarmProperty,
|
||||
onchange: () => {
|
||||
setTimeout(() => {
|
||||
keyboard.input({text:timer.msg}).then(result => {
|
||||
|
@ -420,6 +440,8 @@ function showEditTimerMenu(selectedTimer, timerIndex) {
|
|||
};
|
||||
|
||||
if (!keyboard) delete menu[/*LANG*/"Message"];
|
||||
if (!(settings.showConfirm == null ? true : settings.showConfirm)) delete menu[/*LANG*/"Confirm"];
|
||||
if (!(settings.showHidden == null ? true : settings.showHidden)) delete menu[/*LANG*/"Hidden"];
|
||||
if (!isNew) {
|
||||
menu[/*LANG*/"Delete"] = () => {
|
||||
E.showPrompt(getLabel(timer) + "\n" + /*LANG*/"Are you sure?", { title: /*LANG*/"Delete Timer" }).then((confirm) => {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"id": "alarm",
|
||||
"name": "Alarms & Timers",
|
||||
"shortName": "Alarms",
|
||||
"version": "0.42",
|
||||
"version": "0.43",
|
||||
"description": "Set alarms and timers on your Bangle",
|
||||
"icon": "app.png",
|
||||
"tags": "tool,alarm",
|
||||
|
@ -11,7 +11,8 @@
|
|||
"dependencies": { "scheduler":"type", "alarm":"widget" },
|
||||
"storage": [
|
||||
{ "name": "alarm.app.js", "url": "app.js" },
|
||||
{ "name": "alarm.img", "url": "app-icon.js", "evaluate": true }
|
||||
{ "name": "alarm.img", "url": "app-icon.js", "evaluate": true },
|
||||
{ "name": "alarm.settings.js", "url":"settings.js" }
|
||||
],
|
||||
"screenshots": [
|
||||
{ "url": "screenshot-1.png" },
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
(function(back) {
|
||||
let settings = require('Storage').readJSON('alarm.json',1)||{};
|
||||
|
||||
const save = () => require('Storage').write('alarm.json', settings);
|
||||
const DATE_FORMATS = ['default', 'mmdd'];
|
||||
const DATE_FORMATS_LABELS = [/*LANG*/'Default', /*LANG*/'MMDD'];
|
||||
|
||||
const appMenu = {
|
||||
'': {title: 'alarm'}, '< Back': back,
|
||||
/*LANG*/'Menu Date Format': {
|
||||
value: DATE_FORMATS.indexOf(settings.menuDateFormat || 'default'),
|
||||
format: v => DATE_FORMATS_LABELS[v],
|
||||
min: 0,
|
||||
max: DATE_FORMATS.length - 1,
|
||||
onchange : v => {
|
||||
if(v > 0) {
|
||||
settings.menuDateFormat=DATE_FORMATS[v];
|
||||
} else {
|
||||
delete settings.menuDateFormat;
|
||||
}
|
||||
save();
|
||||
}
|
||||
},
|
||||
/*LANG*/'Show Menu Auto Snooze': {
|
||||
value : settings.showAutoSnooze == null ? true : settings.showAutoSnooze,
|
||||
onchange : v => { settings.showAutoSnooze=v; save();}
|
||||
},
|
||||
/*LANG*/'Show Menu Confirm': {
|
||||
value : settings.showConfirm == null ? true : settings.showConfirm,
|
||||
onchange : v => { settings.showConfirm=v; save();}
|
||||
},
|
||||
/*LANG*/'Show Menu Hidden': {
|
||||
value : settings.showHidden == null ? true : settings.showHidden,
|
||||
onchange : v => { settings.showHidden=v; save();}
|
||||
},
|
||||
/*LANG*/'Show Menu Group': {
|
||||
value : !!settings.showGroup,
|
||||
onchange : v => { settings.showGroup=v; save();}
|
||||
},
|
||||
/*LANG*/'Show Text Overflow': {
|
||||
value : !!settings.showOverflow,
|
||||
onchange : v => { settings.showOverflow=v; save();}
|
||||
},
|
||||
};
|
||||
|
||||
E.showMenu(appMenu);
|
||||
});
|
|
@ -7,3 +7,4 @@
|
|||
0.07: Settings for display colors
|
||||
0.08: Catch and discard swipe events on fw2v19 and up (as well as some cutting
|
||||
edge 2v18 ones), allowing compatability with the Back Swipe app.
|
||||
0.09: Fix colors settings, where color was stored as string instead of the expected int.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{ "id": "dragboard",
|
||||
"name": "Dragboard",
|
||||
"version":"0.08",
|
||||
"version":"0.09",
|
||||
"description": "A library for text input via swiping keyboard",
|
||||
"icon": "app.png",
|
||||
"type":"textinput",
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
value: settings[key] == color,
|
||||
onchange: () => {
|
||||
if (color >= 0) {
|
||||
settings[key] = color;
|
||||
settings[key] = parseInt(color);
|
||||
} else {
|
||||
delete settings[key];
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
0.01: New App based on dragboard, but with a U shaped drag area
|
||||
0.02: Catch and discard swipe events on fw2v19 and up (as well as some cutting
|
||||
edge 2v18 ones), allowing compatability with the Back Swipe app.
|
||||
0.03: Fix "Uncaught Error: Unhandled promise rejection: ReferenceError: "dragHandlerDB" is not defined"
|
||||
|
|
|
@ -148,7 +148,7 @@ exports.input = function(options) {
|
|||
g.clearRect(Bangle.appRect);
|
||||
resolve(text);
|
||||
},
|
||||
drag: dragHandlerDB
|
||||
drag: dragHandlerUB
|
||||
});
|
||||
Bangle.prependListener&&Bangle.prependListener('swipe', catchSwipe); // Intercept swipes on fw2v19 and later. Should not break on older firmwares.
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{ "id": "draguboard",
|
||||
"name": "DragUboard",
|
||||
"version":"0.02",
|
||||
"version":"0.03",
|
||||
"description": "A library for text input via swiping U-shaped keyboard.",
|
||||
"icon": "app.png",
|
||||
"type":"textinput",
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
value: settings[key] == color,
|
||||
onchange: () => {
|
||||
if (color >= 0) {
|
||||
settings[key] = color;
|
||||
settings[key] = parseInt(color);
|
||||
} else {
|
||||
delete settings[key];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue