diff options
author | Scott Jackson <daneren2005@gmail.com> | 2014-08-05 18:37:53 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2014-08-05 18:37:53 -0700 |
commit | c504e891fa944256fa6957beea127c7cb11b8766 (patch) | |
tree | 4da2d8de9b0222d2faeb8e341a63cf2f5690ab93 /src/github/daneren2005 | |
parent | 0b21a5c08eb340fe3d1473ee436992a04c697ba1 (diff) | |
download | dsub-c504e891fa944256fa6957beea127c7cb11b8766.tar.gz dsub-c504e891fa944256fa6957beea127c7cb11b8766.tar.bz2 dsub-c504e891fa944256fa6957beea127c7cb11b8766.zip |
Fix timing issue when starting in shuffle mode as playlist is being restored
Diffstat (limited to 'src/github/daneren2005')
-rw-r--r-- | src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java b/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java index 40bb5871..e2941fc9 100644 --- a/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java +++ b/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java @@ -157,15 +157,25 @@ public class DownloadServiceLifecycleSupport { new CacheCleaner(downloadService, downloadService).clean(); } - public void onStart(Intent intent) { + public void onStart(final Intent intent) { if (intent != null) { String action = intent.getAction(); if(DownloadService.START_PLAY.equals(action)) { - if(intent.getBooleanExtra(Constants.INTENT_EXTRA_NAME_SHUFFLE, false)) { - downloadService.setShufflePlayEnabled(true); - } else { - downloadService.start(); - } + eventHandler.post(new Runnable() { + @Override + public void run() { + if(!setup.get()) { + lock.lock(); + lock.unlock(); + } + + if(intent.getBooleanExtra(Constants.INTENT_EXTRA_NAME_SHUFFLE, false)) { + downloadService.setShufflePlayEnabled(true); + } else { + downloadService.start(); + } + } + }); } else if(DownloadService.CANCEL_DOWNLOADS.equals(action)) { downloadService.clearBackground(); } else if(intent.getExtras() != null) { |