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.01: New app!
0.02: Handle files potentially not existing 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. * 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. * 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: * Display:

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -195,6 +195,14 @@
changed = true; 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, 'Hidden apps': hiddenAppsMenu,
'Display': function () { 'Display': function () {
E.showMenu({ E.showMenu({

View File

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

View File

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