Simpler UI

master
David Peer 2022-02-23 20:10:09 +01:00
parent 254d69fce6
commit 4cb1cf2ba4
4 changed files with 73 additions and 108 deletions

View File

@ -1,6 +1 @@
0.01: New widget and app!
0.02: Setting to reset values, timer buzzes at 00:00 and not later (see readme)
0.03: Display only minutes:seconds when less than 1 hour left
0.04: Change to 7 segment font, move to top widget bar
Better auto-update behaviour, less RAM used
0.05: Fix error running app on new firmwares (fix #1140)
0.01: Release

View File

@ -1,41 +1,10 @@
# Chronometer Widget
# Simple Chronometer Widget
Chronometer (timer) that runs as a widget.
The advantage is, that you can still see your normal watchface and other widgets when the timer is running.
The widget is always active, but only shown when the timer is on.
Hours, minutes, seconds and timer status can be set with an app.
A fork of the awesome Chronometer Widget, but with a simple UI to set
a timer faster using only a tab events. Also very useful if combined
with the Pattern Launcher.
When there is less than one second left on the timer it buzzes.
# Contributors
Originally from [Purple-Tentacle](https://github.com/Purple-Tentacle)
The widget has been tested on Bangle 1 and Bangle 2
## Screenshots
![](screenshot.png)
## Features
* Using other apps does not interrupt the timer, no need to keep the widget open (BUT: there will be no buzz when the time is up, for that the widget has to be loaded)
* Target time is saved to a file and timer picks up again when widget is loaded again.
## Settings
There are no settings section in the settings app, timer can be set using an app.
* Reset values: Reset hours, minutes, seconds to 0; set timer on to false; write to settings file
* Hours: Set the hours for the timer
* Minutes: Set the minutes for the timer
* Seconds: Set the seconds for the timer
* Timer on: Starts the timer and displays the widget when set to 'On'. You have to leave the app to load the widget which starts the timer. The widget is always there, but only visible when timer is on.
## Releases
* Official app loader: https://github.com/espruino/BangleApps/tree/master/apps/chronowid (https://banglejs.com/apps/)
* Forked app loader: https://github.com/Purple-Tentacle/BangleApps/tree/master/apps/chronowid (https://purple-tentacle.github.io/BangleApps/index.html#)
* Development: https://github.com/Purple-Tentacle/BangleAppsDev/tree/master/apps/chronowid
## Requests
If you have any feature requests, please write here: http://forum.espruino.com/conversations/345972/
Forked and adapted by [David Peer](https://github.com/peerdavid)

View File

@ -1,10 +1,15 @@
g.clear();
Bangle.loadWidgets();
Bangle.drawWidgets();
const storage = require('Storage');
let settingsChronowid;
const screenWidth = g.getWidth();
const screenHeight = g.getHeight();
const screenHalfWidth = parseInt(screenWidth/2);
const screenHalfHeight = parseInt(screenHeight/2);
let interval = 0;
function updateSettings() {
var now = new Date();
const goal = new Date(now.getFullYear(), now.getMonth(), now.getDate(),
@ -33,61 +38,57 @@ E.on('kill', () => {
updateSettings();
});
function showMenu() {
const timerMenu = {
'': {
'title': 'Set timer'
},
'< Back' : ()=>{load();},
'Reset Values': function() {
settingsChronowid.hours = 0;
settingsChronowid.minutes = 0;
settingsChronowid.seconds = 0;
settingsChronowid.started = false;
updateSettings();
showMenu();
},
'Hours': {
value: settingsChronowid.hours,
min: 0,
max: 24,
step: 1,
onchange: v => {
settingsChronowid.hours = v;
updateSettings();
}
},
'Minutes': {
value: settingsChronowid.minutes,
min: 0,
max: 59,
step: 1,
onchange: v => {
settingsChronowid.minutes = v;
updateSettings();
}
},
'Seconds': {
value: settingsChronowid.seconds,
min: 0,
max: 59,
step: 1,
onchange: v => {
settingsChronowid.seconds = v;
updateSettings();
}
},
'Timer on': {
value: settingsChronowid.started,
format: v => v ? "On" : "Off",
onchange: v => {
settingsChronowid.started = v;
updateSettings();
}
},
};
function draw(){
g.clear(1);
Bangle.drawWidgets();
return E.showMenu(timerMenu);
g.setColor(g.theme.fg);
g.setFont("Vector", 25).setFontAlign(0,-1);
g.setFontAlign(0, 0, 0);
g.drawString("T-" + settingsChronowid.minutes + " min.", screenHalfWidth, screenHalfHeight);
if(settingsChronowid.started){
g.setColor("#ff0000");
g.setFont("Vector", 16).setFontAlign(0,-1);
g.drawString("[started]", screenHalfWidth, screenHalfHeight+20);
}
}
showMenu();
Bangle.on('touch', function(btn, e){
var left = parseInt(g.getWidth() * 0.2);
var right = g.getWidth() - left;
var upper = 24 + parseInt(g.getHeight() * 0.2);
var lower = g.getHeight() - upper;
var isLeft = e.x < left;
var isRight = e.x > right;
var isUpper = e.y < upper;
var isLower = e.y > lower;
if(isRight){
print("right");
settingsChronowid.minutes += 1;
} else if(isLeft){
print("left");
settingsChronowid.minutes -= 1;
} else if(isUpper){
print("upper");
settingsChronowid.minutes += 5;
} else if(isLower){
print("lower");
settingsChronowid.minutes -= 5;
} else {
print("else");
settingsChronowid.started = !settingsChronowid.started;
}
settingsChronowid.minutes = Math.max(0, settingsChronowid.minutes);
updateSettings();
draw();
});
g.reset();
setWatch(_=>load(), BTN1);
Bangle.loadWidgets();
draw();

View File

@ -1,12 +1,12 @@
{
"id": "chronosimplewid",
"name": "Simple Chrono Widget",
"shortName": "Simple Chrono Widget",
"version": "0.05",
"description": "Fork from Chrono Widget with simpler UI.",
"name": "Simple Chrono",
"shortName": "Simple Chrono",
"version": "0.01",
"description": "Chrono Widget Fork. Implements a simpler UI.",
"icon": "app.png",
"tags": "tool,widget",
"supports": ["BANGLEJS2"],
"supports": ["BANGLEJS","BANGLEJS2"],
"screenshots": [{"url":"screenshot.png"}],
"readme": "README.md",
"storage": [