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.
This commit is contained in:
mvp76 2017-03-20 12:10:13 +01:00
parent dcf41bcdf2
commit 3f04606fcc

View File

@ -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();
}
}
}