further simplification of Downloader based on Uri
missed this in df08e84e7829652d7999eee5451080a012b00a1e
This commit is contained in:
parent
401d094af1
commit
3f3ff5ffd7
@ -82,8 +82,7 @@ public class IndexV1Updater extends RepoUpdater {
|
||||
Downloader downloader = null;
|
||||
try {
|
||||
// read file name from file
|
||||
final Uri dataUri = Uri.parse(indexUrl);
|
||||
downloader = DownloaderFactory.create(context, dataUri.toString());
|
||||
downloader = DownloaderFactory.create(context, indexUrl);
|
||||
downloader.setCacheTag(repo.lastetag);
|
||||
downloader.setListener(downloadListener);
|
||||
downloader.download();
|
||||
@ -108,8 +107,7 @@ public class IndexV1Updater extends RepoUpdater {
|
||||
try {
|
||||
mirrorUrl = FDroidApp.getMirror(prevMirrorUrl, repo);
|
||||
prevMirrorUrl = mirrorUrl;
|
||||
Uri dataUri2 = Uri.parse(mirrorUrl);
|
||||
downloader = DownloaderFactory.create(context, dataUri2.toString());
|
||||
downloader = DownloaderFactory.create(context, mirrorUrl);
|
||||
downloader.setCacheTag(repo.lastetag);
|
||||
downloader.setListener(downloadListener);
|
||||
downloader.setTimeout(FDroidApp.getTimeout());
|
||||
|
@ -20,19 +20,14 @@ public class DownloaderFactory {
|
||||
throws IOException {
|
||||
File destFile = File.createTempFile("dl-", "", context.getCacheDir());
|
||||
destFile.deleteOnExit(); // this probably does nothing, but maybe...
|
||||
return create(context, urlString, destFile);
|
||||
Uri uri = Uri.parse(urlString);
|
||||
return create(context, uri, destFile);
|
||||
}
|
||||
|
||||
public static Downloader create(Context context, Uri uri, File destFile)
|
||||
throws IOException {
|
||||
return create(context, uri.toString(), destFile);
|
||||
}
|
||||
|
||||
public static Downloader create(Context context, String urlString, File destFile)
|
||||
throws IOException {
|
||||
Downloader downloader;
|
||||
|
||||
Uri uri = Uri.parse(urlString);
|
||||
String scheme = uri.getScheme();
|
||||
if ("bluetooth".equals(scheme)) {
|
||||
downloader = new BluetoothDownloader(uri, destFile);
|
||||
|
Loading…
x
Reference in New Issue
Block a user