From 2578e6bdffe176f27bf831fa430abca5978301a8 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Wed, 23 Mar 2016 14:03:29 +0100 Subject: [PATCH] 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. --- .../org/fdroid/fdroid/net/ApkDownloader.java | 2 +- .../fdroid/fdroid/net/DownloaderFactory.java | 25 +++---------------- 2 files changed, 4 insertions(+), 23 deletions(-) diff --git a/app/src/main/java/org/fdroid/fdroid/net/ApkDownloader.java b/app/src/main/java/org/fdroid/fdroid/net/ApkDownloader.java index 7698c2ccd..8e54f1d87 100644 --- a/app/src/main/java/org/fdroid/fdroid/net/ApkDownloader.java +++ b/app/src/main/java/org/fdroid/fdroid/net/ApkDownloader.java @@ -197,7 +197,7 @@ public class ApkDownloader implements AsyncDownloader.Listener { Utils.debugLog(TAG, "Downloading apk from " + remoteAddress + " to " + localFile); 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(); return true; } catch (IOException e) { diff --git a/app/src/main/java/org/fdroid/fdroid/net/DownloaderFactory.java b/app/src/main/java/org/fdroid/fdroid/net/DownloaderFactory.java index b65001cb8..d50896a43 100644 --- a/app/src/main/java/org/fdroid/fdroid/net/DownloaderFactory.java +++ b/app/src/main/java/org/fdroid/fdroid/net/DownloaderFactory.java @@ -22,29 +22,9 @@ public class DownloaderFactory { */ public static Downloader create(Context context, String urlString) 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()); destFile.deleteOnExit(); // this probably does nothing, but maybe... - return create(context, url, destFile); - } - - 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); + return create(context, new URL(urlString), destFile, null); } public static Downloader create(Context context, URL url, File destFile, Credentials credentials) @@ -84,7 +64,8 @@ public class DownloaderFactory { 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); return new AsyncDownloadWrapper(create(context, url, destFile, credentials), listener); }