diff options
author | Scott Jackson <daneren2005@gmail.com> | 2012-10-23 21:36:34 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2012-10-23 21:36:34 -0700 |
commit | 05b1b71fd10a832f98ce6c7f55cb3f08e8b701d4 (patch) | |
tree | 0616606a415339e7a6cf2afee1c29f398ceb4b54 /subsonic-android | |
parent | 3dae2c25144a75ac283e7d8f2140514be8c52805 (diff) | |
download | dsub-05b1b71fd10a832f98ce6c7f55cb3f08e8b701d4.tar.gz dsub-05b1b71fd10a832f98ce6c7f55cb3f08e8b701d4.tar.bz2 dsub-05b1b71fd10a832f98ce6c7f55cb3f08e8b701d4.zip |
Clear buffer when changing folders as well
Diffstat (limited to 'subsonic-android')
-rw-r--r-- | subsonic-android/src/github/daneren2005/dsub/util/ShufflePlayBuffer.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/subsonic-android/src/github/daneren2005/dsub/util/ShufflePlayBuffer.java b/subsonic-android/src/github/daneren2005/dsub/util/ShufflePlayBuffer.java index 3d95f36d..c91349ff 100644 --- a/subsonic-android/src/github/daneren2005/dsub/util/ShufflePlayBuffer.java +++ b/subsonic-android/src/github/daneren2005/dsub/util/ShufflePlayBuffer.java @@ -44,6 +44,7 @@ public class ShufflePlayBuffer { private final List<MusicDirectory.Entry> buffer = new ArrayList<MusicDirectory.Entry>(); private Context context; private int currentServer; + private String currentFolder; public ShufflePlayBuffer(Context context) { this.context = context; @@ -87,6 +88,7 @@ public class ShufflePlayBuffer { MusicService service = MusicServiceFactory.getMusicService(context); int n = CAPACITY - buffer.size(); String folder = Util.getSelectedMusicFolderId(context); + Log.d(TAG, folder == null ? "null" : folder); MusicDirectory songs = service.getRandomSongs(n, folder, context, null); synchronized (buffer) { @@ -100,8 +102,9 @@ public class ShufflePlayBuffer { private void clearBufferIfnecessary() { synchronized (buffer) { - if (currentServer != Util.getActiveServer(context)) { + if (currentServer != Util.getActiveServer(context) || currentFolder != Util.getSelectedMusicFolderId(context)) { currentServer = Util.getActiveServer(context); + currentFolder = Util.getSelectedMusicFolderId(context); buffer.clear(); } } |