1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2025-02-27 16:33:47 +00:00

Fixed jitter

This commit is contained in:
M66B 2019-12-23 10:03:40 +01:00
parent 4f9453c22e
commit 75ce2a4250

View file

@ -1056,14 +1056,17 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibAvatar.setTag(lookupUri); ibAvatar.setTag(lookupUri);
ibAvatar.setEnabled(lookupUri != null); ibAvatar.setEnabled(lookupUri != null);
if (addresses != null && addresses.length == 1) { // Updating in message lists causes jitter
if (viewType == ViewType.THREAD) {
String displayName = info.getDisplayName(); String displayName = info.getDisplayName();
if (!TextUtils.isEmpty(displayName)) { if (!TextUtils.isEmpty(displayName) &&
addresses != null && addresses.length == 1) {
String email = ((InternetAddress) addresses[0]).getAddress();
String personal = ((InternetAddress) addresses[0]).getPersonal(); String personal = ((InternetAddress) addresses[0]).getPersonal();
if (TextUtils.isEmpty(personal)) if (TextUtils.isEmpty(personal) || !personal.equals(displayName))
try { try {
((InternetAddress) addresses[0]).setPersonal(displayName); InternetAddress a = new InternetAddress(email, displayName);
tvFrom.setText(MessageHelper.formatAddresses(addresses, name_email, false)); tvFrom.setText(MessageHelper.formatAddresses(new Address[]{a}, name_email, false));
} catch (UnsupportedEncodingException ex) { } catch (UnsupportedEncodingException ex) {
Log.w(ex); Log.w(ex);
} }