add setting to disable vibration

pull/2825/head
kevdliu 2023-06-14 15:44:27 -04:00
parent 4ebe589aa1
commit e1330880f2
10 changed files with 49 additions and 11 deletions

View File

@ -1,2 +1,3 @@
0.01: New app!
0.02: Handle files potentially not existing
0.03: Add setting to disable vibration

View File

@ -15,6 +15,8 @@ Swiping up and down will scroll. Swiping from the left, using the back button, o
* Show clocks / Show launcher: Whether clock and launcher apps are displayed in the UI to be launched. The default is no.
* Disable vibration: Whether vibration is disabled in the launcher. The default is no.
* Hidden apps: Displays the list of installed apps, enabling them to be manually hidden. (Or unhidden, if hidden from here.) This may be convenient for apps that you have some other shortcut to access, or apps that are only shortcuts to an infrequently used settings menu. By default, no apps are hidden.
* Display:

View File

@ -133,12 +133,12 @@
var entry = grid_1[x][y];
switch (entry.type) {
case "app":
Bangle.buzz();
buzz_1();
var infoFile = storage_1.readJSON(entry.id + '.info', false);
load(infoFile.src);
break;
case "folder":
Bangle.buzz();
buzz_1();
resetTimeout_1();
page_1 = 0;
folderPath_1.push(entry.id);
@ -160,7 +160,7 @@
else if (ud == 1) {
resetTimeout_1();
if (page_1 == 0) {
Bangle.buzz(200);
buzz_1(200);
return;
}
else
@ -169,7 +169,7 @@
else if (ud == -1) {
resetTimeout_1();
if (page_1 == nPages_1 - 1) {
Bangle.buzz(200);
buzz_1(200);
return;
}
else
@ -178,7 +178,7 @@
render_1();
};
var onBackButton_1 = function () {
Bangle.buzz();
buzz_1();
if (folderPath_1.length == 0)
Bangle.showClock();
else {
@ -189,6 +189,13 @@
render_1();
}
};
var buzz_1 = function (length, strength) {
if (length === void 0) { length = undefined; }
if (strength === void 0) { strength = undefined; }
if (!config_1.disableVibration) {
Bangle.buzz(length, strength);
}
};
Bangle.loadWidgets();
Bangle.drawWidgets();
Bangle.setUI({

View File

@ -185,12 +185,12 @@
let entry: GridEntry = grid[x]![y]!;
switch (entry.type) {
case "app":
Bangle.buzz();
buzz();
let infoFile = storage.readJSON(entry.id + '.info', false) as AppInfo;
load(infoFile.src);
break;
case "folder":
Bangle.buzz();
buzz();
resetTimeout();
page = 0;
folderPath.push(entry.id);
@ -221,13 +221,13 @@
} else if (ud == 1) {
resetTimeout();
if (page == 0) {
Bangle.buzz(200);
buzz(200);
return;
} else page--;
} else if (ud == -1) {
resetTimeout();
if (page == nPages - 1) {
Bangle.buzz(200);
buzz(200);
return;
} else page++;
}
@ -240,7 +240,7 @@
* Go back up a level. If already at the root folder, exit the launcher
*/
let onBackButton = () => {
Bangle.buzz();
buzz();
if (folderPath.length == 0)
Bangle.showClock();
else {
@ -252,6 +252,15 @@
}
}
/**
* Vibrate the watch if vibration is enabled
*/
let buzz = (length: number | undefined = undefined, strength: number | undefined = undefined) => {
if (!config.disableVibration) {
Bangle.buzz(length, strength);
}
}
Bangle.loadWidgets();
Bangle.drawWidgets();

View File

@ -3,6 +3,7 @@ var SETTINGS_FILE = "folderlaunch.json";
var DEFAULT_CONFIG = {
showClocks: false,
showLaunchers: false,
disableVibration: false,
hidden: [],
display: {
rows: 2,

View File

@ -5,6 +5,7 @@ const SETTINGS_FILE: string = "folderlaunch.json";
const DEFAULT_CONFIG: Config = {
showClocks: false,
showLaunchers: false,
disableVibration: false,
hidden: [],
display: {
rows: 2,

View File

@ -1,7 +1,7 @@
{
"id": "folderlaunch",
"name": "Folder launcher",
"version": "0.02",
"version": "0.03",
"description": "Launcher that allows you to put your apps into folders",
"icon": "icon.png",
"type": "launch",

View File

@ -195,6 +195,14 @@
changed = true;
}
},
'Disable vibration': {
value: !!config.disableVibration,
format: function (value) { return (value ? 'Yes' : 'No'); },
onchange: function (value) {
config.disableVibration = value;
changed = true;
}
},
'Hidden apps': hiddenAppsMenu,
'Display': function () {
E.showMenu({

View File

@ -211,6 +211,14 @@
changed = true;
}
},
'Disable vibration': {
value: !!config.disableVibration,
format: (value: boolean) => (value ? 'Yes' : 'No'),
onchange: (value: boolean) => {
config.disableVibration = value;
changed = true;
}
},
'Hidden apps': hiddenAppsMenu,
'Display': () => {
E.showMenu({

View File

@ -10,6 +10,7 @@ type FolderList = Array<string>;
type Config = {
showClocks: boolean, // Whether clocks are shown
showLaunchers: boolean, // Whether launchers are shown
disableVibration: boolean, // Whether vibration is disabled
hidden: Array<String>, // IDs of apps to explicitly hide
display: {
rows: number, // Display an X by X grid of apps