shorten read markers to 'everyone has read up to this point' when > 4 user
This commit is contained in:
parent
559852002e
commit
3218ca3fe3
|
@ -6,6 +6,7 @@ import org.json.JSONObject;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import rocks.xmpp.addr.Jid;
|
import rocks.xmpp.addr.Jid;
|
||||||
|
@ -162,4 +163,10 @@ public class ReadByMarker {
|
||||||
return true;
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2197,6 +2197,8 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
|
||||||
final String body;
|
final String body;
|
||||||
if (size <= 4) {
|
if (size <= 4) {
|
||||||
body = getString(R.string.contacts_have_read_up_to_this_point, UIHelper.concatNames(shownMarkers));
|
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 {
|
} else {
|
||||||
body = getString(R.string.contacts_and_n_more_have_read_up_to_this_point, UIHelper.concatNames(shownMarkers, 3), size - 3);
|
body = getString(R.string.contacts_and_n_more_have_read_up_to_this_point, UIHelper.concatNames(shownMarkers, 3), size - 3);
|
||||||
}
|
}
|
||||||
|
|
|
@ -237,6 +237,7 @@
|
||||||
<string name="contact_has_read_up_to_this_point">%s has read up to this point</string>
|
<string name="contact_has_read_up_to_this_point">%s has read up to this point</string>
|
||||||
<string name="contacts_have_read_up_to_this_point">%s have read up to this point</string>
|
<string name="contacts_have_read_up_to_this_point">%s have read up to this point</string>
|
||||||
<string name="contacts_and_n_more_have_read_up_to_this_point">%1$s +%2$d more have read up to this point</string>
|
<string name="contacts_and_n_more_have_read_up_to_this_point">%1$s +%2$d more have read up to this point</string>
|
||||||
|
<string name="everyone_has_read_up_to_this_point">Everyone has read up to this point</string>
|
||||||
<string name="publish">Publish</string>
|
<string name="publish">Publish</string>
|
||||||
<string name="touch_to_choose_picture">Touch avatar to select picture from gallery</string>
|
<string name="touch_to_choose_picture">Touch avatar to select picture from gallery</string>
|
||||||
<string name="publishing">Publishing…</string>
|
<string name="publishing">Publishing…</string>
|
||||||
|
|
Loading…
Reference in a new issue