diff options
author | Scott Jackson <daneren2005@gmail.com> | 2014-08-19 21:57:50 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2014-08-19 21:57:50 -0700 |
commit | 1bf4c9e81f61a4d9f567b648ea71de79ac64bcb4 (patch) | |
tree | d0a481cce7aac89b0da2a7e8a0e575e3e3b74ee7 /src/github | |
parent | 9deb868578f32847402566f83667f24597633e5b (diff) | |
download | dsub-1bf4c9e81f61a4d9f567b648ea71de79ac64bcb4.tar.gz dsub-1bf4c9e81f61a4d9f567b648ea71de79ac64bcb4.tar.bz2 dsub-1bf4c9e81f61a4d9f567b648ea71de79ac64bcb4.zip |
getBookmarks can't use same list differential as getStarred. Needs to look for cases where bookmarks exist but are different as well
Diffstat (limited to 'src/github')
-rw-r--r-- | src/github/daneren2005/dsub/service/CachedMusicService.java | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/github/daneren2005/dsub/service/CachedMusicService.java b/src/github/daneren2005/dsub/service/CachedMusicService.java index eb40691e..90e5539c 100644 --- a/src/github/daneren2005/dsub/service/CachedMusicService.java +++ b/src/github/daneren2005/dsub/service/CachedMusicService.java @@ -805,8 +805,21 @@ public class CachedMusicService implements MusicService { final List<Entry> oldList = oldBookmarks.getChildren(); final List<Entry> newList = new ArrayList<Entry>(); newList.addAll(bookmarks.getChildren()); - - removeDuplicates(oldList, newList); + + for(Iterator<Entry> it = oldList.iterator(); it.hasNext(); ) { + Entry oldEntry = it.next(); + // Remove entries from newList + int position = newList.indexOf(oldEntry); + if(position != -1) { + Entry newEntry = newList.get(position); + if(newEntry.getBookmark().getPosition() == oldEntry.getBookmark().getPosition()) { + newList.remove(position); + } + + // Remove from old regardless of whether position is wrong + it.remove(); + } + } // Remove bookmarks from thinsg still in old list setBookmarkCache(context, oldList, true); |