diff options
author | Scott Jackson <daneren2005@gmail.com> | 2012-10-01 19:54:33 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2012-10-01 19:54:33 -0700 |
commit | 56458b12e19310b51d228c601012bf4b65a29f17 (patch) | |
tree | 62249d8aa855f47defb23a6c724fde36c6f9d5ec /subsonic-android/src/github | |
parent | aea0ce8ac28c32e14f91a5efc3558072788794e0 (diff) | |
download | dsub-56458b12e19310b51d228c601012bf4b65a29f17.tar.gz dsub-56458b12e19310b51d228c601012bf4b65a29f17.tar.bz2 dsub-56458b12e19310b51d228c601012bf4b65a29f17.zip |
Got playlist downloading/caching working
Diffstat (limited to 'subsonic-android/src/github')
-rw-r--r-- | subsonic-android/src/github/daneren2005/dsub/activity/SelectPlaylistActivity.java | 4 | ||||
-rw-r--r-- | subsonic-android/src/github/daneren2005/dsub/activity/SubsonicTabActivity.java | 15 |
2 files changed, 14 insertions, 5 deletions
diff --git a/subsonic-android/src/github/daneren2005/dsub/activity/SelectPlaylistActivity.java b/subsonic-android/src/github/daneren2005/dsub/activity/SelectPlaylistActivity.java index 6afefc5b..3f9f16ff 100644 --- a/subsonic-android/src/github/daneren2005/dsub/activity/SelectPlaylistActivity.java +++ b/subsonic-android/src/github/daneren2005/dsub/activity/SelectPlaylistActivity.java @@ -134,10 +134,10 @@ public class SelectPlaylistActivity extends SubsonicTabActivity implements Adapt Intent intent; switch (menuItem.getItemId()) { case R.id.playlist_menu_download: - downloadRecursively(playlist.getId(), false, true, false, false, true); + downloadPlaylist(playlist.getId(), playlist.getName(), false, true, false, false, true); break; case R.id.playlist_menu_pin: - downloadRecursively(playlist.getId(), true, true, false, false, true); + downloadPlaylist(playlist.getId(), playlist.getName(), true, true, false, false, true); break; case R.id.playlist_menu_play_now: intent = new Intent(SelectPlaylistActivity.this, SelectAlbumActivity.class); diff --git a/subsonic-android/src/github/daneren2005/dsub/activity/SubsonicTabActivity.java b/subsonic-android/src/github/daneren2005/dsub/activity/SubsonicTabActivity.java index 8bbb1342..c7ef57b5 100644 --- a/subsonic-android/src/github/daneren2005/dsub/activity/SubsonicTabActivity.java +++ b/subsonic-android/src/github/daneren2005/dsub/activity/SubsonicTabActivity.java @@ -238,14 +238,23 @@ public class SubsonicTabActivity extends SherlockActivity { } protected void downloadRecursively(final String id, final boolean save, final boolean append, final boolean autoplay, final boolean shuffle, final boolean background) { - ModalBackgroundTask<List<MusicDirectory.Entry>> task = new ModalBackgroundTask<List<MusicDirectory.Entry>>(this, false) { - + downloadRecursively(id, "", true, save, append, autoplay, shuffle, background); + } + protected void downloadPlaylist(final String id, final String name, final boolean save, final boolean append, final boolean autoplay, final boolean shuffle, final boolean background) { + downloadRecursively(id, name, false, save, append, autoplay, shuffle, background); + } + protected void downloadRecursively(final String id, final String name, final boolean isDirectory, final boolean save, final boolean append, final boolean autoplay, final boolean shuffle, final boolean background) { + ModalBackgroundTask<List<MusicDirectory.Entry>> task = new ModalBackgroundTask<List<MusicDirectory.Entry>>(this, false) { private static final int MAX_SONGS = 500; @Override protected List<MusicDirectory.Entry> doInBackground() throws Throwable { MusicService musicService = MusicServiceFactory.getMusicService(SubsonicTabActivity.this); - MusicDirectory root = musicService.getMusicDirectory(id, false, SubsonicTabActivity.this, this); + MusicDirectory root; + if(isDirectory) + root = musicService.getMusicDirectory(id, false, SubsonicTabActivity.this, this); + else + root = musicService.getPlaylist(id, name, SubsonicTabActivity.this, this); List<MusicDirectory.Entry> songs = new LinkedList<MusicDirectory.Entry>(); getSongsRecursively(root, songs); return songs; |