mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-28 09:38:14 +03:00
Merge pull request #2951 from nextcloud/feature/2860/groupMentions
Group mentions
This commit is contained in:
commit
907012e19a
5 changed files with 13 additions and 7 deletions
|
@ -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 a new issue