Fixed jitter

pull/170/head
M66B 6 years ago
parent 4f9453c22e
commit 75ce2a4250

@ -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);
} }

Loading…
Cancel
Save