Added optional DDG icons

This commit is contained in:
M66B
2024-07-08 08:27:56 +02:00
parent da0ab65211
commit 1873b57096
6 changed files with 92 additions and 9 deletions

View File

@@ -285,6 +285,7 @@ public class ContactInfo {
boolean gravatars = (prefs.getBoolean("gravatars", false) && (!favicons_dmarc || dmarc) && !BuildConfig.PLAY_STORE_RELEASE);
boolean libravatars = (prefs.getBoolean("libravatars", false) && (!favicons_dmarc || dmarc) && !BuildConfig.PLAY_STORE_RELEASE);
boolean favicons = (prefs.getBoolean("favicons", false) && (!favicons_dmarc || dmarc));
boolean ddg_icons = (prefs.getBoolean("ddg_icons", false) && (!favicons_dmarc || dmarc) && !BuildConfig.PLAY_STORE_RELEASE);
boolean generated = prefs.getBoolean("generated_icons", true);
boolean identicons = prefs.getBoolean("identicons", false);
boolean circular = prefs.getBoolean("circular", true);
@@ -475,6 +476,18 @@ public class ContactInfo {
}
}
if (ddg_icons && !TextUtils.isEmpty(Avatar.DDG_URI))
futures.add(Helper.getDownloadTaskExecutor().submit(new Callable<Favicon>() {
@Override
public Favicon call() throws Exception {
String parent = UriHelper.getRootDomain(context, domain);
String uri = Avatar.DDG_URI + Uri.encode(parent) + ".ico";
Favicon ddg = getFavicon(new URL(uri), null, scaleToPixels, context);
ddg.type = "ddg";
return ddg;
}
}));
Throwable ex = null;
for (Future<Favicon> future : futures)
try {