diff --git a/app/src/main/java/eu/faircode/email/ContactInfo.java b/app/src/main/java/eu/faircode/email/ContactInfo.java index 0d6d90e8cc..2ba4013f0a 100644 --- a/app/src/main/java/eu/faircode/email/ContactInfo.java +++ b/app/src/main/java/eu/faircode/email/ContactInfo.java @@ -640,6 +640,7 @@ public class ContactInfo { private static Favicon parseFavicon(URL base, int scaleToPixels, Context context) throws IOException { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); boolean favicons_partial = prefs.getBoolean("favicons_partial", true); + boolean favicons_manifest = prefs.getBoolean("favicons_manifest", false); Log.i("PARSE favicon " + base); HttpURLConnection connection = ConnectionHelper @@ -681,7 +682,7 @@ public class ContactInfo { imgs.addAll(doc.head().select("meta[itemprop=image]")); // https://developer.mozilla.org/en-US/docs/Web/Manifest/icons - if (imgs.size() == 0 || BuildConfig.DEBUG) + if (imgs.size() == 0 || favicons_manifest) for (Element manifest : doc.head().select("link[rel=manifest]")) try { String href = manifest.attr("href"); diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsDisplay.java b/app/src/main/java/eu/faircode/email/FragmentOptionsDisplay.java index ce3a52394e..00f2cac33c 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsDisplay.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsDisplay.java @@ -121,6 +121,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer private TextView tvLibravatarPrivacy; private SwitchCompat swFavicons; private SwitchCompat swFaviconsPartial; + private SwitchCompat swFaviconsManifest; private TextView tvFaviconsHint; private SwitchCompat swGeneratedIcons; private SwitchCompat swIdenticons; @@ -205,7 +206,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer "hide_toolbar", "nav_options", "nav_categories", "nav_last_sync", "nav_count", "nav_unseen_drafts", "nav_count_pinned", "navbar_colorize", "threading", "threading_unread", "indentation", "seekbar", "actionbar", "actionbar_swap", "actionbar_color", "highlight_unread", "highlight_color", "color_stripe", "color_stripe_wide", - "avatars", "bimi", "gravatars", "libravatars", "favicons", "favicons_partial", "generated_icons", "identicons", + "avatars", "bimi", "gravatars", "libravatars", "favicons", "favicons_partial", "favicons_manifest", "generated_icons", "identicons", "circular", "saturation", "brightness", "threshold", "email_format", "prefer_contact", "only_contact", "distinguish_contacts", "show_recipients", "font_size_sender", "sender_ellipsize", @@ -290,6 +291,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer tvLibravatarPrivacy = view.findViewById(R.id.tvLibravatarPrivacy); swFavicons = view.findViewById(R.id.swFavicons); swFaviconsPartial = view.findViewById(R.id.swFaviconsPartial); + swFaviconsManifest = view.findViewById(R.id.swFaviconsManifest); tvFaviconsHint = view.findViewById(R.id.tvFaviconsHint); swGeneratedIcons = view.findViewById(R.id.swGeneratedIcons); swIdenticons = view.findViewById(R.id.swIdenticons); @@ -849,6 +851,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { prefs.edit().putBoolean("favicons", checked).apply(); swFaviconsPartial.setEnabled(checked); + swFaviconsManifest.setEnabled(checked); ContactInfo.clearCache(compoundButton.getContext()); } }); @@ -861,6 +864,14 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer } }); + swFaviconsManifest.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { + prefs.edit().putBoolean("favicons_manifest", checked).apply(); + ContactInfo.clearCache(compoundButton.getContext()); + } + }); + tvFaviconsHint.getPaint().setUnderlineText(true); tvFaviconsHint.setOnClickListener(new View.OnClickListener() { @Override @@ -1498,6 +1509,8 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer swFavicons.setChecked(prefs.getBoolean("favicons", false)); swFaviconsPartial.setChecked(prefs.getBoolean("favicons_partial", true)); swFaviconsPartial.setEnabled(swFavicons.isChecked()); + swFaviconsManifest.setChecked(prefs.getBoolean("favicons_manifest", false)); + swFaviconsManifest.setEnabled(swFavicons.isChecked()); swGeneratedIcons.setChecked(prefs.getBoolean("generated_icons", true)); swIdenticons.setChecked(prefs.getBoolean("identicons", false)); swIdenticons.setEnabled(swGeneratedIcons.isChecked()); diff --git a/app/src/main/res/layout/fragment_options_display.xml b/app/src/main/res/layout/fragment_options_display.xml index 5c48d895f1..edc0b2d800 100644 --- a/app/src/main/res/layout/fragment_options_display.xml +++ b/app/src/main/res/layout/fragment_options_display.xml @@ -1103,6 +1103,20 @@ app:layout_constraintTop_toBottomOf="@id/tvFaviconsHint" app:switchPadding="12dp" /> + + Show Libravatars Show favicons Scan only the first %1$s of the web page + Scan web app manifests Show generated icons Show identicons Show round icons