mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-22 04:59:34 +01:00
add support for group mentions
Resolves #2860 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
62e8b1a9ba
commit
12a9f9b159
@ -58,6 +58,8 @@ public class MentionAutocompleteItem extends AbstractFlexibleItem<ParticipantIte
|
||||
public static final String SOURCE_CALLS = "calls";
|
||||
public static final String SOURCE_GUESTS = "guests";
|
||||
|
||||
public static final String SOURCE_GROUPS = "groups";
|
||||
|
||||
private String source;
|
||||
private final String objectId;
|
||||
private final String displayName;
|
||||
@ -153,7 +155,7 @@ public class MentionAutocompleteItem extends AbstractFlexibleItem<ParticipantIte
|
||||
holder.binding.secondaryText.setText("@" + objectId);
|
||||
}
|
||||
|
||||
if (SOURCE_CALLS.equals(source)) {
|
||||
if (SOURCE_CALLS.equals(source) || SOURCE_GROUPS.equals(source)) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
ImageViewExtensionsKt.loadAvatar(
|
||||
holder.binding.avatarView,
|
||||
|
@ -226,7 +226,7 @@ class IncomingTextMessageViewHolder(itemView: View, payload: Any) : MessageHolde
|
||||
val individualHashMap = message.messageParameters!![key]
|
||||
if (individualHashMap != null) {
|
||||
when (individualHashMap["type"]) {
|
||||
"user", "guest", "call" -> {
|
||||
"user", "guest", "call", "user-group" -> {
|
||||
val chip = if (individualHashMap["id"] == message.activeUser!!.userId) {
|
||||
R.xml.chip_you
|
||||
} else {
|
||||
|
@ -190,7 +190,7 @@ class OutcomingTextMessageViewHolder(itemView: View) : OutcomingTextMessageViewH
|
||||
val individualHashMap: HashMap<String?, String?>? = message.messageParameters!![key]
|
||||
if (individualHashMap != null) {
|
||||
when (individualHashMap["type"]) {
|
||||
"user", "guest", "call" -> {
|
||||
"user", "guest", "call", "user-group" -> {
|
||||
val chip = if (individualHashMap["id"] == message.activeUser!!.userId) {
|
||||
R.xml.chip_you
|
||||
} else {
|
||||
|
@ -2188,7 +2188,10 @@ class ChatActivity :
|
||||
for (i in mentionSpans.indices) {
|
||||
mentionSpan = mentionSpans[i]
|
||||
var mentionId = mentionSpan.id
|
||||
if (mentionId.contains(" ") || mentionId.startsWith("guest/")) {
|
||||
if (mentionId.contains(" ") ||
|
||||
mentionId.startsWith("guest/") ||
|
||||
mentionId.startsWith("group/")
|
||||
) {
|
||||
mentionId = "\"" + mentionId + "\""
|
||||
}
|
||||
editable.replace(editable.getSpanStart(mentionSpan), editable.getSpanEnd(mentionSpan), "@$mentionId")
|
||||
|
@ -182,9 +182,10 @@ public class DisplayUtils {
|
||||
|
||||
int drawable;
|
||||
|
||||
boolean isCall = "call".equals(type) || "calls".equals(type);
|
||||
boolean isCallOrGroup =
|
||||
"call".equals(type) || "calls".equals(type) || "groups".equals(type) || "user-group".equals(type);
|
||||
|
||||
if (!isCall) {
|
||||
if (!isCallOrGroup) {
|
||||
if (chipResource == R.xml.chip_you) {
|
||||
drawable = R.drawable.mention_chip;
|
||||
} else {
|
||||
@ -198,7 +199,7 @@ public class DisplayUtils {
|
||||
|
||||
chip.setBounds(0, 0, chip.getIntrinsicWidth(), chip.getIntrinsicHeight());
|
||||
|
||||
if (!isCall) {
|
||||
if (!isCallOrGroup) {
|
||||
String url = ApiUtils.getUrlForAvatar(conversationUser.getBaseUrl(), id, true);
|
||||
if ("guests".equals(type) || "guest".equals(type)) {
|
||||
url = ApiUtils.getUrlForGuestAvatar(
|
||||
|
Loading…
Reference in New Issue
Block a user