From 1b4efd1ff269650558a6a9ac874b87148c176d3a Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Sat, 16 Aug 2014 15:31:02 -0700 Subject: Check if unstarred entry exists in current playing list --- .../daneren2005/dsub/service/CachedMusicService.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'src/github') diff --git a/src/github/daneren2005/dsub/service/CachedMusicService.java b/src/github/daneren2005/dsub/service/CachedMusicService.java index 027f6694..e989036a 100644 --- a/src/github/daneren2005/dsub/service/CachedMusicService.java +++ b/src/github/daneren2005/dsub/service/CachedMusicService.java @@ -440,7 +440,7 @@ public class CachedMusicService implements MusicService { @Override public void updateResult(List objects, Entry result) { - result.setStarred(starred); + setEntryStarred(result, starred); } }.execute(); } @@ -571,7 +571,7 @@ public class CachedMusicService implements MusicService { @Override public void updateResult(List objects, Entry result) { - result.setStarred(starred); + setEntryStarred(result, starred); } }.execute(); } @@ -596,6 +596,21 @@ public class CachedMusicService implements MusicService { }.execute(); } } + private void setEntryStarred(Entry entry, boolean starred) { + entry.setStarred(starred); + + DownloadService downloadService = DownloadService.getInstance(); + if(downloadService != null && !entry.isDirectory()) { + List files = downloadService.getDownloads(); + for(DownloadFile file: files) { + Entry check = file.getSong(); + if(entry.getId().equals(check.getId())) { + check.setStarred(starred); + break; + } + } + } + } @Override public List getShares(Context context, ProgressListener progressListener) throws Exception { -- cgit v1.2.3