Extract common code to isQueued and isActive.
This commit is contained in:
parent
7f1155816e
commit
bbf7cd81a6
@ -134,11 +134,9 @@ public class DownloaderService extends Service {
|
|||||||
if (ACTION_CANCEL.equals(intent.getAction())) {
|
if (ACTION_CANCEL.equals(intent.getAction())) {
|
||||||
Log.i(TAG, "Removed " + intent);
|
Log.i(TAG, "Removed " + intent);
|
||||||
Integer what = QUEUE_WHATS.remove(uriString);
|
Integer what = QUEUE_WHATS.remove(uriString);
|
||||||
if (what != null && serviceHandler.hasMessages(what)) {
|
if (isQueued(uriString)) {
|
||||||
// the URL is in the queue, remove it
|
|
||||||
serviceHandler.removeMessages(what);
|
serviceHandler.removeMessages(what);
|
||||||
} else if (downloader != null && TextUtils.equals(uriString, downloader.sourceUrl.toString())) {
|
} else if (isActive(uriString)) {
|
||||||
// the URL is being downloaded, cancel it
|
|
||||||
downloader.cancelDownload();
|
downloader.cancelDownload();
|
||||||
} else {
|
} else {
|
||||||
Log.e(TAG, "CANCEL called on something not queued or running: " + startId + " " + intent);
|
Log.e(TAG, "CANCEL called on something not queued or running: " + startId + " " + intent);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user