diff --git a/app/src/main/java/com/nextcloud/talk/adapters/items/MentionAutocompleteItem.java b/app/src/main/java/com/nextcloud/talk/adapters/items/MentionAutocompleteItem.java index 4bb634b54..97f997f48 100644 --- a/app/src/main/java/com/nextcloud/talk/adapters/items/MentionAutocompleteItem.java +++ b/app/src/main/java/com/nextcloud/talk/adapters/items/MentionAutocompleteItem.java @@ -45,18 +45,28 @@ import java.util.List; public class MentionAutocompleteItem extends AbstractFlexibleItem implements IFilterable { - private String userId; + private String objectId; private String displayName; + private String source; private UserEntity currentUser; - public MentionAutocompleteItem(String userId, String displayName, UserEntity currentUser) { - this.userId = userId; + public MentionAutocompleteItem(String objectId, String displayName, String source, UserEntity currentUser) { + this.objectId = objectId; this.displayName = displayName; + this.source = source; this.currentUser = currentUser; } - public String getUserId() { - return userId; + public String getSource() { + return source; + } + + public void setSource(String source) { + this.source = source; + } + + public String getObjectId() { + return objectId; } public String getDisplayName() { @@ -67,7 +77,7 @@ public class MentionAutocompleteItem extends AbstractFlexibleItem List internalAbstractFlexibleItemList = new ArrayList<>(); for (Mention mention : mentionsList) { internalAbstractFlexibleItemList.add( - new MentionAutocompleteItem(mention.getId(), mention.getLabel(), + new MentionAutocompleteItem(mention.getId(), + mention.getLabel(), mention.getSource(), currentUser)); } @@ -143,9 +144,9 @@ public class MentionAutocompletePresenter extends RecyclerViewPresenter Mention mention = new Mention(); MentionAutocompleteItem mentionAutocompleteItem = (MentionAutocompleteItem) adapter.getItem(position); if (mentionAutocompleteItem != null) { - mention.setId(mentionAutocompleteItem.getUserId()); + mention.setId(mentionAutocompleteItem.getObjectId()); mention.setLabel(mentionAutocompleteItem.getDisplayName()); - mention.setSource("users"); + mention.setSource(mentionAutocompleteItem.getSource()); dispatchClick(mention); } return true; diff --git a/app/src/main/java/com/nextcloud/talk/utils/DisplayUtils.java b/app/src/main/java/com/nextcloud/talk/utils/DisplayUtils.java index 51eb9aac6..d86f9a079 100644 --- a/app/src/main/java/com/nextcloud/talk/utils/DisplayUtils.java +++ b/app/src/main/java/com/nextcloud/talk/utils/DisplayUtils.java @@ -70,6 +70,7 @@ import com.vanniktech.emoji.EmojiTextView; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import java.util.Objects; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -228,7 +229,9 @@ public class DisplayUtils { int drawable; - if (!"call".equals(type)) { + boolean isCall = "call".equals(type) || "calls".equals(type); + + if (!isCall) { if (chipResource == R.xml.chip_accent_background) { drawable = R.drawable.white_circle; } else { @@ -242,7 +245,7 @@ public class DisplayUtils { chip.setBounds(0, 0, chip.getIntrinsicWidth(), chip.getIntrinsicHeight()); - if (!"call".equals(type)) { + if (!isCall) { ImageRequest imageRequest = getImageRequestForUrl(ApiUtils.getUrlForAvatarWithName(conversationUser.getBaseUrl(), id, R.dimen.avatar_size_big)); ImagePipeline imagePipeline = Fresco.getImagePipeline(); @@ -255,7 +258,6 @@ public class DisplayUtils { protected void onNewResultImpl(Bitmap bitmap) { if (bitmap != null) { chip.setChipIcon(getRoundedDrawable(new BitmapDrawable(bitmap))); - chip.invalidateSelf(); } }