aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2013-12-15 17:44:40 -0800
committerScott Jackson <daneren2005@gmail.com>2013-12-15 17:44:40 -0800
commitf47f0e9bd7ebec03169fd5489113be8802a7e44f (patch)
tree00dbac5ebc9e8f975335d64f1e49f85c5f4e5bac
parent467ee4c2ddc0f36f879b96f77b129d3cdac8de22 (diff)
downloaddsub-f47f0e9bd7ebec03169fd5489113be8802a7e44f.tar.gz
dsub-f47f0e9bd7ebec03169fd5489113be8802a7e44f.tar.bz2
dsub-f47f0e9bd7ebec03169fd5489113be8802a7e44f.zip
Run intentReceiver logic into eventHandler
-rw-r--r--src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java39
1 files changed, 22 insertions, 17 deletions
diff --git a/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java b/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java
index 563565b2..225e352b 100644
--- a/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java
+++ b/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java
@@ -73,23 +73,28 @@ public class DownloadServiceLifecycleSupport {
*/
private BroadcastReceiver intentReceiver = new BroadcastReceiver() {
@Override
- public void onReceive(Context context, Intent intent) {
- String action = intent.getAction();
- Log.i(TAG, "intentReceiver.onReceive: " + action);
- if (DownloadServiceImpl.CMD_PLAY.equals(action)) {
- downloadService.play();
- } else if (DownloadServiceImpl.CMD_NEXT.equals(action)) {
- downloadService.next();
- } else if (DownloadServiceImpl.CMD_PREVIOUS.equals(action)) {
- downloadService.previous();
- } else if (DownloadServiceImpl.CMD_TOGGLEPAUSE.equals(action)) {
- downloadService.togglePlayPause();
- } else if (DownloadServiceImpl.CMD_PAUSE.equals(action)) {
- downloadService.pause();
- } else if (DownloadServiceImpl.CMD_STOP.equals(action)) {
- downloadService.pause();
- downloadService.seekTo(0);
- }
+ public void onReceive(final Context context, final Intent intent) {
+ eventHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ String action = intent.getAction();
+ Log.i(TAG, "intentReceiver.onReceive: " + action);
+ if (DownloadServiceImpl.CMD_PLAY.equals(action)) {
+ downloadService.play();
+ } else if (DownloadServiceImpl.CMD_NEXT.equals(action)) {
+ downloadService.next();
+ } else if (DownloadServiceImpl.CMD_PREVIOUS.equals(action)) {
+ downloadService.previous();
+ } else if (DownloadServiceImpl.CMD_TOGGLEPAUSE.equals(action)) {
+ downloadService.togglePlayPause();
+ } else if (DownloadServiceImpl.CMD_PAUSE.equals(action)) {
+ downloadService.pause();
+ } else if (DownloadServiceImpl.CMD_STOP.equals(action)) {
+ downloadService.pause();
+ downloadService.seekTo(0);
+ }
+ }
+ });
}
};