@Test public void testDownload() throws Exception { int downloadId = downloadManager.add(request); assertEquals(1, downloadId); }
public int add(DownloadRequest request) { request = checkNotNull(request, "request == null"); if (isDownloading(request.uri().toString())) { return -1; } request.context(context); request.downloader(downloader.copy()); return downloadRequestQueue.add(request) ? request.downloadId() : -1; }
DownloadManager { public int add(DownloadRequest request) { request = checkNotNull(request, "request == null"); if (isDownloading(request.uri().toString())) { return -1; } request.context(context); request.downloader(downloader.copy()); return downloadRequestQueue.add(request) ? request.downloadId() : -1; } }
DownloadManager { public int add(DownloadRequest request) { request = checkNotNull(request, "request == null"); if (isDownloading(request.uri().toString())) { return -1; } request.context(context); request.downloader(downloader.copy()); return downloadRequestQueue.add(request) ? request.downloadId() : -1; } DownloadManager(Builder builder); }
DownloadManager { public int add(DownloadRequest request) { request = checkNotNull(request, "request == null"); if (isDownloading(request.uri().toString())) { return -1; } request.context(context); request.downloader(downloader.copy()); return downloadRequestQueue.add(request) ? request.downloadId() : -1; } DownloadManager(Builder builder); int add(DownloadRequest request); DownloadState query(int downloadId); boolean isDownloading(int downloadId); boolean isDownloading(String url); int getTaskSize(); boolean cancel(int downloadId); void cancelAll(); void release(); Builder newBuilder(); }
DownloadManager { public int add(DownloadRequest request) { request = checkNotNull(request, "request == null"); if (isDownloading(request.uri().toString())) { return -1; } request.context(context); request.downloader(downloader.copy()); return downloadRequestQueue.add(request) ? request.downloadId() : -1; } DownloadManager(Builder builder); int add(DownloadRequest request); DownloadState query(int downloadId); boolean isDownloading(int downloadId); boolean isDownloading(String url); int getTaskSize(); boolean cancel(int downloadId); void cancelAll(); void release(); Builder newBuilder();  }