mirror of
https://github.com/nextcloud/talk-android
synced 2025-01-31 11:32:00 +00:00
Improve avatar loading
Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
parent
de0044b637
commit
4be4c0aa02
@ -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'
|
||||
|
@ -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<String, HashMap<String, String>> messageParameters = message.getMessageParameters();
|
||||
|
||||
Context context = NextcloudTalkApplication.getSharedApplication().getApplicationContext();
|
||||
|
@ -316,7 +316,6 @@ public class ChatController extends BaseController implements MessagesListAdapte
|
||||
@Override
|
||||
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Bitmap> 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;
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user