Merge pull request #3485 from thyttan/spotrem

spotrem: refactor to handle ui all inside setUI
pull/3711/merge
thyttan 2025-01-29 23:07:37 +01:00 committed by GitHub
commit c74c99a6c3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 12 deletions

View File

@ -11,3 +11,4 @@ when fastloading.
0.10: Some refactoring to shorten the code. 0.10: Some refactoring to shorten the code.
0.11: Further refactoring to shorten the code. Fixed search and play that was broken in v0.10. 0.11: Further refactoring to shorten the code. Fixed search and play that was broken in v0.10.
0.12: Fix some warnings from the linter. 0.12: Fix some warnings from the linter.
0.13: Move ui-handlers inside setUI-call.

View File

@ -14,7 +14,6 @@ let gfx = function() {
widgetUtils.hide(); widgetUtils.hide();
R = Bangle.appRect; R = Bangle.appRect;
const MARIGIN = 8; const MARIGIN = 8;
// g.drawString(str, x, y, solid)
g.clearRect(R); g.clearRect(R);
g.reset(); g.reset();
@ -100,23 +99,17 @@ let swipeHandler = function(LR, _) {
// Navigation input on the main layout // Navigation input on the main layout
let setUI = function() { let setUI = function() {
// Bangle.setUI code from rigrig's smessages app for volume control: https://git.tubul.net/rigrig/BangleApps/src/branch/personal/apps/smessages/app.js
Bangle.setUI( Bangle.setUI(
{mode : "updown", {mode : "updown",
remove : ()=>{ touch: touchHandler,
Bangle.removeListener("touch", touchHandler); swipe: swipeHandler,
Bangle.removeListener("swipe", swipeHandler); btn: ()=>load(),
clearWatch(buttonHandler); remove : ()=>widgetUtils.show(),
widgetUtils.show();
}
}, },
ud => { ud => {
if (ud) Bangle.musicControl(ud>0 ? "volumedown" : "volumeup"); if (ud) Bangle.musicControl(ud>0 ? "volumedown" : "volumeup");
} }
); );
Bangle.on("touch", touchHandler);
Bangle.on("swipe", swipeHandler);
let buttonHandler = setWatch(()=>{load();}, BTN, {edge:'falling'});
}; };
// Get back to the main layout // Get back to the main layout

View File

@ -1,7 +1,7 @@
{ {
"id": "spotrem", "id": "spotrem",
"name": "Remote for Spotify", "name": "Remote for Spotify",
"version": "0.12", "version": "0.13",
"description": "Control spotify on your android device.", "description": "Control spotify on your android device.",
"readme": "README.md", "readme": "README.md",
"type": "app", "type": "app",