Minor changes

pull/2545/head
David Peer 2023-01-30 17:56:24 +01:00
parent bad6569d42
commit 2e27562c34
5 changed files with 33 additions and 10 deletions

View File

@ -1,2 +1,2 @@
0.01: New app!
0.02: Added settings for different styles.
0.02: Added settings to show/hide widgets and settings for different styles.

View File

@ -14,6 +14,10 @@ Here you can see an example of a locked bangle with a low battery:
![](screenshot_3.png)
## Settings
- Screen: Normal (widgets shown), Full (widgets are hidden).
- Theme: Select your custom theme, independent of system settings.
## Creator
- [David Peer](https://github.com/peerdavid).

View File

@ -10,7 +10,8 @@ const storage = require('Storage');
const SETTINGS_FILE = "happyclk.setting.json";
let settings = {
color: "Dark"
color: "Dark",
screen: "Full"
};
let saved_settings = storage.readJSON(SETTINGS_FILE, 1) || settings;
@ -174,6 +175,8 @@ let drawSmile = function(isLocked){
}
let drawEyeBrow = function(){
if(settings.screen != "Full") return;
g.setColor(colors.fg);
var w = 6;
for(var i = 0; i < w; i++){
@ -183,6 +186,15 @@ let drawEyeBrow = function(){
}
let drawWidgets = function(){
if (settings.screen == "Full") {
require('widget_utils').hide();
} else {
Bangle.drawWidgets();
}
}
let draw = function(){
// Queue draw in one minute
@ -199,6 +211,8 @@ let drawHelper = function(isLocked){
drawEyes();
drawEyeBrow();
drawSmile(isLocked);
drawWidgets();
}
@ -237,12 +251,6 @@ let queueDraw = function() {
// Show launcher when middle button pressed
Bangle.setUI("clock");
Bangle.loadWidgets();
/*
* we are not drawing the widgets as we are taking over the whole screen
* so we will blank out the draw() functions of each widget and change the
* area to the top bar doesn't get cleared.
*/
require('widget_utils').hide();
// Clear the screen once, at startup and draw clock
g.setTheme({bg:colors.bg,fg:colors.fg,dark:false});

View File

@ -4,7 +4,8 @@
// initialize with default settings...
const storage = require('Storage')
let settings = {
color: "Dark"
color: "Dark",
screen: "Full"
};
let saved_settings = storage.readJSON(SETTINGS_FILE, 1) || settings;
for (const key in saved_settings) {
@ -16,9 +17,19 @@
}
var colorOptions = ["Dark", "Black", "White", "Blue", "Green", "Red", "Purple", "Yellow"];
var screenOptions = ["Normal", "Full"];
E.showMenu({
'': { 'title': 'Happy Clock' },
'< Back': back,
'Screen': {
value: 0 | screenOptions.indexOf(settings.screen),
min: 0, max: screenOptions.length-1,
format: v => screenOptions[v],
onchange: v => {
settings.screen = screenOptions[v];
save();
},
},
'Theme': {
value: 0 | colorOptions.indexOf(settings.color),
min: 0, max: colorOptions.length-1,
@ -27,6 +38,6 @@
settings.color = colorOptions[v];
save();
},
}
},
});
})

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB