From c76ca96b3da3f0456ef7262aa8ab1defa8dd14f0 Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Mon, 9 Jul 2018 21:50:42 +0200 Subject: shorten read markers to 'everyone has read up to this point' when > 4 user --- src/main/java/de/pixart/messenger/entities/ReadByMarker.java | 6 ++++++ src/main/java/de/pixart/messenger/ui/ConversationFragment.java | 2 ++ 2 files changed, 8 insertions(+) (limited to 'src/main/java/de') diff --git a/src/main/java/de/pixart/messenger/entities/ReadByMarker.java b/src/main/java/de/pixart/messenger/entities/ReadByMarker.java index ec2d1aa73..86057c680 100644 --- a/src/main/java/de/pixart/messenger/entities/ReadByMarker.java +++ b/src/main/java/de/pixart/messenger/entities/ReadByMarker.java @@ -162,4 +162,10 @@ public class ReadByMarker { return true; } + public static boolean allUsersRepresented(Collection users, Set markers, ReadByMarker marker) { + HashSet markersCopy = new HashSet<>(markers); + markersCopy.add(marker); + return allUsersRepresented(users, markersCopy); + } + } diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java index 2458e4967..50ee10bf9 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java @@ -2522,6 +2522,8 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke final String body; if (size <= 4) { body = getString(R.string.contacts_have_read_up_to_this_point, UIHelper.concatNames(shownMarkers)); + } else if (ReadByMarker.allUsersRepresented(allUsers, markersForMessage, markerForSender)) { + body = getString(R.string.everyone_has_read_up_to_this_point); } else { body = getString(R.string.contacts_and_n_more_have_read_up_to_this_point, UIHelper.concatNames(shownMarkers, 3), size - 3); } -- cgit v1.2.3