mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-23 13:35:33 +03:00
parent
364480ccf4
commit
7cf28e775b
4 changed files with 64 additions and 49 deletions
|
@ -20,6 +20,7 @@
|
|||
|
||||
package com.nextcloud.talk.adapters.items;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.view.View;
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
||||
import com.bumptech.glide.load.model.GlideUrl;
|
||||
|
@ -30,6 +31,7 @@ import com.nextcloud.talk.R;
|
|||
import com.nextcloud.talk.application.NextcloudTalkApplication;
|
||||
import com.nextcloud.talk.models.database.UserEntity;
|
||||
import com.nextcloud.talk.utils.ApiUtils;
|
||||
import com.nextcloud.talk.utils.DisplayUtils;
|
||||
import com.nextcloud.talk.utils.glide.GlideApp;
|
||||
import eu.davidea.flexibleadapter.FlexibleAdapter;
|
||||
import eu.davidea.flexibleadapter.items.AbstractFlexibleItem;
|
||||
|
@ -82,6 +84,7 @@ public class MentionAutocompleteItem extends AbstractFlexibleItem<UserItem.UserI
|
|||
}
|
||||
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
@Override
|
||||
public void bindViewHolder(FlexibleAdapter<IFlexible> adapter, UserItem.UserItemViewHolder holder, int position, List<Object> payloads) {
|
||||
|
||||
|
@ -89,14 +92,21 @@ public class MentionAutocompleteItem extends AbstractFlexibleItem<UserItem.UserI
|
|||
FlexibleUtils.highlightText(holder.contactDisplayName, displayName,
|
||||
String.valueOf(adapter.getFilter(String.class)), NextcloudTalkApplication.getSharedApplication()
|
||||
.getResources().getColor(R.color.colorPrimary));
|
||||
if (holder.contactMentionId != null) {
|
||||
FlexibleUtils.highlightText(holder.contactMentionId, "@" + userId,
|
||||
String.valueOf(adapter.getFilter(String.class)), NextcloudTalkApplication.getSharedApplication()
|
||||
.getResources().getColor(R.color.colorPrimary));
|
||||
}
|
||||
} else {
|
||||
holder.contactDisplayName.setText(displayName);
|
||||
if (holder.contactMentionId != null) {
|
||||
holder.contactMentionId.setText("@" + userId);
|
||||
}
|
||||
}
|
||||
|
||||
if (userId.equals("all")) {
|
||||
holder.avatarFlipView.setFrontImageBitmap(DisplayUtils.getRoundedBitmapFromVectorDrawableResource(NextcloudTalkApplication.getSharedApplication().getResources(), R.drawable.ic_people_group_white_24px));
|
||||
} else {
|
||||
GlideUrl glideUrl = new GlideUrl(ApiUtils.getUrlForAvatarWithName(currentUser.getBaseUrl(),
|
||||
userId, R.dimen.avatar_size), new LazyHeaders.Builder()
|
||||
.setHeader("Accept", "image/*")
|
||||
|
@ -115,6 +125,7 @@ public class MentionAutocompleteItem extends AbstractFlexibleItem<UserItem.UserI
|
|||
.apply(RequestOptions.bitmapTransform(new CircleCrop()))
|
||||
.into(holder.avatarFlipView.getFrontImageView());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean filter(String constraint) {
|
||||
|
|
|
@ -132,7 +132,8 @@ public class MagicIncomingTextMessageViewHolder
|
|||
if (messageParameters != null && messageParameters.size() > 0) {
|
||||
for (String key : messageParameters.keySet()) {
|
||||
Map<String, String> individualHashMap = message.getMessageParameters().get(key);
|
||||
if (individualHashMap.get("type").equals("user") || individualHashMap.get("type").equals("guest")) {
|
||||
if (individualHashMap != null) {
|
||||
if (individualHashMap.get("type").equals("user") || individualHashMap.get("type").equals("guest") || individualHashMap.get("type").equals("call")) {
|
||||
int color;
|
||||
|
||||
if (individualHashMap.get("id").equals(message.getActiveUserId())) {
|
||||
|
@ -152,6 +153,7 @@ public class MagicIncomingTextMessageViewHolder
|
|||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else if (TextMatchers.isMessageWithSingleEmoticonOnly(message.getText())) {
|
||||
emojiSize *= 2.5f;
|
||||
|
|
|
@ -88,7 +88,8 @@ public class MagicOutcomingTextMessageViewHolder extends MessageHolders.Outcomin
|
|||
if (messageParameters != null && messageParameters.size() > 0) {
|
||||
for (String key : messageParameters.keySet()) {
|
||||
Map<String, String> individualHashMap = message.getMessageParameters().get(key);
|
||||
if (individualHashMap.get("type").equals("user") || individualHashMap.get("type").equals("guest")) {
|
||||
if (individualHashMap != null) {
|
||||
if (individualHashMap.get("type").equals("user") || individualHashMap.get("type").equals("guest") || individualHashMap.get("type").equals("call")) {
|
||||
if (!individualHashMap.get("id").equals(message.getActiveUserId())) {
|
||||
messageString =
|
||||
DisplayUtils.searchAndColor(message.getText(),
|
||||
|
@ -104,6 +105,7 @@ public class MagicOutcomingTextMessageViewHolder extends MessageHolders.Outcomin
|
|||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else if (TextMatchers.isMessageWithSingleEmoticonOnly(message.getText())) {
|
||||
emojiSize *= 2.5f;
|
||||
|
|
|
@ -59,7 +59,7 @@ public class MagicSystemMessageViewHolder extends MessageHolders.IncomingTextMes
|
|||
for (String key : message.getMessageParameters().keySet()) {
|
||||
Map<String, String> individualHashMap = message.getMessageParameters().get(key);
|
||||
int color;
|
||||
if (individualHashMap.get("type").equals("user") || individualHashMap.get("type").equals("guest")) {
|
||||
if (individualHashMap != null && (individualHashMap.get("type").equals("user") || individualHashMap.get("type").equals("guest") || individualHashMap.get("type").equals("call"))) {
|
||||
|
||||
if (individualHashMap.get("id").equals(message.getActiveUserId())) {
|
||||
color = context.getResources().getColor(R.color.nc_incoming_text_mention_you);
|
||||
|
|
Loading…
Reference in a new issue