spotrem - compatibility with Fastload Utils

master
thyttan 2022-11-12 22:35:23 +01:00
parent b47725568c
commit b124bfade5
3 changed files with 87 additions and 76 deletions

View File

@ -3,3 +3,4 @@
0.03: change handling of intent extras. 0.03: change handling of intent extras.
0.04: New layout. 0.04: New layout.
0.05: Add widgets field. Tweak layout. 0.05: Add widgets field. Tweak layout.
0.06: Make compatible with Fastload Utils app.

View File

@ -1,21 +1,23 @@
{
/* /*
Bluetooth.println(JSON.stringify({t:"intent", action:"", flags:["flag1", "flag2",...], categories:["category1","category2",...], mimetype:"", data:"", package:"", class:"", target:"", extra:{someKey:"someValueOrString"}})); Bluetooth.println(JSON.stringify({t:"intent", action:"", flags:["flag1", "flag2",...], categories:["category1","category2",...], mimetype:"", data:"", package:"", class:"", target:"", extra:{someKey:"someValueOrString"}}));
*/ */
var R; let R;
var backToMenu = false; let widgetUtils = require("widget_utils");
var isPaused = true; let backToMenu = false;
var dark = g.theme.dark; // bool let isPaused = true;
let dark = g.theme.dark; // bool
// The main layout of the app // The main layout of the app
function gfx() { let gfx = function() {
//Bangle.drawWidgets(); widgetUtils.hide();
R = Bangle.appRect; R = Bangle.appRect;
marigin = 8; marigin = 8;
// g.drawString(str, x, y, solid) // g.drawString(str, x, y, solid)
g.clearRect(R); g.clearRect(R);
g.reset(); g.reset();
if (dark) {g.setColor(0x07E0);} else {g.setColor(0x03E0);} // Green on dark theme, DarkGreen on light theme. if (dark) {g.setColor(0x07E0);} else {g.setColor(0x03E0);} // Green on dark theme, DarkGreen on light theme.
g.setFont("4x6:2"); g.setFont("4x6:2");
g.setFontAlign(1, 0, 0); g.setFontAlign(1, 0, 0);
@ -44,10 +46,10 @@ function gfx() {
g.setFontAlign(1, 1, 0); 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 // Touch handler for main layout
function touchHandler(_, xy) { let touchHandler = function(_, xy) {
x = xy.x; x = xy.x;
y = xy.y; y = xy.y;
len = (R.w<R.h+1)?(R.w/3):(R.h/3); len = (R.w<R.h+1)?(R.w/3):(R.h/3);
@ -85,35 +87,41 @@ function touchHandler(_, xy) {
Bangle.musicControl(playPause); Bangle.musicControl(playPause);
isPaused = !isPaused; isPaused = !isPaused;
} }
} };
// Swipe handler for main layout, used to jump backward and forward within a podcast episode. // Swipe handler for main layout, used to jump backward and forward within a podcast episode.
function swipeHandler(LR, _) { let swipeHandler = function(LR, _) {
if (LR==-1) { if (LR==-1) {
spotifyWidget("NEXT"); spotifyWidget("NEXT");
} }
if (LR==1) { if (LR==1) {
spotifyWidget("PREVIOUS"); spotifyWidget("PREVIOUS");
} }
} };
// Navigation input on the main layout // Navigation input on the main layout
function setUI() { 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 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", back : load}, {mode : "updown",
ud => { remove : ()=>{
if (ud) Bangle.musicControl(ud>0 ? "volumedown" : "volumeup"); Bangle.removeListener("touch", touchHandler);
} Bangle.removeListener("swipe", swipeHandler);
clearWatch(buttonHandler);
widgetUtils.show();
}
},
ud => {
if (ud) Bangle.musicControl(ud>0 ? "volumedown" : "volumeup");
}
); );
Bangle.on("touch", touchHandler); Bangle.on("touch", touchHandler);
Bangle.on("swipe", swipeHandler); Bangle.on("swipe", swipeHandler);
} let buttonHandler = setWatch(()=>{load();}, BTN, {edge:'falling'});
};
// Get back to the main layout // Get back to the main layout
function backToGfx() { let backToGfx = function() {
E.showMenu(); E.showMenu();
g.clear(); g.clear();
g.reset(); g.reset();
@ -122,109 +130,109 @@ function backToGfx() {
setUI(); setUI();
gfx(); gfx();
backToMenu = false; backToMenu = false;
} };
/* /*
The functions for interacting with Android and the Spotify app The functions for interacting with Android and the Spotify app
*/ */
simpleSearch = ""; simpleSearch = "";
function simpleSearchTerm() { // input a simple search term without tags, overrides search with tags (artist and track) let simpleSearchTerm = function() { // input a simple search term without tags, overrides search with tags (artist and track)
require("textinput").input({text:simpleSearch}).then(result => {simpleSearch = result;}).then(() => {E.showMenu(searchMenu);}); require("textinput").input({text:simpleSearch}).then(result => {simpleSearch = result;}).then(() => {E.showMenu(searchMenu);});
} };
artist = ""; artist = "";
function artistSearchTerm() { // input artist to search for let artistSearchTerm = function() { // input artist to search for
require("textinput").input({text:artist}).then(result => {artist = result;}).then(() => {E.showMenu(searchMenu);}); require("textinput").input({text:artist}).then(result => {artist = result;}).then(() => {E.showMenu(searchMenu);});
} };
track = ""; track = "";
function trackSearchTerm() { // input track to search for let trackSearchTerm = function() { // input track to search for
require("textinput").input({text:track}).then(result => {track = result;}).then(() => {E.showMenu(searchMenu);}); require("textinput").input({text:track}).then(result => {track = result;}).then(() => {E.showMenu(searchMenu);});
} };
album = ""; album = "";
function albumSearchTerm() { // input album to search for let albumSearchTerm = function() { // input album to search for
require("textinput").input({text:album}).then(result => {album = result;}).then(() => {E.showMenu(searchMenu);}); require("textinput").input({text:album}).then(result => {album = result;}).then(() => {E.showMenu(searchMenu);});
} };
function searchPlayWOTags() {//make a spotify search and play using entered terms let searchPlayWOTags = function() {//make a spotify search and play using entered terms
searchString = simpleSearch; searchString = simpleSearch;
Bluetooth.println(JSON.stringify({t:"intent", action:"android.media.action.MEDIA_PLAY_FROM_SEARCH", categories:["android.intent.category.DEFAULT"], package:"com.spotify.music", target:"activity", extra:{query:searchString}, flags:["FLAG_ACTIVITY_NEW_TASK"]})); Bluetooth.println(JSON.stringify({t:"intent", action:"android.media.action.MEDIA_PLAY_FROM_SEARCH", categories:["android.intent.category.DEFAULT"], package:"com.spotify.music", target:"activity", extra:{query:searchString}, flags:["FLAG_ACTIVITY_NEW_TASK"]}));
} };
function searchPlayWTags() {//make a spotify search and play using entered terms let searchPlayWTags = function() {//make a spotify search and play using entered terms
searchString = (artist=="" ? "":("artist:\""+artist+"\"")) + ((artist!="" && track!="") ? " ":"") + (track=="" ? "":("track:\""+track+"\"")) + (((artist!="" && album!="") || (track!="" && album!="")) ? " ":"") + (album=="" ? "":(" album:\""+album+"\"")); searchString = (artist=="" ? "":("artist:\""+artist+"\"")) + ((artist!="" && track!="") ? " ":"") + (track=="" ? "":("track:\""+track+"\"")) + (((artist!="" && album!="") || (track!="" && album!="")) ? " ":"") + (album=="" ? "":(" album:\""+album+"\""));
Bluetooth.println(JSON.stringify({t:"intent", action:"android.media.action.MEDIA_PLAY_FROM_SEARCH", categories:["android.intent.category.DEFAULT"], package:"com.spotify.music", target:"activity", extra:{query:searchString}, flags:["FLAG_ACTIVITY_NEW_TASK"]})); Bluetooth.println(JSON.stringify({t:"intent", action:"android.media.action.MEDIA_PLAY_FROM_SEARCH", categories:["android.intent.category.DEFAULT"], package:"com.spotify.music", target:"activity", extra:{query:searchString}, flags:["FLAG_ACTIVITY_NEW_TASK"]}));
} };
function playVreden() {//Play the track "Vreden" by Sara Parkman via spotify uri-link let playVreden = function() {//Play the track "Vreden" by Sara Parkman via spotify uri-link
Bluetooth.println(JSON.stringify({t:"intent", action:"android.intent.action.VIEW", categories:["android.intent.category.DEFAULT"], package:"com.spotify.music", data:"spotify:track:5QEFFJ5tAeRlVquCUNpAJY:play", target:"activity" , flags:["FLAG_ACTIVITY_NEW_TASK", "FLAG_ACTIVITY_NO_ANIMATION"/*, "FLAG_ACTIVITY_CLEAR_TOP", "FLAG_ACTIVITY_PREVIOUS_IS_TOP"*/]})); Bluetooth.println(JSON.stringify({t:"intent", action:"android.intent.action.VIEW", categories:["android.intent.category.DEFAULT"], package:"com.spotify.music", data:"spotify:track:5QEFFJ5tAeRlVquCUNpAJY:play", target:"activity" , flags:["FLAG_ACTIVITY_NEW_TASK", "FLAG_ACTIVITY_NO_ANIMATION"/*, "FLAG_ACTIVITY_CLEAR_TOP", "FLAG_ACTIVITY_PREVIOUS_IS_TOP"*/]}));
} };
function playVredenAlternate() {//Play the track "Vreden" by Sara Parkman via spotify uri-link let playVredenAlternate = function() {//Play the track "Vreden" by Sara Parkman via spotify uri-link
Bluetooth.println(JSON.stringify({t:"intent", action:"android.intent.action.VIEW", categories:["android.intent.category.DEFAULT"], package:"com.spotify.music", data:"spotify:track:5QEFFJ5tAeRlVquCUNpAJY:play", target:"activity" , flags:["FLAG_ACTIVITY_NEW_TASK"]})); Bluetooth.println(JSON.stringify({t:"intent", action:"android.intent.action.VIEW", categories:["android.intent.category.DEFAULT"], package:"com.spotify.music", data:"spotify:track:5QEFFJ5tAeRlVquCUNpAJY:play", target:"activity" , flags:["FLAG_ACTIVITY_NEW_TASK"]}));
} };
function searchPlayVreden() {//Play the track "Vreden" by Sara Parkman via search and play let searchPlayVreden = function() {//Play the track "Vreden" by Sara Parkman via search and play
Bluetooth.println(JSON.stringify({t:"intent", action:"android.media.action.MEDIA_PLAY_FROM_SEARCH", categories:["android.intent.category.DEFAULT"], package:"com.spotify.music", target:"activity", extra:{query:'artist:"Sara Parkman" track:"Vreden"'}, flags:["FLAG_ACTIVITY_NEW_TASK"]})); Bluetooth.println(JSON.stringify({t:"intent", action:"android.media.action.MEDIA_PLAY_FROM_SEARCH", categories:["android.intent.category.DEFAULT"], package:"com.spotify.music", target:"activity", extra:{query:'artist:"Sara Parkman" track:"Vreden"'}, flags:["FLAG_ACTIVITY_NEW_TASK"]}));
} };
function openAlbum() {//Play EP "The Blue Room" by Coldplay let openAlbum = function() {//Play EP "The Blue Room" by Coldplay
Bluetooth.println(JSON.stringify({t:"intent", action:"android.intent.action.VIEW", categories:["android.intent.category.DEFAULT"], package:"com.spotify.music", data:"spotify:album:3MVb2CWB36x7VwYo5sZmf2", target:"activity", flags:["FLAG_ACTIVITY_NEW_TASK"]})); Bluetooth.println(JSON.stringify({t:"intent", action:"android.intent.action.VIEW", categories:["android.intent.category.DEFAULT"], package:"com.spotify.music", data:"spotify:album:3MVb2CWB36x7VwYo5sZmf2", target:"activity", flags:["FLAG_ACTIVITY_NEW_TASK"]}));
} };
function searchPlayAlbum() {//Play EP "The Blue Room" by Coldplay via search and play let searchPlayAlbum = function() {//Play EP "The Blue Room" by Coldplay via search and play
Bluetooth.println(JSON.stringify({t:"intent", action:"android.media.action.MEDIA_PLAY_FROM_SEARCH", categories:["android.intent.category.DEFAULT"], package:"com.spotify.music", target:"activity", extra:{query:'album:"The blue room" artist:"Coldplay"', "android.intent.extra.focus":"vnd.android.cursor.item/album"}, flags:["FLAG_ACTIVITY_NEW_TASK"]})); Bluetooth.println(JSON.stringify({t:"intent", action:"android.media.action.MEDIA_PLAY_FROM_SEARCH", categories:["android.intent.category.DEFAULT"], package:"com.spotify.music", target:"activity", extra:{query:'album:"The blue room" artist:"Coldplay"', "android.intent.extra.focus":"vnd.android.cursor.item/album"}, flags:["FLAG_ACTIVITY_NEW_TASK"]}));
} };
function spotifyWidget(action) { let spotifyWidget = function(action) {
Bluetooth.println(JSON.stringify({t:"intent", action:("com.spotify.mobile.android.ui.widget."+action), package:"com.spotify.music", target:"broadcastreceiver"})); Bluetooth.println(JSON.stringify({t:"intent", action:("com.spotify.mobile.android.ui.widget."+action), package:"com.spotify.music", target:"broadcastreceiver"}));
} };
function gadgetbridgeWake() { let gadgetbridgeWake = function() {
Bluetooth.println(JSON.stringify({t:"intent", target:"activity", flags:["FLAG_ACTIVITY_NEW_TASK", "FLAG_ACTIVITY_CLEAR_TASK", "FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS", "FLAG_ACTIVITY_NO_ANIMATION"], package:"gadgetbridge", class:"nodomain.freeyourgadget.gadgetbridge.activities.WakeActivity"})); Bluetooth.println(JSON.stringify({t:"intent", target:"activity", flags:["FLAG_ACTIVITY_NEW_TASK", "FLAG_ACTIVITY_CLEAR_TASK", "FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS", "FLAG_ACTIVITY_NO_ANIMATION"], package:"gadgetbridge", class:"nodomain.freeyourgadget.gadgetbridge.activities.WakeActivity"}));
} };
function spotifyPlaylistDW() { let spotifyPlaylistDW = function() {
Bluetooth.println(JSON.stringify({t:"intent", action:"android.intent.action.VIEW", categories:["android.intent.category.DEFAULT"], package:"com.spotify.music", data:"spotify:user:spotify:playlist:37i9dQZEVXcRfaeEbxXIgb:play", target:"activity" , flags:["FLAG_ACTIVITY_NEW_TASK", "FLAG_ACTIVITY_NO_ANIMATION"/*, "FLAG_ACTIVITY_CLEAR_TOP", "FLAG_ACTIVITY_PREVIOUS_IS_TOP"*/]})); Bluetooth.println(JSON.stringify({t:"intent", action:"android.intent.action.VIEW", categories:["android.intent.category.DEFAULT"], package:"com.spotify.music", data:"spotify:user:spotify:playlist:37i9dQZEVXcRfaeEbxXIgb:play", target:"activity" , flags:["FLAG_ACTIVITY_NEW_TASK", "FLAG_ACTIVITY_NO_ANIMATION"/*, "FLAG_ACTIVITY_CLEAR_TOP", "FLAG_ACTIVITY_PREVIOUS_IS_TOP"*/]}));
} };
function spotifyPlaylistDM1() { let spotifyPlaylistDM1 = function() {
Bluetooth.println(JSON.stringify({t:"intent", action:"android.intent.action.VIEW", categories:["android.intent.category.DEFAULT"], package:"com.spotify.music", data:"spotify:user:spotify:playlist:37i9dQZF1E365VyzxE0mxF:play", target:"activity" , flags:["FLAG_ACTIVITY_NEW_TASK", "FLAG_ACTIVITY_NO_ANIMATION"/*, "FLAG_ACTIVITY_CLEAR_TOP", "FLAG_ACTIVITY_PREVIOUS_IS_TOP"*/]})); Bluetooth.println(JSON.stringify({t:"intent", action:"android.intent.action.VIEW", categories:["android.intent.category.DEFAULT"], package:"com.spotify.music", data:"spotify:user:spotify:playlist:37i9dQZF1E365VyzxE0mxF:play", target:"activity" , flags:["FLAG_ACTIVITY_NEW_TASK", "FLAG_ACTIVITY_NO_ANIMATION"/*, "FLAG_ACTIVITY_CLEAR_TOP", "FLAG_ACTIVITY_PREVIOUS_IS_TOP"*/]}));
} };
function spotifyPlaylistDM2() { let spotifyPlaylistDM2 = function() {
Bluetooth.println(JSON.stringify({t:"intent", action:"android.intent.action.VIEW", categories:["android.intent.category.DEFAULT"], package:"com.spotify.music", data:"spotify:user:spotify:playlist:37i9dQZF1E38LZHLFnrM61:play", target:"activity" , flags:["FLAG_ACTIVITY_NEW_TASK", "FLAG_ACTIVITY_NO_ANIMATION"/*, "FLAG_ACTIVITY_CLEAR_TOP", "FLAG_ACTIVITY_PREVIOUS_IS_TOP"*/]})); Bluetooth.println(JSON.stringify({t:"intent", action:"android.intent.action.VIEW", categories:["android.intent.category.DEFAULT"], package:"com.spotify.music", data:"spotify:user:spotify:playlist:37i9dQZF1E38LZHLFnrM61:play", target:"activity" , flags:["FLAG_ACTIVITY_NEW_TASK", "FLAG_ACTIVITY_NO_ANIMATION"/*, "FLAG_ACTIVITY_CLEAR_TOP", "FLAG_ACTIVITY_PREVIOUS_IS_TOP"*/]}));
} };
function spotifyPlaylistDM3() { let spotifyPlaylistDM3 = function() {
Bluetooth.println(JSON.stringify({t:"intent", action:"android.intent.action.VIEW", categories:["android.intent.category.DEFAULT"], package:"com.spotify.music", data:"spotify:user:spotify:playlist:37i9dQZF1E36RU87qzgBFP:play", target:"activity" , flags:["FLAG_ACTIVITY_NEW_TASK", "FLAG_ACTIVITY_NO_ANIMATION"/*, "FLAG_ACTIVITY_CLEAR_TOP", "FLAG_ACTIVITY_PREVIOUS_IS_TOP"*/]})); Bluetooth.println(JSON.stringify({t:"intent", action:"android.intent.action.VIEW", categories:["android.intent.category.DEFAULT"], package:"com.spotify.music", data:"spotify:user:spotify:playlist:37i9dQZF1E36RU87qzgBFP:play", target:"activity" , flags:["FLAG_ACTIVITY_NEW_TASK", "FLAG_ACTIVITY_NO_ANIMATION"/*, "FLAG_ACTIVITY_CLEAR_TOP", "FLAG_ACTIVITY_PREVIOUS_IS_TOP"*/]}));
} };
function spotifyPlaylistDM4() { let spotifyPlaylistDM4 = function() {
Bluetooth.println(JSON.stringify({t:"intent", action:"android.intent.action.VIEW", categories:["android.intent.category.DEFAULT"], package:"com.spotify.music", data:"spotify:user:spotify:playlist:37i9dQZF1E396gGyCXEBFh:play", target:"activity" , flags:["FLAG_ACTIVITY_NEW_TASK", "FLAG_ACTIVITY_NO_ANIMATION"/*, "FLAG_ACTIVITY_CLEAR_TOP", "FLAG_ACTIVITY_PREVIOUS_IS_TOP"*/]})); Bluetooth.println(JSON.stringify({t:"intent", action:"android.intent.action.VIEW", categories:["android.intent.category.DEFAULT"], package:"com.spotify.music", data:"spotify:user:spotify:playlist:37i9dQZF1E396gGyCXEBFh:play", target:"activity" , flags:["FLAG_ACTIVITY_NEW_TASK", "FLAG_ACTIVITY_NO_ANIMATION"/*, "FLAG_ACTIVITY_CLEAR_TOP", "FLAG_ACTIVITY_PREVIOUS_IS_TOP"*/]}));
} };
function spotifyPlaylistDM5() { let spotifyPlaylistDM5 = function() {
Bluetooth.println(JSON.stringify({t:"intent", action:"android.intent.action.VIEW", categories:["android.intent.category.DEFAULT"], package:"com.spotify.music", data:"spotify:user:spotify:playlist:37i9dQZF1E37a0Tt6CKJLP:play", target:"activity" , flags:["FLAG_ACTIVITY_NEW_TASK", "FLAG_ACTIVITY_NO_ANIMATION"/*, "FLAG_ACTIVITY_CLEAR_TOP", "FLAG_ACTIVITY_PREVIOUS_IS_TOP"*/]})); Bluetooth.println(JSON.stringify({t:"intent", action:"android.intent.action.VIEW", categories:["android.intent.category.DEFAULT"], package:"com.spotify.music", data:"spotify:user:spotify:playlist:37i9dQZF1E37a0Tt6CKJLP:play", target:"activity" , flags:["FLAG_ACTIVITY_NEW_TASK", "FLAG_ACTIVITY_NO_ANIMATION"/*, "FLAG_ACTIVITY_CLEAR_TOP", "FLAG_ACTIVITY_PREVIOUS_IS_TOP"*/]}));
} };
function spotifyPlaylistDM6() { let spotifyPlaylistDM6 = function() {
Bluetooth.println(JSON.stringify({t:"intent", action:"android.intent.action.VIEW", categories:["android.intent.category.DEFAULT"], package:"com.spotify.music", data:"spotify:user:spotify:playlist:37i9dQZF1E36UIQLQK79od:play", target:"activity" , flags:["FLAG_ACTIVITY_NEW_TASK", "FLAG_ACTIVITY_NO_ANIMATION"/*, "FLAG_ACTIVITY_CLEAR_TOP", "FLAG_ACTIVITY_PREVIOUS_IS_TOP"*/]})); Bluetooth.println(JSON.stringify({t:"intent", action:"android.intent.action.VIEW", categories:["android.intent.category.DEFAULT"], package:"com.spotify.music", data:"spotify:user:spotify:playlist:37i9dQZF1E36UIQLQK79od:play", target:"activity" , flags:["FLAG_ACTIVITY_NEW_TASK", "FLAG_ACTIVITY_NO_ANIMATION"/*, "FLAG_ACTIVITY_CLEAR_TOP", "FLAG_ACTIVITY_PREVIOUS_IS_TOP"*/]}));
} };
function spotifyPlaylistDD() { let spotifyPlaylistDD = function() {
Bluetooth.println(JSON.stringify({t:"intent", action:"android.intent.action.VIEW", categories:["android.intent.category.DEFAULT"], package:"com.spotify.music", data:"spotify:user:spotify:playlist:37i9dQZF1EfWFiI7QfIAKq:play", target:"activity" , flags:["FLAG_ACTIVITY_NEW_TASK", "FLAG_ACTIVITY_NO_ANIMATION"/*, "FLAG_ACTIVITY_CLEAR_TOP", "FLAG_ACTIVITY_PREVIOUS_IS_TOP"*/]})); Bluetooth.println(JSON.stringify({t:"intent", action:"android.intent.action.VIEW", categories:["android.intent.category.DEFAULT"], package:"com.spotify.music", data:"spotify:user:spotify:playlist:37i9dQZF1EfWFiI7QfIAKq:play", target:"activity" , flags:["FLAG_ACTIVITY_NEW_TASK", "FLAG_ACTIVITY_NO_ANIMATION"/*, "FLAG_ACTIVITY_CLEAR_TOP", "FLAG_ACTIVITY_PREVIOUS_IS_TOP"*/]}));
} };
function spotifyPlaylistRR() { let spotifyPlaylistRR = function() {
Bluetooth.println(JSON.stringify({t:"intent", action:"android.intent.action.VIEW", categories:["android.intent.category.DEFAULT"], package:"com.spotify.music", data:"spotify:user:spotify:playlist:37i9dQZEVXbs0XkE2V8sMO:play", target:"activity" , flags:["FLAG_ACTIVITY_NEW_TASK", "FLAG_ACTIVITY_NO_ANIMATION"/*, "FLAG_ACTIVITY_CLEAR_TOP", "FLAG_ACTIVITY_PREVIOUS_IS_TOP"*/]})); Bluetooth.println(JSON.stringify({t:"intent", action:"android.intent.action.VIEW", categories:["android.intent.category.DEFAULT"], package:"com.spotify.music", data:"spotify:user:spotify:playlist:37i9dQZEVXbs0XkE2V8sMO:play", target:"activity" , flags:["FLAG_ACTIVITY_NEW_TASK", "FLAG_ACTIVITY_NO_ANIMATION"/*, "FLAG_ACTIVITY_CLEAR_TOP", "FLAG_ACTIVITY_PREVIOUS_IS_TOP"*/]}));
} };
// Spotify Remote Menu // Spotify Remote Menu
var spotifyMenu = { let spotifyMenu = {
"" : { title : " ", "" : { title : " Menu ",
back: backToGfx }, back: backToGfx },
"Controls" : ()=>{E.showMenu(controlMenu);}, "Controls" : ()=>{E.showMenu(controlMenu);},
"Search and play" : ()=>{E.showMenu(searchMenu);}, "Search and play" : ()=>{E.showMenu(searchMenu);},
@ -234,8 +242,8 @@ var spotifyMenu = {
}; };
var controlMenu = { let controlMenu = {
"" : { title : " ", "" : { title : " Controls ",
back: () => {if (backToMenu) E.showMenu(spotifyMenu); back: () => {if (backToMenu) E.showMenu(spotifyMenu);
if (!backToMenu) backToGfx();} }, if (!backToMenu) backToGfx();} },
"Play" : ()=>{Bangle.musicControl("play");}, "Play" : ()=>{Bangle.musicControl("play");},
@ -246,8 +254,8 @@ var controlMenu = {
"Messages Music Controls" : ()=>{load("messagesmusic.app.js");}, "Messages Music Controls" : ()=>{load("messagesmusic.app.js");},
}; };
var searchMenu = { let searchMenu = {
"" : { title : " ", "" : { title : " Search ",
back: () => {if (backToMenu) E.showMenu(spotifyMenu); back: () => {if (backToMenu) E.showMenu(spotifyMenu);
if (!backToMenu) backToGfx();} }, if (!backToMenu) backToGfx();} },
"Search term w/o tags" : ()=>{simpleSearchTerm();}, "Search term w/o tags" : ()=>{simpleSearchTerm();},
@ -258,8 +266,8 @@ var searchMenu = {
"Execute search and play with tags" : ()=>{searchPlayWTags();}, "Execute search and play with tags" : ()=>{searchPlayWTags();},
}; };
var savedMenu = { let savedMenu = {
"" : { title : " ", "" : { title : " Saved ",
back: () => {if (backToMenu) E.showMenu(spotifyMenu); back: () => {if (backToMenu) E.showMenu(spotifyMenu);
if (!backToMenu) backToGfx();} }, if (!backToMenu) backToGfx();} },
"Play Discover Weekly" : ()=>{spotifyPlaylistDW();}, "Play Discover Weekly" : ()=>{spotifyPlaylistDW();},
@ -278,4 +286,6 @@ var savedMenu = {
Bangle.loadWidgets(); Bangle.loadWidgets();
setUI(); setUI();
widgetUtils.hide();
gfx(); gfx();
}

View File

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