forked from FOSS/BangleApps
Fixed sched clkinfo icons and sorting
parent
c8ee05a4b6
commit
4ff8e9a52c
|
@ -1,16 +1,9 @@
|
||||||
(function() {
|
(function() {
|
||||||
const alarm = require('sched');
|
const alarm = require('sched');
|
||||||
const iconAlarmOn = atob("GBiBAAAAAAAAAAYAYA4AcBx+ODn/nAP/wAf/4A/n8A/n8B/n+B/n+B/n+B/n+B/h+B/4+A/+8A//8Af/4AP/wAH/gAB+AAAAAAAAAA==");
|
const iconAlarmOn = atob("GBiBAAAAAAAAAAYAYA4AcBx+ODn/nAP/wAf/4A/n8A/n8B/n+B/n+B/n+B/n+B/h+B/4+A/+8A//8Af/4AP/wAH/gAB+AAAAAAAAAA==");
|
||||||
const iconAlarmOff =
|
const iconAlarmOff = atob("GBiBAAAAAAAAAAYAYA4AcBx+ODn/nAP/wAf/4A/n8A/n8B/n+B/n+B/nAB/mAB/geB/5/g/5tg/zAwfzhwPzhwHzAwB5tgAB/gAAeA==");
|
||||||
atob("GBjBAP////8AAAAAAAAGAGAOAHAcfjg5/5wD/8AH/+AP5/AP5/Af5/gf5/gf5wAf5gAf4Hgf+f4P+bYP8wMH84cD84cB8wMAebYAAf4AAHg=");
|
const iconTimerOn = atob("GBiBAAAAAAAAAAAAAAf/4Af/4AGBgAGBgAGBgAD/AAD/AAB+AAA8AAA8AAB+AADnAADDAAGBgAGBgAGBgAf/4Af/4AAAAAAAAAAAAA==");
|
||||||
//atob("GBjBAP//AAAAAAAAAAAGAGAOAHAcfjg5/5wD/8AH/+AP5/AP5/Af5/gf5/gf5wAf5gAf4Hgf+f4P+bYP8wMH84cD84cB8wMAebYAAf4AAHg=");
|
const iconTimerOff = atob("GBiBAAAAAAAAAAAAAAf/4Af/4AGBgAGBgAGBgAD/AAD/AAB+AAA8AAA8AAB+AADkeADB/gGBtgGDAwGDhwfzhwfzAwABtgAB/gAAeA==");
|
||||||
|
|
||||||
const iconTimerOn =
|
|
||||||
atob("GBjBAP////8AAAAAAAAAAAAH/+AH/+ABgYABgYABgYAA/wAA/wAAfgAAPAAAPAAAfgAA5wAAwwABgYABgYABgYAH/+AH/+AAAAAAAAAAAAA=");
|
|
||||||
//atob("GBjBAP//AAAAAAAAAAAAAAAH/+AH/+ABgYABgYABgYAA/wAA/wAAfgAAPAAAPAAAfgAA5wAAwwABgYABgYABgYAH/+AH/+AAAAAAAAAAAAA=");
|
|
||||||
const iconTimerOff =
|
|
||||||
atob("GBjBAP////8AAAAAAAAAAAAH/+AH/+ABgYABgYABgYAA/wAA/wAAfgAAPAAAPAAAfgAA5HgAwf4BgbYBgwMBg4cH84cH8wMAAbYAAf4AAHg=");
|
|
||||||
//atob("GBjBAP//AAAAAAAAAAAAAAAH/+AH/+ABgYABgYABgYAA/wAA/wAAfgAAPAAAPAAAfgAA5HgAwf4BgbYBgwMBg4cH84cH8wMAAbYAAf4AAHg=");
|
|
||||||
|
|
||||||
//from 0 to max, the higher the closer to fire (as in a progress bar)
|
//from 0 to max, the higher the closer to fire (as in a progress bar)
|
||||||
function getAlarmValue(a){
|
function getAlarmValue(a){
|
||||||
|
@ -49,14 +42,21 @@
|
||||||
return require("time_utils").formatTime(a.t);
|
return require("time_utils").formatTime(a.t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//workaround for sorting undefined values
|
||||||
|
function getAlarmOrder(a) {
|
||||||
|
let val = alarm.getTimeToAlarm(a);
|
||||||
|
if(typeof val == "undefined") return 86400*1000;
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
var img = iconAlarmOn;
|
var img = iconAlarmOn;
|
||||||
//get only alarms not created by other apps
|
//get only alarms not created by other apps
|
||||||
var alarmItems = {
|
var alarmItems = {
|
||||||
name: "Alarms",
|
name: "Alarms",
|
||||||
img: img,
|
img: img,
|
||||||
items: alarm.getAlarms().filter(a=>!a.appid)
|
items: alarm.getAlarms().filter(a=>!a.appid)
|
||||||
.sort((a,b)=>alarm.getTimeToAlarm(a)-alarm.getTimeToAlarm(b))
|
//.sort((a,b)=>alarm.getTimeToAlarm(a)-alarm.getTimeToAlarm(b))
|
||||||
//.sort((a,b)=>getAlarmMinutes(a)-getAlarmMinutes(b))
|
.sort((a,b)=>getAlarmOrder(a)-getAlarmOrder(b))
|
||||||
.map((a, i)=>({
|
.map((a, i)=>({
|
||||||
name: null,
|
name: null,
|
||||||
get: () => ({ text: getAlarmText(a), img: getAlarmIcon(a),
|
get: () => ({ text: getAlarmText(a), img: getAlarmIcon(a),
|
||||||
|
|
Loading…
Reference in New Issue