Merge pull request #1718 from alessandrococco/launcher-fullscreen

[Launcher] Fullscreen mode
pull/1723/head
Gordon Williams 2022-04-20 15:25:30 +01:00 committed by GitHub
commit bbeea86eae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 9 deletions

View File

@ -12,3 +12,4 @@
0.11: Merge Bangle.js 1 and 2 launchers, again
0.12: Add an option to hide clocks from the app list (fix #1015)
Add /*LANG*/ tags for internationalisation
0.13: Add fullscreen mode

View File

@ -2,7 +2,10 @@ var s = require("Storage");
var scaleval = 1;
var vectorval = 20;
var font = g.getFonts().includes("12x20") ? "12x20" : "6x8:2";
let settings = Object.assign({ showClocks: true }, s.readJSON("launch.json", true) || {});
let settings = Object.assign({
showClocks: true,
fullscreen: false
}, s.readJSON("launch.json", true) || {});
if ("vectorsize" in settings) {
vectorval = parseInt(settings.vectorsize);
@ -44,8 +47,11 @@ function drawApp(i, r) {
}
g.clear();
Bangle.loadWidgets();
Bangle.drawWidgets();
if (!settings.fullscreen) {
Bangle.loadWidgets();
Bangle.drawWidgets();
}
E.showScroller({
h : 64*scaleval, c : apps.length,

View File

@ -2,7 +2,7 @@
"id": "launch",
"name": "Launcher",
"shortName": "Launcher",
"version": "0.12",
"version": "0.13",
"description": "This is needed to display a menu allowing you to choose your own applications. You can replace this with a customised launcher.",
"icon": "app.png",
"type": "launch",

View File

@ -1,6 +1,9 @@
// make sure to enclose the function in parentheses
(function(back) {
let settings = Object.assign({ showClocks: true }, require("Storage").readJSON("launch.json", true) || {});
let settings = Object.assign({
showClocks: true,
fullscreen: false
}, require("Storage").readJSON("launch.json", true) || {});
let fonts = g.getFonts();
function save(key, value) {
@ -8,7 +11,7 @@
require("Storage").write("launch.json",settings);
}
const appMenu = {
"": {"title": /*LANG*/"Launcher Settings"},
"": { "title": /*LANG*/"Launcher" },
/*LANG*/"< Back": back,
/*LANG*/"Font": {
value: fonts.includes(settings.font)? fonts.indexOf(settings.font) : fonts.indexOf("12x20"),
@ -16,15 +19,20 @@
onchange: (m) => {save("font", fonts[m])},
format: v => fonts[v]
},
/*LANG*/"Vector font size": {
/*LANG*/"Vector Font Size": {
value: settings.vectorsize || 10,
min:10, max: 20,step:1,wrap:true,
onchange: (m) => {save("vectorsize", m)}
},
/*LANG*/"Show clocks": {
/*LANG*/"Show Clocks": {
value: settings.showClocks == true,
format: v => v ? /*LANG*/"Yes" : /*LANG*/"No",
onchange: (m) => {save("showClocks", m)}
onchange: (m) => { save("showClocks", m) }
},
/*LANG*/"Fullscreen": {
value: settings.fullscreen == true,
format: v => v ? /*LANG*/"Yes" : /*LANG*/"No",
onchange: (m) => { save("fullscreen", m) }
}
};
E.showMenu(appMenu);