aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2014-08-17 12:19:37 -0700
committerScott Jackson <daneren2005@gmail.com>2014-08-17 12:19:37 -0700
commitb9959f41efe45548757d0a7f1b1c9eb4ec9f9e92 (patch)
tree1007219259b02ef68b59491b146dbbdc9f0d4230 /src
parent92f924b46d2ecd05669e27a93f5ced3d00f79cf7 (diff)
downloaddsub-b9959f41efe45548757d0a7f1b1c9eb4ec9f9e92.tar.gz
dsub-b9959f41efe45548757d0a7f1b1c9eb4ec9f9e92.tar.bz2
dsub-b9959f41efe45548757d0a7f1b1c9eb4ec9f9e92.zip
Update playlist caches for stars as well
Diffstat (limited to 'src')
-rw-r--r--src/github/daneren2005/dsub/service/CachedMusicService.java29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/github/daneren2005/dsub/service/CachedMusicService.java b/src/github/daneren2005/dsub/service/CachedMusicService.java
index 027f6694..e97ffe24 100644
--- a/src/github/daneren2005/dsub/service/CachedMusicService.java
+++ b/src/github/daneren2005/dsub/service/CachedMusicService.java
@@ -386,6 +386,11 @@ public class CachedMusicService implements MusicService {
private void updateStarredList(Context context, List<Entry> list, final boolean starred, final boolean isTagBrowsing) {
for(final Entry entry: list) {
+ // Don't waste time when status is the same
+ if(entry.isStarred() == starred) {
+ continue;
+ }
+
String cacheName, parent = null;
boolean isArtist = false;
if(isTagBrowsing) {
@@ -595,6 +600,30 @@ public class CachedMusicService implements MusicService {
}
}.execute();
}
+
+ // Update playlist caches if there is at least one song to be starred
+ if(ids != null && ids.size() > 0) {
+ List<Playlist> playlists = FileUtil.deserialize(context, getCacheName(context, "playlist"), ArrayList.class);
+ for(Playlist playlist: playlists) {
+ new MusicDirectoryUpdater(context, "playlist", playlist.getId()) {
+ @Override
+ public boolean checkResult(Entry check) {
+ for (String id : checkIds) {
+ if (id.equals(check.getId())) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ @Override
+ public void updateResult(List<Entry> objects, Entry result) {
+ result.setStarred(starred);
+ }
+ }.execute();
+ }
+ }
}
@Override