diff options
-rw-r--r-- | app/src/main/java/github/daneren2005/dsub/service/CachedMusicService.java | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/service/CachedMusicService.java b/app/src/main/java/github/daneren2005/dsub/service/CachedMusicService.java index 9fd26fe5..1e91a61e 100644 --- a/app/src/main/java/github/daneren2005/dsub/service/CachedMusicService.java +++ b/app/src/main/java/github/daneren2005/dsub/service/CachedMusicService.java @@ -148,7 +148,11 @@ public class CachedMusicService implements MusicService { cachedIndexes.clear(); cachedMusicFolders.clear(); } - Indexes result = cachedIndexes.get(); + Indexes result = null; + if(Util.equals(musicFolderId, this.musicFolderId)) { + result = cachedIndexes.get(); + } + if (result == null) { String name = Util.isTagBrowsing(context, musicService.getInstance(context)) ? "artists" : "indexes"; name = getCacheName(context, name, musicFolderId); @@ -160,7 +164,10 @@ public class CachedMusicService implements MusicService { result = musicService.getIndexes(musicFolderId, refresh, context, progressListener); FileUtil.serialize(context, result, name); } - cachedIndexes.set(result); + + if(Util.equals(musicFolderId, this.musicFolderId)) { + cachedIndexes.set(result); + } } return result; } |