From 307ab0939455623b704f35849875973e4fea0708 Mon Sep 17 00:00:00 2001 From: daniel oeh Date: Sun, 17 Jun 2012 14:16:54 +0200 Subject: Cancelling a download will now notify the download service --- src/de/podfetcher/storage/DownloadRequester.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/de') diff --git a/src/de/podfetcher/storage/DownloadRequester.java b/src/de/podfetcher/storage/DownloadRequester.java index 17b32bd93..6680ebda5 100644 --- a/src/de/podfetcher/storage/DownloadRequester.java +++ b/src/de/podfetcher/storage/DownloadRequester.java @@ -119,6 +119,7 @@ public class DownloadRequester { downloads.remove(f); f.setFile_url(null); } + notifyDownloadService(context); } } @@ -180,6 +181,7 @@ public class DownloadRequester { * ------------- */ private DownloadService mService = null; + private Context mContext = null; boolean mIsBound; private ServiceConnection mConnection = new ServiceConnection() { @@ -187,10 +189,13 @@ public class DownloadRequester { mService = ((DownloadService.LocalBinder) service).getService(); Log.d(TAG, "Connection to service established"); mService.queryDownloads(); + mContext.unbindService(mConnection); } public void onServiceDisconnected(ComponentName className) { mService = null; + mIsBound = false; + mContext = null; Log.i(TAG, "Closed connection with DownloadService."); } }; @@ -199,9 +204,7 @@ public class DownloadRequester { public void notifyDownloadService(Context context) { context.bindService(new Intent(context, DownloadService.class), mConnection, Context.BIND_AUTO_CREATE); + mContext = context; mIsBound = true; - - context.unbindService(mConnection); - mIsBound = false; } } -- cgit v1.2.3