mirror of https://github.com/M66B/FairEmail.git
Favicon improvements
This commit is contained in:
parent
27d613810b
commit
0496bdb167
|
@ -419,11 +419,8 @@ public class ContactInfo {
|
|||
|
||||
if (favicons) {
|
||||
String host = domain;
|
||||
if (!host.startsWith("www."))
|
||||
host = "www." + host;
|
||||
while (host.indexOf('.') > 0) {
|
||||
final URL base = new URL("https://" + host);
|
||||
|
||||
futures.add(Helper.getDownloadTaskExecutor().submit(new Callable<Favicon>() {
|
||||
@Override
|
||||
public Favicon call() throws Exception {
|
||||
|
@ -431,16 +428,23 @@ public class ContactInfo {
|
|||
}
|
||||
}));
|
||||
|
||||
if (!host.startsWith("www.")) {
|
||||
final URL www = new URL("https://www." + host);
|
||||
futures.add(Helper.getDownloadTaskExecutor().submit(new Callable<Favicon>() {
|
||||
@Override
|
||||
public Favicon call() throws Exception {
|
||||
return parseFavicon(www, scaleToPixels, context);
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
int dot = host.indexOf('.');
|
||||
host = host.substring(dot + 1);
|
||||
}
|
||||
|
||||
host = domain;
|
||||
if (!host.startsWith("www."))
|
||||
host = "www." + host;
|
||||
while (host.indexOf('.') > 0) {
|
||||
final URL base = new URL("https://" + host);
|
||||
|
||||
for (String name : FIXED_FAVICONS)
|
||||
futures.add(Helper.getDownloadTaskExecutor().submit(new Callable<Favicon>() {
|
||||
@Override
|
||||
|
@ -449,6 +453,17 @@ public class ContactInfo {
|
|||
}
|
||||
}));
|
||||
|
||||
if (!host.startsWith("www.")) {
|
||||
final URL www = new URL("https://www." + host);
|
||||
for (String name : FIXED_FAVICONS)
|
||||
futures.add(Helper.getDownloadTaskExecutor().submit(new Callable<Favicon>() {
|
||||
@Override
|
||||
public Favicon call() throws Exception {
|
||||
return getFavicon(new URL(www, name), null, scaleToPixels, context);
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
int dot = host.indexOf('.');
|
||||
host = host.substring(dot + 1);
|
||||
}
|
||||
|
@ -906,6 +921,8 @@ public class ContactInfo {
|
|||
Bitmap bitmap = ImageHelper.getScaledBitmap(connection.getInputStream(), url.toString(), mimeType, scaleToPixels);
|
||||
if (bitmap == null)
|
||||
throw new FileNotFoundException("decodeStream");
|
||||
if (bitmap.getWidth() <= 1 || bitmap.getHeight() <= 1)
|
||||
throw new IOException("Too small");
|
||||
return new Favicon(bitmap, url.toString());
|
||||
} finally {
|
||||
connection.disconnect();
|
||||
|
|
Loading…
Reference in New Issue