From 3f04606fcc39ea29df7357cb9b908006586d2878 Mon Sep 17 00:00:00 2001 From: mvp76 Date: Mon, 20 Mar 2017 12:10:13 +0100 Subject: [PATCH] Extend IconDownloader to handle asset:// protocol This is currently needed for screenshot placeholders, but might be useful in the future as well. Note that the default BaseImageDownloaded supports this, as well as content:// and drawable:// protocols. --- .../main/java/org/fdroid/fdroid/net/IconDownloader.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/fdroid/fdroid/net/IconDownloader.java b/app/src/main/java/org/fdroid/fdroid/net/IconDownloader.java index 943b23cb7..1ba751f99 100644 --- a/app/src/main/java/org/fdroid/fdroid/net/IconDownloader.java +++ b/app/src/main/java/org/fdroid/fdroid/net/IconDownloader.java @@ -17,7 +17,11 @@ public class IconDownloader implements ImageDownloader { @Override public InputStream getStream(String imageUri, Object extra) throws IOException { - return DownloaderFactory.create(context, imageUri).getInputStream(); + switch (Scheme.ofUri(imageUri)) { + case ASSETS: + return context.getAssets().open(Scheme.ASSETS.crop(imageUri)); + default: + return DownloaderFactory.create(context, imageUri).getInputStream(); + } } - }