mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-19 03:29:28 +01:00
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:
parent
d95c1c605f
commit
b71218973e
@ -21,10 +21,10 @@ import com.nextcloud.talk.adapters.items.ParticipantItem.ParticipantItemViewHold
|
|||||||
import com.nextcloud.talk.application.NextcloudTalkApplication.Companion.sharedApplication
|
import com.nextcloud.talk.application.NextcloudTalkApplication.Companion.sharedApplication
|
||||||
import com.nextcloud.talk.data.user.model.User
|
import com.nextcloud.talk.data.user.model.User
|
||||||
import com.nextcloud.talk.databinding.RvItemConversationInfoParticipantBinding
|
import com.nextcloud.talk.databinding.RvItemConversationInfoParticipantBinding
|
||||||
|
import com.nextcloud.talk.extensions.loadDefaultAvatar
|
||||||
import com.nextcloud.talk.extensions.loadDefaultGroupCallAvatar
|
import com.nextcloud.talk.extensions.loadDefaultGroupCallAvatar
|
||||||
import com.nextcloud.talk.extensions.loadFederatedUserAvatar
|
import com.nextcloud.talk.extensions.loadFederatedUserAvatar
|
||||||
import com.nextcloud.talk.extensions.loadGuestAvatar
|
import com.nextcloud.talk.extensions.loadGuestAvatar
|
||||||
import com.nextcloud.talk.extensions.loadMailAvatar
|
|
||||||
import com.nextcloud.talk.extensions.loadUserAvatar
|
import com.nextcloud.talk.extensions.loadUserAvatar
|
||||||
import com.nextcloud.talk.models.domain.ConversationModel
|
import com.nextcloud.talk.models.domain.ConversationModel
|
||||||
import com.nextcloud.talk.models.json.participants.Participant
|
import com.nextcloud.talk.models.json.participants.Participant
|
||||||
@ -173,6 +173,7 @@ class ParticipantItem(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("StringFormatInvalid")
|
||||||
private fun showCallIcons(holder: ParticipantItemViewHolder) {
|
private fun showCallIcons(holder: ParticipantItemViewHolder) {
|
||||||
val resources = sharedApplication!!.resources
|
val resources = sharedApplication!!.resources
|
||||||
val inCallFlag = model.inCall
|
val inCallFlag = model.inCall
|
||||||
@ -205,26 +206,16 @@ class ParticipantItem(
|
|||||||
holder.binding.avatarView.loadDefaultGroupCallAvatar(viewThemeUtils)
|
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 -> {
|
Participant.ActorType.USERS -> {
|
||||||
holder.binding.avatarView.loadUserAvatar(user, model.calculatedActorId!!, true, false)
|
holder.binding.avatarView.loadUserAvatar(user, model.calculatedActorId!!, true, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
Participant.ActorType.GUESTS -> {
|
Participant.ActorType.GUESTS, Participant.ActorType.EMAILS -> {
|
||||||
var displayName: String? = sharedApplication!!.resources.getString(R.string.nc_guest)
|
if (model.displayName.isNullOrEmpty()) {
|
||||||
if (!TextUtils.isEmpty(model.displayName)) {
|
holder.binding.avatarView.loadDefaultAvatar(viewThemeUtils)
|
||||||
displayName = model.displayName
|
} else {
|
||||||
|
holder.binding.avatarView.loadGuestAvatar(user, model.displayName!!, false)
|
||||||
}
|
}
|
||||||
holder.binding.avatarView.loadGuestAvatar(user, displayName!!, false)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Participant.ActorType.FEDERATED -> {
|
Participant.ActorType.FEDERATED -> {
|
||||||
|
@ -320,6 +320,15 @@ fun ImageView.loadDefaultGroupCallAvatar(viewThemeUtils: ViewThemeUtils): io.rea
|
|||||||
return loadUserAvatar(data)
|
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 {
|
fun ImageView.loadDefaultPublicCallAvatar(viewThemeUtils: ViewThemeUtils): io.reactivex.disposables.Disposable {
|
||||||
val data: Any = viewThemeUtils.talk.themePlaceholderAvatar(this, R.drawable.ic_avatar_link) as Any
|
val data: Any = viewThemeUtils.talk.themePlaceholderAvatar(this, R.drawable.ic_avatar_link) as Any
|
||||||
return loadUserAvatar(data)
|
return loadUserAvatar(data)
|
||||||
|
Loading…
Reference in New Issue
Block a user