From 05b1b71fd10a832f98ce6c7f55cb3f08e8b701d4 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Tue, 23 Oct 2012 21:36:34 -0700 Subject: Clear buffer when changing folders as well --- .../src/github/daneren2005/dsub/util/ShufflePlayBuffer.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'subsonic-android') 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 buffer = new ArrayList(); 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(); } } -- cgit v1.2.3