Skip to content

Commit

Permalink
spotrem: fix lint warnings no-undef
Browse files Browse the repository at this point in the history
  • Loading branch information
thyttan committed Nov 7, 2024
1 parent c217a4f commit 163df7b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 19 deletions.
8 changes: 3 additions & 5 deletions apps/spotrem/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
0.07: Remove just the specific listeners to not interfere with Quick Launch
when fastloading.
0.08: Issue newline before GB commands (solves issue with console.log and ignored commands)
0.09: Don't send the gadgetbridge wake command twice. Once should do since we
issue newline before GB commands.
0.09: Don't send the gadgetbridge wake command twice. Once should do since we issue newline before GB commands.
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.
26 changes: 13 additions & 13 deletions apps/spotrem/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,46 +13,46 @@ let dark = g.theme.dark; // bool
let gfx = function() {
widgetUtils.hide();
R = Bangle.appRect;
marigin = 8;
const MARIGIN = 8;
// g.drawString(str, x, y, solid)
g.clearRect(R);
g.reset();

if (dark) {g.setColor(0x07E0);} else {g.setColor(0x03E0);} // Green on dark theme, DarkGreen on light theme.
g.setFont("4x6:2");
g.setFontAlign(1, 0, 0);
g.drawString("->", R.x2 - marigin, R.y + R.h/2);
g.drawString("->", R.x2 - MARIGIN, R.y + R.h/2);

g.setFontAlign(-1, 0, 0);
g.drawString("<-", R.x + marigin, R.y + R.h/2);
g.drawString("<-", R.x + MARIGIN, R.y + R.h/2);

g.setFontAlign(-1, 0, 1);
g.drawString("<-", R.x + R.w/2, R.y + marigin);
g.drawString("<-", R.x + R.w/2, R.y + MARIGIN);

g.setFontAlign(1, 0, 1);
g.drawString("->", R.x + R.w/2, R.y2 - marigin);
g.drawString("->", R.x + R.w/2, R.y2 - MARIGIN);

g.setFontAlign(0, 0, 0);
g.drawString("Play\nPause", R.x + R.w/2, R.y + R.h/2);

g.setFontAlign(-1, -1, 0);
g.drawString("Menu", R.x + 2*marigin, R.y + 2*marigin);
g.drawString("Menu", R.x + 2*MARIGIN, R.y + 2*MARIGIN);

g.setFontAlign(-1, 1, 0);
g.drawString("Wake", R.x + 2*marigin, R.y + R.h - 2*marigin);
g.drawString("Wake", R.x + 2*MARIGIN, R.y + R.h - 2*MARIGIN);

g.setFontAlign(1, -1, 0);
g.drawString("Srch", R.x + R.w - 2*marigin, R.y + 2*marigin);
g.drawString("Srch", R.x + R.w - 2*MARIGIN, R.y + 2*MARIGIN);

g.setFontAlign(1, 1, 0);
g.drawString("Saved", R.x + R.w - 2*marigin, R.y + R.h - 2*marigin);
g.drawString("Saved", R.x + R.w - 2*MARIGIN, R.y + R.h - 2*MARIGIN);
};

// Touch handler for main layout
let touchHandler = function(_, xy) {
x = xy.x;
y = xy.y;
len = (R.w<R.h+1)?(R.w/3):(R.h/3);
let x = xy.x;
let y = xy.y;
let len = (R.w<R.h+1)?(R.w/3):(R.h/3);

// doing a<b+1 seemed faster than a<=b, also using a>b-1 instead of a>b.
if ((R.x-1<x && x<R.x+len) && (R.y-1<y && y<R.y+len)) {
Expand Down Expand Up @@ -82,7 +82,7 @@ let touchHandler = function(_, xy) {
spotifyWidget("NEXT");
} else if ((R.x-1<x && x<R.x2+1) && (R.y-1<y && y<R.y2+1)){
//play/pause
playPause = isPaused?"play":"pause";
let playPause = isPaused?"play":"pause";
Bangle.musicControl(playPause);
isPaused = !isPaused;
}
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.11",
"version": "0.12",
"description": "Control spotify on your android device.",
"readme": "README.md",
"type": "app",
Expand Down

0 comments on commit 163df7b

Please sign in to comment.