Support file schemes in SimpleBitmapLoader

Fixes #108
This commit is contained in:
birdbird 2022-07-06 07:17:46 +02:00 committed by GitHub
parent 2c7201024e
commit 6016418c33
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -89,6 +89,9 @@ public final class SimpleBitmapLoader implements BitmapLoader {
}
private static Bitmap load(Uri uri) throws IOException {
if (uri.getScheme().equals("file")) {
return BitmapFactory.decodeFile(uri.getPath());
}
URLConnection connection = new URL(uri.toString()).openConnection();
if (!(connection instanceof HttpURLConnection)) {
throw new UnsupportedOperationException("Unsupported scheme: " + uri.getScheme());