aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/github/daneren2005
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2015-11-23 18:02:23 -0800
committerScott Jackson <daneren2005@gmail.com>2015-11-23 18:02:23 -0800
commitd2003fd40e3d87e3ea9af1d30774a04e520e997f (patch)
tree42693c697949d5e405d1a2529cc41ccfd8ea9f6a /app/src/main/java/github/daneren2005
parentd230416c7ac38e87c26c0f7a016b4c222e1cdda6 (diff)
downloaddsub-d2003fd40e3d87e3ea9af1d30774a04e520e997f.tar.gz
dsub-d2003fd40e3d87e3ea9af1d30774a04e520e997f.tar.bz2
dsub-d2003fd40e3d87e3ea9af1d30774a04e520e997f.zip
Unpin songs when deleting a synced playlist
Diffstat (limited to 'app/src/main/java/github/daneren2005')
-rw-r--r--app/src/main/java/github/daneren2005/dsub/service/CachedMusicService.java16
1 files changed, 15 insertions, 1 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/service/CachedMusicService.java b/app/src/main/java/github/daneren2005/dsub/service/CachedMusicService.java
index caf000d4..68ca36a7 100644
--- a/app/src/main/java/github/daneren2005/dsub/service/CachedMusicService.java
+++ b/app/src/main/java/github/daneren2005/dsub/service/CachedMusicService.java
@@ -310,7 +310,7 @@ public class CachedMusicService implements MusicService {
}
@Override
- public void deletePlaylist(String id, Context context, ProgressListener progressListener) throws Exception {
+ public void deletePlaylist(final String id, Context context, ProgressListener progressListener) throws Exception {
musicService.deletePlaylist(id, context, progressListener);
new PlaylistUpdater(context, id) {
@@ -318,6 +318,20 @@ public class CachedMusicService implements MusicService {
public void updateResult(List<Playlist> objects, Playlist result) {
objects.remove(result);
cachedPlaylists.set(objects);
+
+ ArrayList<SyncUtil.SyncSet> playlistList = SyncUtil.getSyncedPlaylists(context, musicService.getInstance(context));
+ for(int i = 0; i < playlistList.size(); i++) {
+ SyncUtil.SyncSet syncPlaylist = playlistList.get(i);
+ if(syncPlaylist.id != null && syncPlaylist.id.equals(id)) {
+ MusicDirectory musicDirectory = FileUtil.deserialize(context, getCacheName(context, "playlist", id), MusicDirectory.class);
+ for(Entry entry: musicDirectory.getChildren()) {
+ DownloadFile file = new DownloadFile(context, entry, true);
+ file.unpin();
+ }
+
+ break;
+ }
+ }
}
}.execute();
}