diff --git a/CHANGELOG.md b/CHANGELOG.md index cd1093f9e..5e8857c6c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Unreleased +* display "Last Seen" information instead of email address in contact list for contacts with green-checkmark, like in other popular messengers * hide superfluous "Show Classic E-mails" advanced setting for chatmail * remove mostly non-telling transport addresses when referring to a contact; the contact's profile gives a much better overview diff --git a/src/main/java/org/thoughtcrime/securesms/contacts/ContactSelectionListItem.java b/src/main/java/org/thoughtcrime/securesms/contacts/ContactSelectionListItem.java index 28d627254..67da79e34 100644 --- a/src/main/java/org/thoughtcrime/securesms/contacts/ContactSelectionListItem.java +++ b/src/main/java/org/thoughtcrime/securesms/contacts/ContactSelectionListItem.java @@ -18,6 +18,7 @@ import org.thoughtcrime.securesms.contacts.avatars.ResourceContactPhoto; import org.thoughtcrime.securesms.mms.GlideRequests; import org.thoughtcrime.securesms.recipients.Recipient; import org.thoughtcrime.securesms.recipients.RecipientModifiedListener; +import org.thoughtcrime.securesms.util.DateUtils; import org.thoughtcrime.securesms.util.ThemeUtil; import org.thoughtcrime.securesms.util.Util; import org.thoughtcrime.securesms.util.ViewUtil; @@ -109,6 +110,19 @@ public class ContactSelectionListItem extends LinearLayout implements RecipientM this.nameView.setEnabled(true); this.nameView.setText(name==null? "#" : name); + if (contact != null && contact.isVerified()) { + if (contact.isBot()) { + number = getContext().getString(R.string.bot); + } else { + long timestamp = contact.getLastSeen(); + if (timestamp != 0) { + number = getContext().getString(R.string.last_seen_at, DateUtils.getExtendedTimeSpanString(getContext(), timestamp)); + } else { + number = null; + } + } + } + if(number!=null) { this.numberView.setText(number); this.labelView.setText(label==null? "" : label);