mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-20 03:59:35 +01: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.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.otaliastudios:autocomplete:1.1.0'
|
||||||
|
|
||||||
implementation 'com.github.Kennyc1012:BottomSheet:2.4.0'
|
implementation 'com.github.Kennyc1012:BottomSheet:2.4.0'
|
||||||
|
@ -28,6 +28,7 @@ import android.text.style.RelativeSizeSpan;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.amulyakhare.textdrawable.TextDrawable;
|
||||||
import com.kevalpatel2106.emoticongifkeyboard.widget.EmoticonTextView;
|
import com.kevalpatel2106.emoticongifkeyboard.widget.EmoticonTextView;
|
||||||
import com.nextcloud.talk.R;
|
import com.nextcloud.talk.R;
|
||||||
import com.nextcloud.talk.application.NextcloudTalkApplication;
|
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.database.user.UserUtils;
|
||||||
import com.nextcloud.talk.utils.emoticons.EmoticonUtils;
|
import com.nextcloud.talk.utils.emoticons.EmoticonUtils;
|
||||||
import com.stfalcon.chatkit.messages.MessageHolders;
|
import com.stfalcon.chatkit.messages.MessageHolders;
|
||||||
|
import com.stfalcon.chatkit.utils.ShapeImageView;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
@ -56,6 +58,9 @@ public class MagicIncomingTextMessageViewHolder
|
|||||||
@BindView(R.id.messageText)
|
@BindView(R.id.messageText)
|
||||||
EmoticonTextView messageText;
|
EmoticonTextView messageText;
|
||||||
|
|
||||||
|
@BindView(R.id.messageUserAvatar)
|
||||||
|
ShapeImageView messageUserAvatarView;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
UserUtils userUtils;
|
UserUtils userUtils;
|
||||||
|
|
||||||
@ -82,6 +87,14 @@ public class MagicIncomingTextMessageViewHolder
|
|||||||
messageAuthor.setText(R.string.nc_nick_guest);
|
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();
|
HashMap<String, HashMap<String, String>> messageParameters = message.getMessageParameters();
|
||||||
|
|
||||||
Context context = NextcloudTalkApplication.getSharedApplication().getApplicationContext();
|
Context context = NextcloudTalkApplication.getSharedApplication().getApplicationContext();
|
||||||
|
@ -316,7 +316,6 @@ public class ChatController extends BaseController implements MessagesListAdapte
|
|||||||
@Override
|
@Override
|
||||||
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Bitmap> target, boolean isFirstResource) {
|
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Bitmap> target, boolean isFirstResource) {
|
||||||
TextDrawable drawable = TextDrawable.builder().beginConfig().bold()
|
TextDrawable drawable = TextDrawable.builder().beginConfig().bold()
|
||||||
.width(imageView.getMeasuredWidth()).height(imageView.getMeasuredHeight())
|
|
||||||
.endConfig().buildRound("?", getResources().getColor(R.color.nc_grey));
|
.endConfig().buildRound("?", getResources().getColor(R.color.nc_grey));
|
||||||
imageView.setImageDrawable(drawable);
|
imageView.setImageDrawable(drawable);
|
||||||
return true;
|
return true;
|
||||||
|
@ -91,7 +91,11 @@ public class ChatMessage implements IMessage {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getAvatar() {
|
public String getAvatar() {
|
||||||
|
if (getActorType().equals("users")) {
|
||||||
return ApiUtils.getUrlForAvatarWithName(getBaseUrl(), actorId, R.dimen.avatar_size);
|
return ApiUtils.getUrlForAvatarWithName(getBaseUrl(), actorId, R.dimen.avatar_size);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user