improve coversation title's subtitle

This commit is contained in:
adbenitez
2024-01-20 02:46:34 -05:00
parent b1df4a70b2
commit 9fa07fe8f3
7 changed files with 25 additions and 15 deletions
+1
View File
@@ -56,6 +56,7 @@ public class DcContact {
public native long getLastSeen ();
public native boolean wasSeenRecently();
public native boolean isBlocked ();
public native boolean isBot ();
public native boolean isVerified ();
public native int getVerifierId ();
@@ -255,8 +255,6 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
if (!isMultiUser()) {
eventCenter.addObserver(DcContext.DC_EVENT_INCOMING_MSG, this);
eventCenter.addObserver(DcContext.DC_EVENT_MSG_READ, this);
// handle DC_EVENT_MSG_DELIVERED to hide the seen-recently indicator if needed:
eventCenter.addObserver(DcContext.DC_EVENT_MSG_DELIVERED, this);
}
handleRelaying();
@@ -1489,11 +1487,10 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
setComposePanelVisibility();
initializeContactRequest();
} else if ((eventId == DcContext.DC_EVENT_INCOMING_MSG
|| eventId == DcContext.DC_EVENT_MSG_READ
|| eventId == DcContext.DC_EVENT_MSG_DELIVERED)
|| eventId == DcContext.DC_EVENT_MSG_READ)
&& event.getData1Int() == chatId) {
DcContact contact = recipient.getDcContact();
titleView.setSeenRecently(contact!=null? dcContext.getContact(contact.getId()).wasSeenRecently() : false);
dcChat = dcContext.getChat(chatId);
titleView.setTitle(glideRequests, dcChat);
}
}
@@ -110,8 +110,13 @@ public class ConversationTitleView extends RelativeLayout {
}
else {
DcContact dcContact = dcContext.getContact(chatContacts[0]);
if (profileView || !dcChat.isProtected()) {
isOnline = dcContact.wasSeenRecently();
if (profileView) {
subtitleStr = dcContact.getAddr();
} else if (false && dcContact.isBot()) {
subtitleStr = context.getString(R.string.bot);
} else if (isOnline) {
subtitleStr = context.getString(R.string.online);
} else {
long timestamp = dcContact.getLastSeen();
if (timestamp != 0) {
@@ -119,7 +124,6 @@ public class ConversationTitleView extends RelativeLayout {
subtitleStr = context.getString(R.string.last_seen_at, DateUtils.getExtendedTimeSpanString(context, locale, timestamp));
}
}
isOnline = dcContact.wasSeenRecently();
}
}