show simple person icon when conversation-info when guest did not set any name

However this is only possible for the conversation info.
In other parts, the info if a guest changed the name or not is not available (like in the chat or in autocomplete)

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
Marcel Hibbe 2024-11-20 17:49:27 +01:00
parent d95c1c605f
commit b71218973e
No known key found for this signature in database
GPG key ID: C793F8B59F43CE7B
2 changed files with 16 additions and 16 deletions

View file

@ -21,10 +21,10 @@ import com.nextcloud.talk.adapters.items.ParticipantItem.ParticipantItemViewHold
import com.nextcloud.talk.application.NextcloudTalkApplication.Companion.sharedApplication
import com.nextcloud.talk.data.user.model.User
import com.nextcloud.talk.databinding.RvItemConversationInfoParticipantBinding
import com.nextcloud.talk.extensions.loadDefaultAvatar
import com.nextcloud.talk.extensions.loadDefaultGroupCallAvatar
import com.nextcloud.talk.extensions.loadFederatedUserAvatar
import com.nextcloud.talk.extensions.loadGuestAvatar
import com.nextcloud.talk.extensions.loadMailAvatar
import com.nextcloud.talk.extensions.loadUserAvatar
import com.nextcloud.talk.models.domain.ConversationModel
import com.nextcloud.talk.models.json.participants.Participant
@ -173,6 +173,7 @@ class ParticipantItem(
}
}
@SuppressLint("StringFormatInvalid")
private fun showCallIcons(holder: ParticipantItemViewHolder) {
val resources = sharedApplication!!.resources
val inCallFlag = model.inCall
@ -205,26 +206,16 @@ class ParticipantItem(
holder.binding.avatarView.loadDefaultGroupCallAvatar(viewThemeUtils)
}
Participant.ActorType.EMAILS -> {
model.displayName?.let {
if (TextUtils.isEmpty(it)) {
holder.binding.avatarView.loadMailAvatar(viewThemeUtils)
} else {
holder.binding.avatarView.loadGuestAvatar(user, it, false)
}
}
}
Participant.ActorType.USERS -> {
holder.binding.avatarView.loadUserAvatar(user, model.calculatedActorId!!, true, false)
}
Participant.ActorType.GUESTS -> {
var displayName: String? = sharedApplication!!.resources.getString(R.string.nc_guest)
if (!TextUtils.isEmpty(model.displayName)) {
displayName = model.displayName
Participant.ActorType.GUESTS, Participant.ActorType.EMAILS -> {
if (model.displayName.isNullOrEmpty()) {
holder.binding.avatarView.loadDefaultAvatar(viewThemeUtils)
} else {
holder.binding.avatarView.loadGuestAvatar(user, model.displayName!!, false)
}
holder.binding.avatarView.loadGuestAvatar(user, displayName!!, false)
}
Participant.ActorType.FEDERATED -> {

View file

@ -320,6 +320,15 @@ fun ImageView.loadDefaultGroupCallAvatar(viewThemeUtils: ViewThemeUtils): io.rea
return loadUserAvatar(data)
}
fun ImageView.loadDefaultAvatar(viewThemeUtils: ViewThemeUtils): io.reactivex.disposables.Disposable {
val data: Any = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
viewThemeUtils.talk.themePlaceholderAvatar(this, R.drawable.account_circle_96dp) as Any
} else {
R.drawable.account_circle_96dp
}
return loadUserAvatar(data)
}
fun ImageView.loadDefaultPublicCallAvatar(viewThemeUtils: ViewThemeUtils): io.reactivex.disposables.Disposable {
val data: Any = viewThemeUtils.talk.themePlaceholderAvatar(this, R.drawable.ic_avatar_link) as Any
return loadUserAvatar(data)