aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2018-07-09 21:50:42 +0200
committerChristian Schneppe <christian@pix-art.de>2018-07-09 21:50:42 +0200
commitc76ca96b3da3f0456ef7262aa8ab1defa8dd14f0 (patch)
tree767d2c58ce73a80f934bd3d1da7149d7bcb092c1 /src/main/java/de
parent9b779b4456c402723dc559477d3d8d87a25d6265 (diff)
shorten read markers to 'everyone has read up to this point' when > 4 user
Diffstat (limited to 'src/main/java/de')
-rw-r--r--src/main/java/de/pixart/messenger/entities/ReadByMarker.java6
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConversationFragment.java2
2 files changed, 8 insertions, 0 deletions
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<MucOptions.User> users, Set<ReadByMarker> markers, ReadByMarker marker) {
+ HashSet<ReadByMarker> 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);
}