Skip to content

Commit

Permalink
Convert Yes/No On/Off in settings to checkboxes, add /*LANG*/ to some…
Browse files Browse the repository at this point in the history
… more text strings
  • Loading branch information
gfwilliams committed Feb 23, 2023
1 parent 8bc9c5d commit 0ba8cef
Show file tree
Hide file tree
Showing 56 changed files with 106 additions and 136 deletions.
1 change: 1 addition & 0 deletions apps/accellog/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
0.03: Exit as first menu option, dont show decimal places for seconds
0.04: Localisation, change Exit->Back to allow back-arrow to appear on 2v13 firmware
0.05: Add max G values during recording, record actual G values and magnitude to CSV
0.06: Convert Yes/No On/Off in settings to checkboxes
3 changes: 1 addition & 2 deletions apps/accellog/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ function showMenu() {
viewLogs();
},
/*LANG*/"Log raw data" : {
value : logRawData,
format : v => v?/*LANG*/"Yes":/*LANG*/"No",
value : !!logRawData,
onchange : v => { logRawData=v; }
},
};
Expand Down
2 changes: 1 addition & 1 deletion apps/accellog/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "accellog",
"name": "Acceleration Logger",
"shortName": "Accel Log",
"version": "0.05",
"version": "0.06",
"description": "Logs XYZ acceleration data to a CSV file that can be downloaded to your PC",
"icon": "app.png",
"tags": "outdoor",
Expand Down
2 changes: 1 addition & 1 deletion apps/android/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
var mainmenu = {
"" : { "title" : "Android" },
"< Back" : back,
/*LANG*/"Connected" : { value : NRF.getSecurityStatus().connected?"Yes":"No" },
/*LANG*/"Connected" : { value : NRF.getSecurityStatus().connected?/*LANG*/"Yes":/*LANG*/"No" },
/*LANG*/"Find Phone" : () => E.showMenu({
"" : { "title" : /*LANG*/"Find Phone" },
"< Back" : ()=>E.showMenu(mainmenu),
Expand Down
2 changes: 1 addition & 1 deletion apps/bthrm/bthrm.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ function draw(){
if (!isNaN(bt.battery)) layout.btBattery.label = bt.battery + "%";
if (bt.rr) layout.btRR.label = bt.rr.join(",");
if (!isNaN(bt.location)) layout.btLocation.label = BODY_LOCS[bt.location];
if (bt.contact !== undefined) layout.btContact.label = bt.contact ? "Yes":"No";
if (bt.contact !== undefined) layout.btContact.label = bt.contact ? /*LANG*/"Yes":/*LANG*/"No";
if (!isNaN(bt.energy)) layout.btEnergy.label = bt.energy.toFixed(0) + "kJ";
} else {
layout.bt.label = "--";
Expand Down
1 change: 1 addition & 0 deletions apps/clockcal/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
0.04: Use default Bangle formatter for booleans
0.05: Improved colors (connected vs disconnected)
0.06: Tell clock widgets to hide.
0.07: Convert Yes/No On/Off in settings to checkboxes
2 changes: 1 addition & 1 deletion apps/clockcal/metadata.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "clockcal",
"name": "Clock & Calendar",
"version": "0.06",
"version": "0.07",
"description": "Clock with Calendar",
"readme":"README.md",
"icon": "app.png",
Expand Down
19 changes: 6 additions & 13 deletions apps/clockcal/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

actions = ["[ignore]","[calend.]","[AI:music]","[AI:messg]"];
require("Storage").list(RegExp(".app.js")).forEach(element => actions.push(element.replace(".app.js","")));

function writeSettings() {
require('Storage').writeJSON(FILE, settings);
}
Expand Down Expand Up @@ -106,18 +106,11 @@
writeSettings();
}
},
'Load deafauls?': {
value: 0,
min: 0, max: 1,
format: v => ["No", "Yes"][v],
onchange: v => {
if (v == 1) {
settings = defaults;
writeSettings();
load();
}
}
},
'Load defaults': () => {
settings = defaults;
writeSettings();
load();
}
};
// Show the menu
E.showMenu(menu);
Expand Down
1 change: 1 addition & 0 deletions apps/cscsensor/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
0.06: Now read wheel rev as well as cadence sensor
Improve connection code
0.07: Make Bangle.js 2 compatible
0.08: Convert Yes/No On/Off in settings to checkboxes
2 changes: 1 addition & 1 deletion apps/cscsensor/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "cscsensor",
"name": "Cycling speed sensor",
"shortName": "CSCSensor",
"version": "0.07",
"version": "0.08",
"description": "Read BLE enabled cycling speed and cadence sensor and display readings on watch",
"icon": "icons8-cycling-48.png",
"tags": "outdoors,exercise,ble,bluetooth",
Expand Down
8 changes: 4 additions & 4 deletions apps/cscsensor/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@
}
}
const menu = {
'': { 'title': 'Cycle speed sensor' },
'': { 'title': /*LANG*/'Cycle speed sensor' },
'< Back': back,
'Wheel circ.(mm)': {
/*LANG*/'Wheel circ.(mm)': {
value: s.wheelcirc,
min: 800,
max: 2400,
step: 5,
onchange: save('wheelcirc'),
},
'Reset total distance': function() {
E.showPrompt("Zero total distance?", {buttons: {"No":false, "Yes":true}}).then(function(v) {
/*LANG*/'Reset total distance': function() {
E.showPrompt(/*LANG*/"Zero total distance?", {buttons: {/*LANG*/"No":false, /*LANG*/"Yes":true}}).then(function(v) {
if (v) {
s['totaldist'] = 0;
storage.write(SETTINGS_FILE, s);
Expand Down
1 change: 1 addition & 0 deletions apps/f9lander/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
0.01: New App!
0.02: Add lightning
0.03: Convert Yes/No On/Off in settings to checkboxes
2 changes: 1 addition & 1 deletion apps/f9lander/metadata.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{ "id": "f9lander",
"name": "Falcon9 Lander",
"shortName":"F9lander",
"version":"0.02",
"version":"0.03",
"description": "Land a rocket booster",
"icon": "f9lander.png",
"screenshots" : [ { "url":"f9lander_screenshot1.png" }, { "url":"f9lander_screenshot2.png" }, { "url":"f9lander_screenshot3.png" }],
Expand Down
4 changes: 1 addition & 3 deletions apps/f9lander/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
/**
* @param {function} back Use back() to return to settings menu
*/
const boolFormat = v => v ? /*LANG*/"On" : /*LANG*/"Off";
(function(back) {
const SETTINGS_FILE = 'f9settings.json'
// initialize with default settings...
Expand All @@ -27,8 +26,7 @@ const boolFormat = v => v ? /*LANG*/"On" : /*LANG*/"Off";
'': { 'title': 'OpenWind' },
'< Back': back,
'Lightning': {
value: settings.lightning,
format: boolFormat,
value: !!settings.lightning,
onchange: save('lightning'),
}
}
Expand Down
2 changes: 1 addition & 1 deletion apps/fileman/fileman.app.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var m;
var files;

function delete_file(fn) {
E.showPrompt("Delete\n"+fn+"?", {buttons: {"No":false, "Yes":true}}).then(function(v) {
E.showPrompt(/*LANG*/"Delete\n"+fn+"?", {buttons: {/*LANG*/"No":false, /*LANG*/"Yes":true}}).then(function(v) {
if (v) {
if (fn.charCodeAt(fn.length-1)==1) {
var fh = STOR.open(fn.substr(0, fn.length-1), "r");
Expand Down
14 changes: 7 additions & 7 deletions apps/gbridge/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,22 @@
var mainmenu = {
"" : { "title" : "Gadgetbridge" },
"< Back" : back,
"Connected" : { value : NRF.getSecurityStatus().connected?"Yes":"No" },
"Show Icon" : {
/*LANG*/"Connected" : { value : NRF.getSecurityStatus().connected?/*LANG*/"Yes":/*LANG*/"No" },
/*LANG*/"Show Icon" : {
value: settings().showIcon,
onchange: setIcon
},
"Find Phone" : function() { E.showMenu(findPhone); },
"Record HRM" : {
/*LANG*/"Find Phone" : function() { E.showMenu(findPhone); },
/*LANG*/"Record HRM" : {
value: !!settings().hrm,
onchange: v => updateSetting('hrm', v)
}
}
};

var findPhone = {
"" : { "title" : "-- Find Phone --" },
"On" : _=>gb({t:"findPhone",n:true}),
"Off" : _=>gb({t:"findPhone",n:false}),
/*LANG*/"On" : _=>gb({t:"findPhone",n:true}),
/*LANG*/"Off" : _=>gb({t:"findPhone",n:false}),
"< Back" : function() { E.showMenu(mainmenu); },
};

Expand Down
2 changes: 2 additions & 0 deletions apps/gipy/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,5 @@
* Display current and next segment in red so that you know where to go.
* Avoid angles flickering at low speed at the cost of less refresh.
* Splash screen while waiting for gps signal.

0.17: Convert Yes/No On/Off in settings to checkboxes
2 changes: 1 addition & 1 deletion apps/gipy/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "gipy",
"name": "Gipy",
"shortName": "Gipy",
"version": "0.16",
"version": "0.17",
"description": "Follow gpx files using the gps. Don't get lost in your bike trips and hikes.",
"allow_emulator":false,
"icon": "gipy.png",
Expand Down
3 changes: 1 addition & 2 deletions apps/gipy/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
"< Back": () => back(),
"keep gps alive": {
value: !!settings.keep_gps_alive, // !! converts undefined to false
format: (v) => (v ? "Yes" : "No"),
onchange: (v) => {
onchange: v => {
settings.keep_gps_alive = v;
writeSettings();
},
Expand Down
4 changes: 2 additions & 2 deletions apps/homework/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ var mainMenu = {
"Reset Homework": function() {
E.showPrompt("Are you sure you want to delete homework.txt?", {
buttons: {
"No": false,
"Yes": true
/*LANG*/"No": false,
/*LANG*/"Yes": true
}
}).then(function(v) {
if (v) {
Expand Down
10 changes: 5 additions & 5 deletions apps/info/info.app.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ var screens = [
name: "Hardware",
items: [
{name: "Battery", fun: () => E.getBattery() + "%"},
{name: "Charge?", fun: () => Bangle.isCharging() ? "Yes" : "No"},
{name: "Charge?", fun: () => Bangle.isCharging() ? /*LANG*/"Yes" : /*LANG*/"No"},
{name: "TempInt.", fun: () => locale.temp(parseInt(E.getTemperature()))},
{name: "Bluetooth", fun: () => NRF.getSecurityStatus().connected ? "Conn" : "NoConn"},
{name: "GPS", fun: () => Bangle.isGPSOn() ? "On" : "Off"},
{name: "Compass", fun: () => Bangle.isCompassOn() ? "On" : "Off"},
{name: "Bluetooth", fun: () => NRF.getSecurityStatus().connected ? /*LANG*/"Conn" : /*LANG*/"NoConn"},
{name: "GPS", fun: () => Bangle.isGPSOn() ? /*LANG*/"On" : /*LANG*/"Off"},
{name: "Compass", fun: () => Bangle.isCompassOn() ? /*LANG*/"On" : /*LANG*/"Off"},
]
},
{
Expand Down Expand Up @@ -160,4 +160,4 @@ Bangle.on('lock', function(isLocked) {
});

Bangle.loadWidgets();
Bangle.drawWidgets();
Bangle.drawWidgets();
1 change: 1 addition & 0 deletions apps/kbtouch/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
0.01: New App!
0.02: Introduced settings to customize the layout and functionality of the keyboard.
0.03: Convert Yes/No On/Off in settings to checkboxes
2 changes: 1 addition & 1 deletion apps/kbtouch/metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{ "id": "kbtouch",
"name": "Touch keyboard",
"version":"0.02",
"version":"0.03",
"description": "A library for text input via onscreen keyboard",
"icon": "app.png",
"type":"textinput",
Expand Down
28 changes: 10 additions & 18 deletions apps/kbtouch/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
if (settings.speedScaling===undefined) settings.speedScaling=24;
return settings;
}

function updateSetting(setting, value) {
let settings = require('Storage').readJSON("kbtouch.settings.json", true) || {};
settings[setting] = value;
require('Storage').writeJSON("kbtouch.settings.json", settings);
}

var mainmenu = {
"" : { "title" : /*LANG*/"Touch Keyboard" },
"< Back" : back,
Expand All @@ -25,22 +25,16 @@
onchange: v => updateSetting("textSize", v)
},
/*LANG*/'Offset keyboard': {
value: settings().offsetKeyboard,
min: 0, max: 1,
format: v => [/*LANG*/"No",/*LANG*/"Yes"][v],
onchange: v => updateSetting("offsetKeyboard", v)
value: !!settings().offsetKeyboard,
onchange: v => updateSetting("offsetKeyboard", v?1:0)
},
/*LANG*/'Loop around': {
value: settings().loopAround,
min: 0, max: 1,
format: v => [/*LANG*/"No",/*LANG*/"Yes"][v],
onchange: v => updateSetting("loopAround", v)
value: !!settings().loopAround,
onchange: v => updateSetting("loopAround", v?1:0)
},
/*LANG*/'One-to-one input and release to select': {
value: settings().oneToOne,
min: 0, max: 1,
format: v => [/*LANG*/"No",/*LANG*/"Yes"][v],
onchange: v => updateSetting("oneToOne", v)
value: !!settings().oneToOne,
onchange: v => updateSetting("oneToOne", v?1:0)
},
/*LANG*/'Speed scaling': {
value: settings().speedScaling,
Expand All @@ -49,10 +43,8 @@
onchange: v => updateSetting("speedScaling", v)
}
///*LANG*/'Release to select': {
// value: 1|settings().fontSize,
// min: 0, max: 1,
// format: v => [/*LANG*/"No",/*LANG*/"Yes"][v],
// onchange: v => updateSetting("releaseToSelect", v)
// value: !!(1|settings().fontSize),
// onchange: v => updateSetting("releaseToSelect", v?1:0)
//}
};
E.showMenu(mainmenu);
Expand Down
2 changes: 1 addition & 1 deletion apps/marioclock/marioclock-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ let lastTemp = 0;

const phone = {
get status() {
return NRF.getSecurityStatus().connected ? "Yes" : "No";
return NRF.getSecurityStatus().connected ? /*LANG*/"Yes" : /*LANG*/"No";
},
message: null,
messageTimeout: null,
Expand Down
3 changes: 2 additions & 1 deletion apps/neonx/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
0.03: Optional show lock status via color
0.04: Ensure that widgets are always hidden in fullscreen mode
0.05: Better lock/unlock animation
0.06: Use widget_utils.
0.06: Use widget_utils
0.07: Convert Yes/No On/Off in settings to checkboxes
2 changes: 1 addition & 1 deletion apps/neonx/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "neonx",
"name": "Neon X & IO X Clock",
"shortName": "Neon X Clock",
"version": "0.06",
"version": "0.07",
"description": "Pebble Neon X & Neon IO X for Bangle.js",
"icon": "neonx.png",
"type": "clock",
Expand Down
26 changes: 10 additions & 16 deletions apps/neonx/neonx.settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,9 @@
"" : { "title":"Neon X & IO"},
"< Back": back,
"Neon IO X": {
value: 0 | neonXSettings.io,
min: 0, max: 1,
format: v => v ? "On" : "Off",
value: !!neonXSettings.io,
onchange: v => {
neonXSettings.io = v;
neonXSettings.io = v?1:0;
updateSettings();
}
},
Expand All @@ -43,27 +41,23 @@
}
},
"Date on touch": {
value: 0 | neonXSettings.showDate,
min: 0, max: 1,
format: v => v ? "On" : "Off",
value: !!neonXSettings.showDate,
onchange: v => {
neonXSettings.showDate = v;
neonXSettings.showDate = v?1:0;
updateSettings();
}
},
'Fullscreen': {
value: false | neonXSettings.fullscreen,
format: () => (neonXSettings.fullscreen ? 'Yes' : 'No'),
onchange: () => {
neonXSettings.fullscreen = !neonXSettings.fullscreen;
value: !!neonXSettings.fullscreen,
onchange: v => {
neonXSettings.fullscreen = v;
updateSettings();
},
},
'Show lock': {
value: false | neonXSettings.showLock,
format: () => (neonXSettings.showLock ? 'Yes' : 'No'),
onchange: () => {
neonXSettings.showLock = !neonXSettings.showLock;
value: !!neonXSettings.showLock,
onchange: v => {
neonXSettings.showLock = v;
updateSettings();
},
},
Expand Down
Loading

0 comments on commit 0ba8cef

Please sign in to comment.