mirror of https://github.com/M66B/FairEmail.git
Favicon type
This commit is contained in:
parent
1ddc2ce36e
commit
692c1ed647
|
@ -385,14 +385,14 @@ public class ContactInfo {
|
||||||
futures.add(executorFavicon.submit(new Callable<Bitmap>() {
|
futures.add(executorFavicon.submit(new Callable<Bitmap>() {
|
||||||
@Override
|
@Override
|
||||||
public Bitmap call() throws Exception {
|
public Bitmap call() throws Exception {
|
||||||
return getFavicon(new URL(base, "favicon.ico"), scaleToPixels, context);
|
return getFavicon(new URL(base, "favicon.ico"), null, scaleToPixels, context);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
futures.add(executorFavicon.submit(new Callable<Bitmap>() {
|
futures.add(executorFavicon.submit(new Callable<Bitmap>() {
|
||||||
@Override
|
@Override
|
||||||
public Bitmap call() throws Exception {
|
public Bitmap call() throws Exception {
|
||||||
return getFavicon(new URL(www, "favicon.ico"), scaleToPixels, context);
|
return getFavicon(new URL(www, "favicon.ico"), null, scaleToPixels, context);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@ -577,7 +577,7 @@ public class ContactInfo {
|
||||||
futures.add(executorFavicon.submit(new Callable<Bitmap>() {
|
futures.add(executorFavicon.submit(new Callable<Bitmap>() {
|
||||||
@Override
|
@Override
|
||||||
public Bitmap call() throws Exception {
|
public Bitmap call() throws Exception {
|
||||||
return getFavicon(url, scaleToPixels, context);
|
return getFavicon(url, img.attr("type"), scaleToPixels, context);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
@ -597,7 +597,7 @@ public class ContactInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
private static Bitmap getFavicon(URL url, int scaleToPixels, Context context) throws IOException {
|
private static Bitmap getFavicon(URL url, String type, int scaleToPixels, Context context) throws IOException {
|
||||||
Log.i("GET favicon " + url);
|
Log.i("GET favicon " + url);
|
||||||
|
|
||||||
if (!"https".equals(url.getProtocol()))
|
if (!"https".equals(url.getProtocol()))
|
||||||
|
@ -622,6 +622,9 @@ public class ContactInfo {
|
||||||
if (status != HttpURLConnection.HTTP_OK)
|
if (status != HttpURLConnection.HTTP_OK)
|
||||||
throw new FileNotFoundException("Error " + status + ":" + connection.getResponseMessage());
|
throw new FileNotFoundException("Error " + status + ":" + connection.getResponseMessage());
|
||||||
|
|
||||||
|
if ("image/svg+xml".equals(type) || url.getPath().endsWith(".svg"))
|
||||||
|
; // Android does not support SVG
|
||||||
|
|
||||||
Bitmap bitmap = ImageHelper.getScaledBitmap(connection.getInputStream(), url.toString(), scaleToPixels);
|
Bitmap bitmap = ImageHelper.getScaledBitmap(connection.getInputStream(), url.toString(), scaleToPixels);
|
||||||
if (bitmap == null)
|
if (bitmap == null)
|
||||||
throw new FileNotFoundException("decodeStream");
|
throw new FileNotFoundException("decodeStream");
|
||||||
|
|
Loading…
Reference in New Issue