diff options
author | Scott Jackson <daneren2005@gmail.com> | 2015-01-19 17:00:29 -0800 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2015-01-19 17:00:29 -0800 |
commit | d5758b2ec0edfc257bab18dd7cab572e2e02dbbe (patch) | |
tree | cf58e05fb567e7e2f7249f89ad76e19c4481afab /src/github | |
parent | a59c846034c8d51add774c5dcf52afd635bcd410 (diff) | |
download | dsub-d5758b2ec0edfc257bab18dd7cab572e2e02dbbe.tar.gz dsub-d5758b2ec0edfc257bab18dd7cab572e2e02dbbe.tar.bz2 dsub-d5758b2ec0edfc257bab18dd7cab572e2e02dbbe.zip |
Fix index cache not being cleared when changing musicFolderId
Diffstat (limited to 'src/github')
-rw-r--r-- | src/github/daneren2005/dsub/service/CachedMusicService.java | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/github/daneren2005/dsub/service/CachedMusicService.java b/src/github/daneren2005/dsub/service/CachedMusicService.java index 232d0acf..38508e42 100644 --- a/src/github/daneren2005/dsub/service/CachedMusicService.java +++ b/src/github/daneren2005/dsub/service/CachedMusicService.java @@ -30,6 +30,7 @@ import org.apache.http.HttpResponse; import android.content.Context; import android.graphics.Bitmap; +import android.util.Log; import github.daneren2005.dsub.domain.Artist; import github.daneren2005.dsub.domain.ArtistInfo; @@ -72,6 +73,7 @@ public class CachedMusicService implements MusicService { private final TimeLimitedCache<List<MusicFolder>> cachedMusicFolders = new TimeLimitedCache<List<MusicFolder>>(10 * 3600, TimeUnit.SECONDS); private final TimeLimitedCache<List<PodcastChannel>> cachedPodcastChannels = new TimeLimitedCache<List<PodcastChannel>>(10 * 3600, TimeUnit.SECONDS); private String restUrl; + private String musicFolderId; private boolean isTagBrowsing = false; public CachedMusicService(RESTMusicService musicService) { @@ -1300,8 +1302,9 @@ public class CachedMusicService implements MusicService { } private void checkSettingsChanged(Context context) { + int instance = musicService.getInstance(context); String newUrl = musicService.getRestUrl(context, null, false); - boolean newIsTagBrowsing = Util.isTagBrowsing(context); + boolean newIsTagBrowsing = Util.isTagBrowsing(context, instance); if (!Util.equals(newUrl, restUrl) || isTagBrowsing != newIsTagBrowsing) { cachedMusicFolders.clear(); cachedLicenseValid.clear(); @@ -1311,5 +1314,11 @@ public class CachedMusicService implements MusicService { restUrl = newUrl; isTagBrowsing = newIsTagBrowsing; } + + String newMusicFolderId = Util.getSelectedMusicFolderId(context, instance); + if(!Util.equals(newMusicFolderId, musicFolderId)) { + cachedIndexes.clear(); + musicFolderId = newMusicFolderId; + } } } |