diff options
author | Scott Jackson <daneren2005@gmail.com> | 2014-02-06 19:31:51 -0800 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2014-02-06 19:31:51 -0800 |
commit | 47efa0e85266bc390513854ac89fca914fe9f93b (patch) | |
tree | c31ab746264c27f56e59852b0161f788f3bda4a7 /src | |
parent | 90643ffe79badc378f55630fe559236f5b580aa8 (diff) | |
download | dsub-47efa0e85266bc390513854ac89fca914fe9f93b.tar.gz dsub-47efa0e85266bc390513854ac89fca914fe9f93b.tar.bz2 dsub-47efa0e85266bc390513854ac89fca914fe9f93b.zip |
Fix cancel button
Diffstat (limited to 'src')
-rw-r--r-- | src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java b/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java index 65320f84..cd876621 100644 --- a/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java +++ b/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java @@ -92,8 +92,6 @@ public class DownloadServiceLifecycleSupport { } else if (DownloadServiceImpl.CMD_STOP.equals(action)) { downloadService.pause(); downloadService.seekTo(0); - } else if(DownloadServiceImpl.CANCEL_DOWNLOADS.equals(action)) { - downloadService.clearBackground(); } } }); @@ -204,19 +202,26 @@ public class DownloadServiceLifecycleSupport { } public void onStart(Intent intent) { - if (intent != null && intent.getExtras() != null) { - final KeyEvent event = (KeyEvent) intent.getExtras().get(Intent.EXTRA_KEY_EVENT); - if (event != null) { - eventHandler.post(new Runnable() { - @Override - public void run() { - if(!setup.get()) { - lock.lock(); - lock.unlock(); + if (intent != null) { + if(intent.getExtras() != null) { + final KeyEvent event = (KeyEvent) intent.getExtras().get(Intent.EXTRA_KEY_EVENT); + if (event != null) { + eventHandler.post(new Runnable() { + @Override + public void run() { + if(!setup.get()) { + lock.lock(); + lock.unlock(); + } + handleKeyEvent(event); } - handleKeyEvent(event); - } - }); + }); + } + } else { + String action = intent.getAction(); + if(DownloadServiceImpl.CANCEL_DOWNLOADS.equals(action)) { + downloadService.clearBackground(); + } } } } |