diff --git a/app/build.gradle b/app/build.gradle index 6f2ccd604..9c4a8ffff 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -154,7 +154,7 @@ dependencies { implementation 'com.github.wooplr:Spotlight:1.2.3' - implementation 'com.github.stfalcon:chatkit:0.2.3' + implementation 'com.github.stfalcon:chatkit:0.3.0' implementation 'com.otaliastudios:autocomplete:1.1.0' implementation 'com.github.Kennyc1012:BottomSheet:2.4.0' diff --git a/app/src/main/java/com/nextcloud/talk/adapters/messages/MagicIncomingTextMessageViewHolder.java b/app/src/main/java/com/nextcloud/talk/adapters/messages/MagicIncomingTextMessageViewHolder.java index 6d378c084..7d5a75873 100644 --- a/app/src/main/java/com/nextcloud/talk/adapters/messages/MagicIncomingTextMessageViewHolder.java +++ b/app/src/main/java/com/nextcloud/talk/adapters/messages/MagicIncomingTextMessageViewHolder.java @@ -28,6 +28,7 @@ import android.text.style.RelativeSizeSpan; import android.view.View; import android.widget.TextView; +import com.amulyakhare.textdrawable.TextDrawable; import com.kevalpatel2106.emoticongifkeyboard.widget.EmoticonTextView; import com.nextcloud.talk.R; import com.nextcloud.talk.application.NextcloudTalkApplication; @@ -37,6 +38,7 @@ import com.nextcloud.talk.utils.DisplayUtils; import com.nextcloud.talk.utils.database.user.UserUtils; import com.nextcloud.talk.utils.emoticons.EmoticonUtils; import com.stfalcon.chatkit.messages.MessageHolders; +import com.stfalcon.chatkit.utils.ShapeImageView; import java.util.HashMap; @@ -56,6 +58,9 @@ public class MagicIncomingTextMessageViewHolder @BindView(R.id.messageText) EmoticonTextView messageText; + @BindView(R.id.messageUserAvatar) + ShapeImageView messageUserAvatarView; + @Inject UserUtils userUtils; @@ -82,6 +87,14 @@ public class MagicIncomingTextMessageViewHolder messageAuthor.setText(R.string.nc_nick_guest); } + if (message.getActorType().equals("guests")) { + TextDrawable drawable = TextDrawable.builder().beginConfig().bold() + .endConfig().buildRound(String.valueOf(messageAuthor.getText().charAt(0)), NextcloudTalkApplication + .getSharedApplication().getResources().getColor(R.color.nc_grey)); + messageUserAvatarView.setVisibility(View.VISIBLE); + messageUserAvatarView.setImageDrawable(drawable); + } + HashMap> messageParameters = message.getMessageParameters(); Context context = NextcloudTalkApplication.getSharedApplication().getApplicationContext(); diff --git a/app/src/main/java/com/nextcloud/talk/controllers/ChatController.java b/app/src/main/java/com/nextcloud/talk/controllers/ChatController.java index e0a864507..663b65873 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/ChatController.java +++ b/app/src/main/java/com/nextcloud/talk/controllers/ChatController.java @@ -316,7 +316,6 @@ public class ChatController extends BaseController implements MessagesListAdapte @Override public boolean onLoadFailed(@Nullable GlideException e, Object model, Target target, boolean isFirstResource) { TextDrawable drawable = TextDrawable.builder().beginConfig().bold() - .width(imageView.getMeasuredWidth()).height(imageView.getMeasuredHeight()) .endConfig().buildRound("?", getResources().getColor(R.color.nc_grey)); imageView.setImageDrawable(drawable); return true; diff --git a/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatMessage.java b/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatMessage.java index efe97f00b..8c7f53074 100644 --- a/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatMessage.java +++ b/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatMessage.java @@ -91,7 +91,11 @@ public class ChatMessage implements IMessage { @Override public String getAvatar() { - return ApiUtils.getUrlForAvatarWithName(getBaseUrl(), actorId, R.dimen.avatar_size); + if (getActorType().equals("users")) { + return ApiUtils.getUrlForAvatarWithName(getBaseUrl(), actorId, R.dimen.avatar_size); + } else { + return null; + } } }; }