mirror of https://github.com/espruino/BangleApps
Fixed BW Clock
parent
1f1b8a20d5
commit
6a6690ae21
|
@ -22,3 +22,4 @@
|
||||||
0.22: Use the new clkinfo module for the menu.
|
0.22: Use the new clkinfo module for the menu.
|
||||||
0.23: Feedback of apps after run is now optional and decided by the corresponding clkinfo.
|
0.23: Feedback of apps after run is now optional and decided by the corresponding clkinfo.
|
||||||
0.24: Update clock_info to avoid a redraw
|
0.24: Update clock_info to avoid a redraw
|
||||||
|
0.25: ClockInfo Fix: Use .get instead of .show as .show is not implemented for weather etc.
|
||||||
|
|
|
@ -12,7 +12,6 @@ const clock_info = require("clock_info");
|
||||||
const SETTINGS_FILE = "bwclk.setting.json";
|
const SETTINGS_FILE = "bwclk.setting.json";
|
||||||
const W = g.getWidth();
|
const W = g.getWidth();
|
||||||
const H = g.getHeight();
|
const H = g.getHeight();
|
||||||
var lock_input = false;
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************
|
/************************************************
|
||||||
|
@ -123,27 +122,6 @@ if(settings.menuPosX >= menu.length || settings.menuPosY > menu[settings.menuPos
|
||||||
settings.menuPosY = 0;
|
settings.menuPosY = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set draw functions for each item
|
|
||||||
menu.forEach((menuItm, x) => {
|
|
||||||
menuItm.items.forEach((item, y) => {
|
|
||||||
function drawItem() {
|
|
||||||
// For the clock, we have a special case, as we don't wanna redraw
|
|
||||||
// immediately when something changes. Instead, we update data each minute
|
|
||||||
// to save some battery etc. Therefore, we hide (and disable the listener)
|
|
||||||
// immedeately after redraw...
|
|
||||||
item.hide();
|
|
||||||
|
|
||||||
// After drawing the item, we enable inputs again...
|
|
||||||
lock_input = false;
|
|
||||||
|
|
||||||
var info = item.get();
|
|
||||||
drawMenuItem(info.text, info.img);
|
|
||||||
}
|
|
||||||
|
|
||||||
item.on('redraw', drawItem);
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
function canRunMenuItem(){
|
function canRunMenuItem(){
|
||||||
if(settings.menuPosY == 0){
|
if(settings.menuPosY == 0){
|
||||||
|
@ -292,9 +270,8 @@ function drawMenuAndTime(){
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw item if needed
|
// Draw item if needed
|
||||||
lock_input = true;
|
var item = menuEntry.items[settings.menuPosY-1].get();
|
||||||
var item = menuEntry.items[settings.menuPosY-1];
|
drawMenuItem(item.text, item.img);
|
||||||
item.show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -388,10 +365,6 @@ Bangle.on('touch', function(btn, e){
|
||||||
var is_right = e.x > right && !is_upper && !is_lower;
|
var is_right = e.x > right && !is_upper && !is_lower;
|
||||||
var is_center = !is_upper && !is_lower && !is_left && !is_right;
|
var is_center = !is_upper && !is_lower && !is_left && !is_right;
|
||||||
|
|
||||||
if(lock_input){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(is_lower){
|
if(is_lower){
|
||||||
Bangle.buzz(40, 0.6);
|
Bangle.buzz(40, 0.6);
|
||||||
settings.menuPosY = (settings.menuPosY+1) % (menu[settings.menuPosX].items.length+1);
|
settings.menuPosY = (settings.menuPosY+1) % (menu[settings.menuPosX].items.length+1);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"id": "bwclk",
|
"id": "bwclk",
|
||||||
"name": "BW Clock",
|
"name": "BW Clock",
|
||||||
"version": "0.24",
|
"version": "0.25",
|
||||||
"description": "A very minimalistic clock to mainly show date and time.",
|
"description": "A very minimalistic clock to mainly show date and time.",
|
||||||
"readme": "README.md",
|
"readme": "README.md",
|
||||||
"icon": "app.png",
|
"icon": "app.png",
|
||||||
|
|
Loading…
Reference in New Issue