From e3542ccf723b43ab260c1923c2633f0efd30b4c5 Mon Sep 17 00:00:00 2001 From: kosyak Date: Mon, 2 Sep 2024 01:08:27 +0200 Subject: [PATCH] take last seen into account during status indicator calculation --- .../ui/ContactDetailsActivity.java | 2 +- .../ui/adapter/ConversationAdapter.java | 2 +- .../ui/adapter/ListItemAdapter.java | 2 +- .../conversations/ui/adapter/UserAdapter.java | 2 +- .../ui/adapter/UserPreviewAdapter.java | 2 +- .../ui/widget/PresenceIndicator.kt | 22 +++++++++++++------ 6 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java index 8daffdbbc..37dd2e88d 100644 --- a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java @@ -523,7 +523,7 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp AvatarWorkerTask.loadAvatar(contact, binding.detailsContactBadge, R.dimen.avatar_on_details_screen_size); binding.detailsContactBadge.setOnClickListener(this::onBadgeClick); - binding.presenceIndicator.setStatus(contact.getShownStatus()); + binding.presenceIndicator.setStatus(contact); binding.detailsContactKeys.removeAllViews(); boolean hasKeys = false; diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java index 22a41b59b..bac12514b 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java @@ -393,7 +393,7 @@ public class ConversationAdapter Contact contact = conversation.getContact(); if (contact != null) { - viewHolder.binding.presenceIndicator.setStatus(contact.getShownStatus()); + viewHolder.binding.presenceIndicator.setStatus(contact); } else { viewHolder.binding.presenceIndicator.setStatus(null); } diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/ListItemAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/ListItemAdapter.java index 940d5cb2b..f9444a06c 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/ListItemAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/ListItemAdapter.java @@ -94,7 +94,7 @@ public class ListItemAdapter extends ArrayAdapter { AvatarWorkerTask.loadAvatar(item, viewHolder.avatar, R.dimen.avatar); if (item instanceof Contact) { - viewHolder.presenceIndicator.setStatus(((Contact) item).getShownStatus()); + viewHolder.presenceIndicator.setStatus(((Contact) item)); } else { viewHolder.presenceIndicator.setStatus(null); } diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/UserAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/UserAdapter.java index 525fec6f6..e1fbfa283 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/UserAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/UserAdapter.java @@ -91,7 +91,7 @@ public class UserAdapter extends ListAdapter 60)) { + this.status = null + } else { + this.status = status + } + + invalidate() + } + override fun onDraw(canvas: Canvas) { super.onDraw(canvas)