MCPcopy Create free account
hub / github.com/M66B/FairEmail / fillIn

Method fillIn

app/src/main/java/eu/faircode/email/ContactInfo.java:1116–1140  ·  view source on GitHub ↗
(Address[] addresses, boolean prefer_contact, boolean only_contact)

Source from the content-addressed store, hash-verified

1114 }
1115
1116 static Address[] fillIn(Address[] addresses, boolean prefer_contact, boolean only_contact) {
1117 if (addresses == null)
1118 return null;
1119
1120 Address[] modified = new Address[addresses.length];
1121 for (int i = 0; i < addresses.length; i++) {
1122 InternetAddress address = (InternetAddress) addresses[i];
1123 String email = address.getAddress();
1124 String personal = (only_contact ? null : address.getPersonal());
1125 if (!TextUtils.isEmpty(email)) {
1126 Lookup lookup = emailLookup.get(email.toLowerCase(Locale.ROOT));
1127 if (lookup != null &&
1128 (TextUtils.isEmpty(personal) || prefer_contact))
1129 personal = lookup.displayName;
1130 }
1131 try {
1132 modified[i] = new InternetAddress(email, personal, StandardCharsets.UTF_8.name());
1133 } catch (UnsupportedEncodingException ex) {
1134 Log.e(ex);
1135 modified[i] = address;
1136 }
1137 }
1138
1139 return modified;
1140 }
1141
1142 private static Map<String, Lookup> getEmailLookup(Context context) {
1143 Map<String, Lookup> all = new ConcurrentHashMap<>();

Callers 2

getViewAtMethod · 0.95
bindToMethod · 0.95

Calls 6

getAddressMethod · 0.95
getPersonalMethod · 0.95
eMethod · 0.95
isEmptyMethod · 0.45
getMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected