Skip to content

Commit c74c99a

Browse files
authored
Merge pull request espruino#3485 from thyttan/spotrem
spotrem: refactor to handle ui all inside setUI
2 parents 9a30aa0 + 1251f26 commit c74c99a

File tree

3 files changed

+6
-12
lines changed

3 files changed

+6
-12
lines changed

apps/spotrem/ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ when fastloading.
1111
0.10: Some refactoring to shorten the code.
1212
0.11: Further refactoring to shorten the code. Fixed search and play that was broken in v0.10.
1313
0.12: Fix some warnings from the linter.
14+
0.13: Move ui-handlers inside setUI-call.

apps/spotrem/app.js

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ let gfx = function() {
1414
widgetUtils.hide();
1515
R = Bangle.appRect;
1616
const MARIGIN = 8;
17-
// g.drawString(str, x, y, solid)
1817
g.clearRect(R);
1918
g.reset();
2019

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

101100
// Navigation input on the main layout
102101
let setUI = function() {
103-
// Bangle.setUI code from rigrig's smessages app for volume control: https://git.tubul.net/rigrig/BangleApps/src/branch/personal/apps/smessages/app.js
104102
Bangle.setUI(
105103
{mode : "updown",
106-
remove : ()=>{
107-
Bangle.removeListener("touch", touchHandler);
108-
Bangle.removeListener("swipe", swipeHandler);
109-
clearWatch(buttonHandler);
110-
widgetUtils.show();
111-
}
104+
touch: touchHandler,
105+
swipe: swipeHandler,
106+
btn: ()=>load(),
107+
remove : ()=>widgetUtils.show(),
112108
},
113109
ud => {
114110
if (ud) Bangle.musicControl(ud>0 ? "volumedown" : "volumeup");
115111
}
116112
);
117-
Bangle.on("touch", touchHandler);
118-
Bangle.on("swipe", swipeHandler);
119-
let buttonHandler = setWatch(()=>{load();}, BTN, {edge:'falling'});
120113
};
121114

122115
// Get back to the main layout

apps/spotrem/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"id": "spotrem",
33
"name": "Remote for Spotify",
4-
"version": "0.12",
4+
"version": "0.13",
55
"description": "Control spotify on your android device.",
66
"readme": "README.md",
77
"type": "app",

0 commit comments

Comments
 (0)