fix: 修复主页聊天列表头像未对应问题
This commit is contained in:
parent
b8c80e4b00
commit
c5b0cde2bd
@ -443,7 +443,6 @@ class ChatActivity : BaseActivity<ActivityChatBinding>(), OnItemClickListener,
|
||||
timestamp = System.currentTimeMillis(),
|
||||
senderId = username,
|
||||
takerId = talkerId,
|
||||
avatarUrl = getAvatarUrl(),
|
||||
type = type,
|
||||
)
|
||||
val msg = MessageProcessor.processorMsg(messages)
|
||||
|
@ -19,6 +19,7 @@ import com.kaixed.kchat.data.local.entity.Messages
|
||||
import com.kaixed.kchat.databinding.ChatRecycleItemCustomNormalBinding
|
||||
import com.kaixed.kchat.databinding.ChatRecycleItemImageNormalBinding
|
||||
import com.kaixed.kchat.databinding.ChatRecycleItemTipBinding
|
||||
import com.kaixed.kchat.utils.ConstantsUtil
|
||||
import com.kaixed.kchat.utils.ConstantsUtil.getUsername
|
||||
import com.kaixed.kchat.utils.PopWindowUtil.showPopupWindow
|
||||
import com.kaixed.kchat.utils.TextUtil
|
||||
@ -161,7 +162,9 @@ class ChatAdapter(
|
||||
contentId = binding.tvMsgContent.id,
|
||||
contentMineId = binding.tvMsgContentMine.id
|
||||
)
|
||||
Glide.with(binding.root.context).load(message.avatarUrl)
|
||||
val avatarUrl =
|
||||
if (sender) ConstantsUtil.getAvatarUrl() else message.avatarUrl
|
||||
Glide.with(binding.root.context).load(avatarUrl)
|
||||
.into(if (sender) binding.ifvAvatarMine else binding.ifvAvatar)
|
||||
|
||||
val contentView = if (sender) binding.tvMsgContentMine else binding.tvMsgContent
|
||||
@ -179,7 +182,9 @@ class ChatAdapter(
|
||||
RecyclerView.ViewHolder(binding.root), HasTimer {
|
||||
fun bindData(message: Messages) {
|
||||
val sender = message.senderId == getUsername()
|
||||
Glide.with(binding.root.context).load(message.avatarUrl)
|
||||
val avatarUrl =
|
||||
if (sender) ConstantsUtil.getAvatarUrl() else message.avatarUrl
|
||||
Glide.with(binding.root.context).load(avatarUrl)
|
||||
.into(if (sender) binding.ifvAvatarMine else binding.ifvAvatar)
|
||||
setViewVisibility(
|
||||
parentView = binding.root,
|
||||
|
Loading…
Reference in New Issue
Block a user