Lookuo contact info when needed only

pull/209/head
M66B 3 years ago
parent 867de1e813
commit 895751cd91

@ -256,6 +256,8 @@ public class ContactInfo {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean avatars = prefs.getBoolean("avatars", true); boolean avatars = prefs.getBoolean("avatars", true);
boolean prefer_contact = prefs.getBoolean("prefer_contact", false);
boolean distinguish_contacts = prefs.getBoolean("distinguish_contacts", false);
boolean bimi = prefs.getBoolean("bimi", false); boolean bimi = prefs.getBoolean("bimi", false);
boolean gravatars = (prefs.getBoolean("gravatars", false) && !BuildConfig.PLAY_STORE_RELEASE); boolean gravatars = (prefs.getBoolean("gravatars", false) && !BuildConfig.PLAY_STORE_RELEASE);
boolean libravatars = (prefs.getBoolean("libravatars", false) && !BuildConfig.PLAY_STORE_RELEASE); boolean libravatars = (prefs.getBoolean("libravatars", false) && !BuildConfig.PLAY_STORE_RELEASE);
@ -266,6 +268,7 @@ public class ContactInfo {
// Contact photo // Contact photo
if (!TextUtils.isEmpty(info.email) && if (!TextUtils.isEmpty(info.email) &&
(avatars || prefer_contact || distinguish_contacts) &&
Helper.hasPermission(context, Manifest.permission.READ_CONTACTS)) { Helper.hasPermission(context, Manifest.permission.READ_CONTACTS)) {
ContentResolver resolver = context.getContentResolver(); ContentResolver resolver = context.getContentResolver();
Uri uri = Uri.withAppendedPath( Uri uri = Uri.withAppendedPath(
@ -308,7 +311,8 @@ public class ContactInfo {
// Favicon // Favicon
if (info.bitmap == null && if (info.bitmap == null &&
!EntityFolder.JUNK.equals(folderType) && (bimi || gravatars || libravatars || favicons)) { (bimi || gravatars || libravatars || favicons) &&
!EntityFolder.JUNK.equals(folderType)) {
String d = UriHelper.getEmailDomain(info.email); String d = UriHelper.getEmailDomain(info.email);
if (d != null) { if (d != null) {
// Prevent using Doodles // Prevent using Doodles

@ -899,7 +899,8 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
@Override @Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("prefer_contact", checked).apply(); prefs.edit().putBoolean("prefer_contact", checked).apply();
WidgetUnified.updateData(getContext()); ContactInfo.clearCache(compoundButton.getContext());
WidgetUnified.updateData(compoundButton.getContext());
} }
}); });
@ -907,7 +908,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
@Override @Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("only_contact", checked).apply(); prefs.edit().putBoolean("only_contact", checked).apply();
WidgetUnified.updateData(getContext()); WidgetUnified.updateData(compoundButton.getContext());
} }
}); });
@ -915,7 +916,8 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
@Override @Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("distinguish_contacts", checked).apply(); prefs.edit().putBoolean("distinguish_contacts", checked).apply();
WidgetUnified.updateData(getContext()); ContactInfo.clearCache(compoundButton.getContext());
WidgetUnified.updateData(compoundButton.getContext());
} }
}); });

Loading…
Cancel
Save