Add delete download item

This commit is contained in:
seven332 committed 2016-02-26 17:01:40 +08:00
1 parent ce797bcf24
commit a4b4de08da
11 files changed
+359 -81

No files matched your search

@@ -40,6 +40,7 @@ public class DownloadService extends Service implements DownloadManager.Download
public static final String ACTION_STOP = "stop";
public static final String ACTION_STOP_CURRENT = "stop_current";
public static final String ACTION_STOP_ALL = "stop_all";
public static final String ACTION_DELETE = "delete";
public static final String ACTION_CLEAR = "clear";
@@ -148,6 +149,11 @@ public class DownloadService extends Service implements DownloadManager.Download
if (mDownloadManager != null) {
mDownloadManager.stopAllDownload();
}
} else if (ACTION_DELETE.equals(action)) {
int gid = intent.getIntExtra(KEY_GID, -1);
if (gid != -1 && mDownloadManager != null) {
mDownloadManager.deleteDownload(gid);
}
} else if (ACTION_CLEAR.equals(action)) {
EhApplication.clearDownloadService(getApplicationContext(), this);
}