From 674d60243ac3fbe21720bc517bdecb57c96ba762 Mon Sep 17 00:00:00 2001 From: M66B Date: Wed, 1 Jul 2020 09:59:48 +0200 Subject: [PATCH] Prioritize hires favicon --- .../java/eu/faircode/email/ContactInfo.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/ContactInfo.java b/app/src/main/java/eu/faircode/email/ContactInfo.java index 0c0079974a..6f9deafeb9 100644 --- a/app/src/main/java/eu/faircode/email/ContactInfo.java +++ b/app/src/main/java/eu/faircode/email/ContactInfo.java @@ -306,8 +306,10 @@ public class ContactInfo { info.bitmap = BitmapFactory.decodeFile(file.getAbsolutePath()); else { URL base = new URL("https://" + domain); + URL www = new URL("https://www." + domain); + try { - info.bitmap = getFavicon(new URL(base, "favicon.ico")); + info.bitmap = parseFavicon(base); } catch (IOException ex) { if (ex instanceof SocketTimeoutException) throw ex; @@ -316,24 +318,30 @@ public class ContactInfo { if (info.bitmap == null) try { - info.bitmap = parseFavicon(base); + info.bitmap = parseFavicon(www); } catch (IOException ex) { if (ex instanceof SocketTimeoutException) throw ex; Log.i("Favicon ex=" + ex.getClass().getName() + " " + ex.getMessage()); } - URL www = new URL("https://www." + domain); if (info.bitmap == null) try { - info.bitmap = getFavicon(new URL(www, "favicon.ico")); + info.bitmap = getFavicon(new URL(base, "favicon.ico")); } catch (IOException ex) { if (ex instanceof SocketTimeoutException) throw ex; Log.i("Favicon ex=" + ex.getClass().getName() + " " + ex.getMessage()); } + if (info.bitmap == null) - info.bitmap = parseFavicon(www); + try { + info.bitmap = getFavicon(new URL(www, "favicon.ico")); + } catch (IOException ex) { + if (ex instanceof SocketTimeoutException) + throw ex; + Log.i("Favicon ex=" + ex.getClass().getName() + " " + ex.getMessage()); + } // Add to cache if (info.bitmap == null)