diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/github/daneren2005/dsub/service/CachedMusicService.java | 29 |
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 |