Added Libravatar support

This commit is contained in:
M66B
2022-03-08 10:20:57 +01:00
parent 32921af0de
commit fb52254c73
6 changed files with 113 additions and 8 deletions

View File

@@ -106,6 +106,8 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private SwitchCompat swBimi;
private SwitchCompat swGravatars;
private TextView tvGravatarsHint;
private SwitchCompat swLibravatars;
private ImageButton ibLibravatars;
private SwitchCompat swFavicons;
private SwitchCompat swFaviconsPartial;
private TextView tvFaviconsHint;
@@ -184,7 +186,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
"nav_options", "nav_count", "nav_unseen_drafts", "nav_count_pinned", "navbar_colorize",
"threading", "threading_unread", "indentation", "seekbar", "actionbar", "actionbar_color",
"highlight_unread", "highlight_color", "color_stripe", "color_stripe_wide",
"avatars", "bimi", "gravatars", "favicons", "favicons_partial", "generated_icons", "identicons",
"avatars", "bimi", "gravatars", "libravatars", "favicons", "favicons_partial", "generated_icons", "identicons",
"circular", "saturation", "brightness", "threshold",
"email_format", "prefer_contact", "only_contact", "distinguish_contacts", "show_recipients",
"font_size_sender", "sender_ellipsize",
@@ -254,6 +256,8 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
ibBimi = view.findViewById(R.id.ibBimi);
swGravatars = view.findViewById(R.id.swGravatars);
tvGravatarsHint = view.findViewById(R.id.tvGravatarsHint);
swLibravatars = view.findViewById(R.id.swLibravatars);
ibLibravatars = view.findViewById(R.id.ibLibravatars);
swFavicons = view.findViewById(R.id.swFavicons);
swFaviconsPartial = view.findViewById(R.id.swFaviconsPartial);
tvFaviconsHint = view.findViewById(R.id.tvFaviconsHint);
@@ -712,6 +716,21 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
}
});
swLibravatars.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("libravatars", checked).apply();
ContactInfo.clearCache(compoundButton.getContext());
}
});
ibLibravatars.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Helper.view(v.getContext(), Uri.parse(BuildConfig.LIBRAVATAR_INFO), true);
}
});
swFavicons.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@@ -1302,6 +1321,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swAvatars.setChecked(prefs.getBoolean("avatars", true));
swBimi.setChecked(prefs.getBoolean("bimi", false));
swGravatars.setChecked(prefs.getBoolean("gravatars", false));
swLibravatars.setChecked(prefs.getBoolean("libravatars", false));
swFavicons.setChecked(prefs.getBoolean("favicons", false));
swFaviconsPartial.setChecked(prefs.getBoolean("favicons_partial", true));
swFaviconsPartial.setEnabled(swFavicons.isChecked());