diff options
author | Scott Jackson <daneren2005@gmail.com> | 2014-09-04 20:56:42 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2014-09-04 20:56:42 -0700 |
commit | 4269f632aebf4607633120614b4abb92c081789d (patch) | |
tree | 435344b1da077de1ef143b5fd851341817194526 /src | |
parent | 9354ea4f7887f655f6aabe7b09665d4f10d5ba5b (diff) | |
download | dsub-4269f632aebf4607633120614b4abb92c081789d.tar.gz dsub-4269f632aebf4607633120614b4abb92c081789d.tar.bz2 dsub-4269f632aebf4607633120614b4abb92c081789d.zip |
Move star updated to checkResult so artist update works
Diffstat (limited to 'src')
-rw-r--r-- | src/github/daneren2005/dsub/service/CachedMusicService.java | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/src/github/daneren2005/dsub/service/CachedMusicService.java b/src/github/daneren2005/dsub/service/CachedMusicService.java index 7c0f9e09..725a20f8 100644 --- a/src/github/daneren2005/dsub/service/CachedMusicService.java +++ b/src/github/daneren2005/dsub/service/CachedMusicService.java @@ -381,24 +381,7 @@ public class CachedMusicService implements MusicService { totalList.addAll(oldList); totalList.addAll(newList); - new GenericEntryUpdater(context, totalList) { - @Override - public boolean checkResult(Entry entry, Entry check) { - if (entry.getId().equals(check.getId())) { - if(entry.isStarred() != check.isStarred()) { - check.setStarred(entry.isStarred()); - return true; - } - } - - return false; - } - - @Override - public void updateResult(Entry result) { - - } - }.execute(); + new StarUpdater(context, totalList).execute(); } FileUtil.serialize(context, dir, "starred"); @@ -491,12 +474,7 @@ public class CachedMusicService implements MusicService { allEntries.addAll(entries); } - new GenericEntryUpdater(context, allEntries) { - @Override - public void updateResult(Entry result) { - result.setStarred(starred); - } - }.execute(); + new StarUpdater(context, allEntries).execute(); } @Override @@ -1018,7 +996,7 @@ public class CachedMusicService implements MusicService { @Override public void updateResult(List<Artist> objects, Artist result) { - GenericEntryUpdater.this.updateResult(new Entry(result)); + // Don't try to put anything here, as the Entry update method will not be called since it's a artist! } }.execute(); } else { @@ -1118,6 +1096,28 @@ public class CachedMusicService implements MusicService { } } + private class StarUpdater extends GenericEntryUpdater { + public StarUpdater(Context context, List<Entry> entries) { + super(context, entries); + } + + @Override + public boolean checkResult(Entry entry, Entry check) { + if (entry.getId().equals(check.getId())) { + if(entry.isStarred() != check.isStarred()) { + check.setStarred(entry.isStarred()); + return true; + } + } + + return false; + } + + @Override + public void updateResult(Entry result) { + + } + }; private abstract class IndexesUpdater extends SerializeUpdater<Artist> { Indexes indexes; |