Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spotrem: refactor to handle ui all inside setUI #3485

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions apps/spotrem/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ let backToMenu = false;
let isPaused = true;
let dark = g.theme.dark; // bool

let marigin, x, y, len, playPause;

// The main layout of the app
let gfx = function() {
widgetUtils.hide();
Expand Down Expand Up @@ -100,23 +102,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
Loading