Skip to content

Commit

Permalink
spotrem: refactor to handle ui all inside setUI
Browse files Browse the repository at this point in the history
and fix lint warnings
  • Loading branch information
thyttan committed Jan 22, 2025
1 parent a603d96 commit 1251f26
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
1 change: 1 addition & 0 deletions apps/spotrem/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ when fastloading.
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.12: Fix some warnings from the linter.
0.13: Move ui-handlers inside setUI-call.
15 changes: 4 additions & 11 deletions apps/spotrem/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ let gfx = function() {
widgetUtils.hide();
R = Bangle.appRect;
const MARIGIN = 8;
// g.drawString(str, x, y, solid)
g.clearRect(R);
g.reset();

Expand Down Expand Up @@ -100,23 +99,17 @@ let swipeHandler = function(LR, _) {

// Navigation input on the main layout
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(
{mode : "updown",
remove : ()=>{
Bangle.removeListener("touch", touchHandler);
Bangle.removeListener("swipe", swipeHandler);
clearWatch(buttonHandler);
widgetUtils.show();
}
touch: touchHandler,
swipe: swipeHandler,
btn: ()=>load(),
remove : ()=>widgetUtils.show(),
},
ud => {
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
Expand Down
2 changes: 1 addition & 1 deletion apps/spotrem/metadata.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "spotrem",
"name": "Remote for Spotify",
"version": "0.12",
"version": "0.13",
"description": "Control spotify on your android device.",
"readme": "README.md",
"type": "app",
Expand Down

0 comments on commit 1251f26

Please sign in to comment.