Setting: restructed menus as per forum discussion

pull/1120/head
hughbarney 2021-12-16 21:11:51 +00:00
parent d3ccc08209
commit aa365bc1de
3 changed files with 43 additions and 19 deletions

View File

@ -167,7 +167,7 @@
{
"id": "setting",
"name": "Settings",
"version": "0.37",
"version": "0.38",
"description": "A menu for setting up Bangle.js",
"icon": "settings.png",
"tags": "tool,system",

View File

@ -40,3 +40,4 @@
0.35: Change App/Widget settings to 'App Settings' so it fits on Bangle screen
0.36: Added 'Utils' menu with helpful utilities for restoring Bangle.js
0.37: Going into passkey menu now saves settings with passkey
0.38: Restructed menus as per forum discussion

View File

@ -61,6 +61,37 @@ if (!settings) resetSettings();
const boolFormat = v => v ? /*LANG*/"On" : /*LANG*/"Off";
function showMainMenu() {
const mainmenu = {
'': { 'title': 'Settings' },
'< Back': ()=>load(),
/*LANG*/'Apps': ()=>showAppSettingsMenu(),
/*LANG*/'Bluetooth': ()=>showBLEMenu(),
/*LANG*/'System': ()=>showSystemMenu(),
/*LANG*/'Alerts': ()=>showAlertsMenu(),
/*LANG*/'Utils': ()=>showUtilMenu(),
/*LANG*/'Turn Off': ()=>{ if (Bangle.softOff) Bangle.softOff(); else Bangle.off() }
};
return E.showMenu(mainmenu);
}
function showSystemMenu() {
const mainmenu = {
'': { 'title': 'System' },
'< Back': ()=>showMainMenu(),
/*LANG*/'Theme': ()=>showThemeMenu(),
/*LANG*/'LCD': ()=>showLCDMenu(),
/*LANG*/'Locale': ()=>showLocaleMenu(),
/*LANG*/'Select Clock': ()=>showClockMenu(),
/*LANG*/'Set Time': ()=>showSetTimeMenu()
};
return E.showMenu(mainmenu);
}
function showAlertsMenu() {
var beepMenuItem;
if (BANGLEJS2) {
beepMenuItem = {
@ -91,12 +122,9 @@ function showMainMenu() {
};
}
const mainmenu = {
'': { 'title': 'Settings' },
'< Back': ()=>load(),
/*LANG*/'App Settings': ()=>showAppSettingsMenu(),
/*LANG*/'BLE': ()=>showBLEMenu(),
'': { 'title': 'Alerts' },
'< Back': ()=>showMainMenu(),
/*LANG*/'Beep': beepMenuItem,
/*LANG*/'Vibration': {
value: settings.vibrate,
@ -119,23 +147,18 @@ function showMainMenu() {
updateOptions();
if ("qmsched" in WIDGETS) WIDGETS["qmsched"].draw();
},
},
/*LANG*/'Locale': ()=>showLocaleMenu(),
/*LANG*/'Select Clock': ()=>showClockMenu(),
/*LANG*/'Set Time': ()=>showSetTimeMenu(),
/*LANG*/'LCD': ()=>showLCDMenu(),
/*LANG*/'Theme': ()=>showThemeMenu(),
/*LANG*/'Utils': ()=>showUtilMenu(),
/*LANG*/'Turn Off': ()=>{ if (Bangle.softOff) Bangle.softOff(); else Bangle.off() },
}
};
return E.showMenu(mainmenu);
}
function showBLEMenu() {
var hidV = [false, "kbmedia", "kb", "joy"];
var hidN = ["Off", "Kbrd & Media", "Kbrd","Joystick"];
E.showMenu({
'': { 'title': 'Bluetooth' },
'< Back': ()=>showMainMenu(),
'Make Connectable': ()=>makeConnectable(),
'BLE': {
@ -190,7 +213,7 @@ function showThemeMenu() {
}
var m = E.showMenu({
'':{title:'Theme'},
'< Back': ()=>showMainMenu(),
'< Back': ()=>showSystemMenu(),
'Dark BW': ()=>{
upd({
fg:cl("#fff"), bg:cl("#000"),
@ -335,7 +358,7 @@ function showWhitelistMenu() {
function showLCDMenu() {
const lcdMenu = {
'': { 'title': 'LCD' },
'< Back': ()=>showMainMenu(),
'< Back': ()=>showSystemMenu(),
'LCD Brightness': {
value: settings.brightness,
min: 0.1,
@ -447,7 +470,7 @@ function showLCDMenu() {
function showLocaleMenu() {
const localemenu = {
'': { 'title': 'Locale' },
'< Back': ()=>showMainMenu(),
'< Back': ()=>showSystemMenu(),
'Time Zone': {
value: settings.timezone,
min: -11,
@ -551,7 +574,7 @@ function showClockMenu() {
'': {
'title': 'Select Clock',
},
'< Back': ()=>showMainMenu(),
'< Back': ()=>showSystemMenu(),
};
clockApps.forEach((app, index) => {
var label = app.name;
@ -578,7 +601,7 @@ function showSetTimeMenu() {
'': { 'title': 'Set Time' },
'< Back': function () {
setTime(d.getTime() / 1000);
showMainMenu();
showSystemMenu();
},
'Hour': {
value: d.getHours(),