remove unused portions of DownloaderFactory

Since this is internal code and not a library for use with other projects,
it should only include the methods that are actually in use. The other
copies are just dead code, which means more stuff to read in order to
figure out.
This commit is contained in:
Hans-Christoph Steiner 2016-03-23 14:03:29 +01:00
parent 9d1743af33
commit 2578e6bdff
2 changed files with 4 additions and 23 deletions

View File

@ -197,7 +197,7 @@ public class ApkDownloader implements AsyncDownloader.Listener {
Utils.debugLog(TAG, "Downloading apk from " + remoteAddress + " to " + localFile); Utils.debugLog(TAG, "Downloading apk from " + remoteAddress + " to " + localFile);
try { try {
dlWrapper = DownloaderFactory.createAsync(context, remoteAddress, localFile, app.name + " " + curApk.version, curApk.packageName, credentials, this); dlWrapper = DownloaderFactory.createAsync(context, remoteAddress, localFile, credentials, this);
dlWrapper.download(); dlWrapper.download();
return true; return true;
} catch (IOException e) { } catch (IOException e) {

View File

@ -22,29 +22,9 @@ public class DownloaderFactory {
*/ */
public static Downloader create(Context context, String urlString) public static Downloader create(Context context, String urlString)
throws IOException { throws IOException {
return create(context, new URL(urlString));
}
/**
* Downloads to a temporary file, which *you must delete yourself when
* you are done. It is stored in {@link Context#getCacheDir()} and starts
* with the prefix {@code dl-}.
*/
public static Downloader create(Context context, URL url)
throws IOException {
File destFile = File.createTempFile("dl-", "", context.getCacheDir()); File destFile = File.createTempFile("dl-", "", context.getCacheDir());
destFile.deleteOnExit(); // this probably does nothing, but maybe... destFile.deleteOnExit(); // this probably does nothing, but maybe...
return create(context, url, destFile); return create(context, new URL(urlString), destFile, null);
}
public static Downloader create(Context context, String urlString, File destFile)
throws IOException {
return create(context, new URL(urlString), destFile);
}
public static Downloader create(Context context, URL url, File destFile)
throws IOException {
return create(context, url, destFile, null);
} }
public static Downloader create(Context context, URL url, File destFile, Credentials credentials) public static Downloader create(Context context, URL url, File destFile, Credentials credentials)
@ -84,7 +64,8 @@ public class DownloaderFactory {
return "file".equalsIgnoreCase(url.getProtocol()); return "file".equalsIgnoreCase(url.getProtocol());
} }
public static AsyncDownloader createAsync(Context context, String urlString, File destFile, String title, String id, Credentials credentials, AsyncDownloader.Listener listener) throws IOException { public static AsyncDownloader createAsync(Context context, String urlString, File destFile, Credentials credentials, AsyncDownloader.Listener listener)
throws IOException {
URL url = new URL(urlString); URL url = new URL(urlString);
return new AsyncDownloadWrapper(create(context, url, destFile, credentials), listener); return new AsyncDownloadWrapper(create(context, url, destFile, credentials), listener);
} }