diff options
3 files changed, 9 insertions, 2 deletions
diff --git a/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java b/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java index 7f267f28..8bc27c84 100644 --- a/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java +++ b/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java @@ -557,7 +557,7 @@ public class SubsonicFragmentActivity extends SubsonicActivity { // Make sure we wait until download service is ready
DownloadService downloadService = getDownloadService();
- while(downloadService == null) {
+ while(downloadService == null || !downloadService.isInitialized()) {
Util.sleepQuietly(100L);
downloadService = getDownloadService();
}
diff --git a/src/github/daneren2005/dsub/service/DownloadService.java b/src/github/daneren2005/dsub/service/DownloadService.java index 6767e95e..d4d97fd5 100644 --- a/src/github/daneren2005/dsub/service/DownloadService.java +++ b/src/github/daneren2005/dsub/service/DownloadService.java @@ -440,7 +440,6 @@ public class DownloadService extends Service { shufflePlay = true; } else if(startShufflePlay == SHUFFLE_MODE_ARTIST) { artistRadio = true; - Log.d(TAG, "Artist id: " + prefs.getString(Constants.PREFERENCES_KEY_SHUFFLE_MODE_EXTRA, null)); artistRadioBuffer.restoreArtist(prefs.getString(Constants.PREFERENCES_KEY_SHUFFLE_MODE_EXTRA, null)); } SharedPreferences.Editor editor = prefs.edit(); @@ -466,6 +465,10 @@ public class DownloadService extends Service { suggestedPlaylistId = prefs.getString(Constants.PREFERENCES_KEY_PLAYLIST_ID, null); } + public boolean isInitialized() { + return lifecycleSupport != null && lifecycleSupport.isInitialized(); + } + public synchronized Date getLastStateChanged() { return lifecycleSupport.getLastChange(); } diff --git a/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java b/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java index ca103332..8a83d881 100644 --- a/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java +++ b/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java @@ -171,6 +171,10 @@ public class DownloadServiceLifecycleSupport { new CacheCleaner(downloadService, downloadService).clean(); } + public boolean isInitialized() { + return setup.get(); + } + public void onStart(final Intent intent) { if (intent != null) { final String action = intent.getAction(); |