From 1bf4c9e81f61a4d9f567b648ea71de79ac64bcb4 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Tue, 19 Aug 2014 21:57:50 -0700 Subject: getBookmarks can't use same list differential as getStarred. Needs to look for cases where bookmarks exist but are different as well --- .../daneren2005/dsub/service/CachedMusicService.java | 17 +++++++++++++++-- 1 file 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 oldList = oldBookmarks.getChildren(); final List newList = new ArrayList(); newList.addAll(bookmarks.getChildren()); - - removeDuplicates(oldList, newList); + + for(Iterator 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); -- cgit v1.2.3