do not show last-seen metric in UI
This commit is contained in:
parent
488780d2ce
commit
27b245ac35
|
@ -48,16 +48,12 @@ public abstract class AbstractParser {
|
||||||
return dateFormat.parse(timestamp);
|
return dateFormat.parse(timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateLastseen(final AbstractStanza packet, final Account account, final boolean presenceOverwrite) {
|
protected void updateLastseen(long timestamp, final Account account, final Jid from) {
|
||||||
updateLastseen(getTimestamp(packet), account, packet.getFrom(), presenceOverwrite);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void updateLastseen(long timestamp, final Account account, final Jid from, final boolean presenceOverwrite) {
|
|
||||||
final String presence = from == null || from.isBareJid() ? "" : from.getResourcepart();
|
final String presence = from == null || from.isBareJid() ? "" : from.getResourcepart();
|
||||||
final Contact contact = account.getRoster().getContact(from);
|
final Contact contact = account.getRoster().getContact(from);
|
||||||
if (timestamp >= contact.lastseen.time) {
|
if (timestamp >= contact.lastseen.time) {
|
||||||
contact.lastseen.time = timestamp;
|
contact.lastseen.time = timestamp;
|
||||||
if (!presence.isEmpty() && presenceOverwrite) {
|
if (!presence.isEmpty()) {
|
||||||
contact.lastseen.presence = presence;
|
contact.lastseen.presence = presence;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -395,14 +395,11 @@ public class MessageParser extends AbstractParser implements
|
||||||
if (conversation.getMode() == Conversation.MODE_MULTI) {
|
if (conversation.getMode() == Conversation.MODE_MULTI) {
|
||||||
Jid trueCounterpart = conversation.getMucOptions().getTrueCounterpart(counterpart.getResourcepart());
|
Jid trueCounterpart = conversation.getMucOptions().getTrueCounterpart(counterpart.getResourcepart());
|
||||||
message.setTrueCounterpart(trueCounterpart);
|
message.setTrueCounterpart(trueCounterpart);
|
||||||
if (trueCounterpart != null) {
|
|
||||||
updateLastseen(timestamp, account, trueCounterpart, false);
|
|
||||||
}
|
|
||||||
if (!isTypeGroupChat) {
|
if (!isTypeGroupChat) {
|
||||||
message.setType(Message.TYPE_PRIVATE);
|
message.setType(Message.TYPE_PRIVATE);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
updateLastseen(timestamp, account, packet.getFrom(), true);
|
updateLastseen(timestamp, account, from);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (replacementId != null && mXmppConnectionService.allowMessageCorrection()) {
|
if (replacementId != null && mXmppConnectionService.allowMessageCorrection()) {
|
||||||
|
@ -543,7 +540,7 @@ public class MessageParser extends AbstractParser implements
|
||||||
mXmppConnectionService.markRead(conversation);
|
mXmppConnectionService.markRead(conversation);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
updateLastseen(timestamp, account, packet.getFrom(), true);
|
updateLastseen(timestamp, account, from);
|
||||||
final Message displayedMessage = mXmppConnectionService.markMessage(account, from.toBareJid(), displayed.getAttribute("id"), Message.STATUS_SEND_DISPLAYED);
|
final Message displayedMessage = mXmppConnectionService.markMessage(account, from.toBareJid(), displayed.getAttribute("id"), Message.STATUS_SEND_DISPLAYED);
|
||||||
Message message = displayedMessage == null ? null : displayedMessage.prev();
|
Message message = displayedMessage == null ? null : displayedMessage.prev();
|
||||||
while (message != null
|
while (message != null
|
||||||
|
|
|
@ -211,7 +211,6 @@ public class PresenceParser extends AbstractParser implements
|
||||||
contact.setPgpKeyId(pgp.fetchKeyId(account, msg, x.getContent()));
|
contact.setPgpKeyId(pgp.fetchKeyId(account, msg, x.getContent()));
|
||||||
}
|
}
|
||||||
boolean online = sizeBefore < contact.getPresences().size();
|
boolean online = sizeBefore < contact.getPresences().size();
|
||||||
updateLastseen(packet, account, false);
|
|
||||||
mXmppConnectionService.onContactStatusChanged.onContactStatusChanged(contact, online);
|
mXmppConnectionService.onContactStatusChanged.onContactStatusChanged(contact, online);
|
||||||
} else if (type.equals("unavailable")) {
|
} else if (type.equals("unavailable")) {
|
||||||
if (from.isBareJid()) {
|
if (from.isBareJid()) {
|
||||||
|
|
|
@ -2817,17 +2817,15 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean displayCaptchaRequest(Account account, String id, Data data, Bitmap captcha) {
|
public boolean displayCaptchaRequest(Account account, String id, Data data, Bitmap captcha) {
|
||||||
boolean rc = false;
|
|
||||||
if (mOnCaptchaRequested != null) {
|
if (mOnCaptchaRequested != null) {
|
||||||
DisplayMetrics metrics = getApplicationContext().getResources().getDisplayMetrics();
|
DisplayMetrics metrics = getApplicationContext().getResources().getDisplayMetrics();
|
||||||
Bitmap scaled = Bitmap.createScaledBitmap(captcha, (int) (captcha.getWidth() * metrics.scaledDensity),
|
Bitmap scaled = Bitmap.createScaledBitmap(captcha, (int) (captcha.getWidth() * metrics.scaledDensity),
|
||||||
(int) (captcha.getHeight() * metrics.scaledDensity), false);
|
(int) (captcha.getHeight() * metrics.scaledDensity), false);
|
||||||
|
|
||||||
mOnCaptchaRequested.onCaptchaRequested(account, id, data, scaled);
|
mOnCaptchaRequested.onCaptchaRequested(account, id, data, scaled);
|
||||||
rc = true;
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
return rc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateBlocklistUi(final OnUpdateBlocklist.Status status) {
|
public void updateBlocklistUi(final OnUpdateBlocklist.Status status) {
|
||||||
|
|
|
@ -107,7 +107,6 @@ public class ContactDetailsActivity extends XmppActivity implements OnAccountUpd
|
||||||
private Jid contactJid;
|
private Jid contactJid;
|
||||||
private TextView contactJidTv;
|
private TextView contactJidTv;
|
||||||
private TextView accountJidTv;
|
private TextView accountJidTv;
|
||||||
private TextView lastseen;
|
|
||||||
private TextView statusMessage;
|
private TextView statusMessage;
|
||||||
private CheckBox send;
|
private CheckBox send;
|
||||||
private CheckBox receive;
|
private CheckBox receive;
|
||||||
|
@ -204,7 +203,6 @@ public class ContactDetailsActivity extends XmppActivity implements OnAccountUpd
|
||||||
|
|
||||||
contactJidTv = (TextView) findViewById(R.id.details_contactjid);
|
contactJidTv = (TextView) findViewById(R.id.details_contactjid);
|
||||||
accountJidTv = (TextView) findViewById(R.id.details_account);
|
accountJidTv = (TextView) findViewById(R.id.details_account);
|
||||||
lastseen = (TextView) findViewById(R.id.details_lastseen);
|
|
||||||
statusMessage = (TextView) findViewById(R.id.status_message);
|
statusMessage = (TextView) findViewById(R.id.status_message);
|
||||||
send = (CheckBox) findViewById(R.id.details_send_presence);
|
send = (CheckBox) findViewById(R.id.details_send_presence);
|
||||||
receive = (CheckBox) findViewById(R.id.details_receive_presence);
|
receive = (CheckBox) findViewById(R.id.details_receive_presence);
|
||||||
|
@ -373,12 +371,6 @@ public class ContactDetailsActivity extends XmppActivity implements OnAccountUpd
|
||||||
statusMessage.setVisibility(View.GONE);
|
statusMessage.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (contact.isBlocked() && !this.showDynamicTags) {
|
|
||||||
lastseen.setText(R.string.contact_blocked);
|
|
||||||
} else {
|
|
||||||
lastseen.setText(UIHelper.lastseen(getApplicationContext(), contact.lastseen.time));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (contact.getPresences().size() > 1) {
|
if (contact.getPresences().size() > 1) {
|
||||||
contactJidTv.setText(contact.getDisplayJid() + " ("
|
contactJidTv.setText(contact.getDisplayJid() + " ("
|
||||||
+ contact.getPresences().size() + ")");
|
+ contact.getPresences().size() + ")");
|
||||||
|
|
|
@ -53,19 +53,12 @@
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/details_lastseen"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textColor="@color/black54"
|
|
||||||
android:textSize="?attr/TextSizeBody" />
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
android:id="@+id/status_message"
|
android:id="@+id/status_message"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textColor="@color/black87"
|
android:textColor="@color/black54"
|
||||||
android:textStyle="italic"
|
android:textStyle="italic"
|
||||||
android:textSize="?attr/TextSizeBody" />
|
android:textSize="?attr/TextSizeBody" />
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue