mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-10 14:24:05 +01:00
fix to show placeholder avatar when none is set by user
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
898728cef9
commit
050f0f4422
@ -184,7 +184,7 @@ class ConversationItem(
|
||||
ConversationType.ROOM_GROUP_CALL,
|
||||
ConversationType.FORMER_ONE_TO_ONE,
|
||||
ConversationType.ROOM_PUBLIC_CALL ->
|
||||
holder.binding.dialogAvatar.loadConversationAvatar(user, model)
|
||||
holder.binding.dialogAvatar.loadConversationAvatar(user, model, false)
|
||||
|
||||
else -> holder.binding.dialogAvatar.visibility = View.GONE
|
||||
}
|
||||
|
@ -807,7 +807,7 @@ class ConversationInfoActivity :
|
||||
}
|
||||
|
||||
Conversation.ConversationType.ROOM_GROUP_CALL, Conversation.ConversationType.ROOM_PUBLIC_CALL -> {
|
||||
binding.avatarImage.loadConversationAvatar(conversationUser, conversation!!)
|
||||
binding.avatarImage.loadConversationAvatar(conversationUser, conversation!!, true)
|
||||
}
|
||||
|
||||
Conversation.ConversationType.ROOM_SYSTEM -> {
|
||||
|
@ -359,7 +359,7 @@ class ConversationInfoEditActivity :
|
||||
}
|
||||
|
||||
Conversation.ConversationType.ROOM_GROUP_CALL, Conversation.ConversationType.ROOM_PUBLIC_CALL -> {
|
||||
binding.avatarImage.loadConversationAvatar(conversationUser, conversation!!)
|
||||
binding.avatarImage.loadConversationAvatar(conversationUser, conversation!!, true)
|
||||
}
|
||||
|
||||
Conversation.ConversationType.ROOM_SYSTEM -> {
|
||||
|
@ -54,9 +54,12 @@ private const val TAG = "ImageViewExtensions"
|
||||
|
||||
fun ImageView.loadConversationAvatar(
|
||||
user: User,
|
||||
conversation: Conversation
|
||||
conversation: Conversation,
|
||||
ignoreCache: Boolean
|
||||
): io.reactivex.disposables
|
||||
.Disposable {
|
||||
var finalIgnoreCache = ignoreCache
|
||||
|
||||
val imageRequestUri = ApiUtils.getUrlForConversationAvatarWithVersion(
|
||||
1,
|
||||
user.baseUrl,
|
||||
@ -64,6 +67,10 @@ fun ImageView.loadConversationAvatar(
|
||||
conversation.avatarVersion
|
||||
)
|
||||
|
||||
if (conversation.avatarVersion.isNullOrEmpty()) {
|
||||
finalIgnoreCache = true
|
||||
}
|
||||
|
||||
// these placeholders are only used when the request fails completely. The server also return default avatars
|
||||
// when no own images are set. (although these default avatars can not be themed for the android app..)
|
||||
val placeholder =
|
||||
@ -77,7 +84,7 @@ fun ImageView.loadConversationAvatar(
|
||||
else -> ContextCompat.getDrawable(context, R.drawable.account_circle_96dp)
|
||||
}
|
||||
|
||||
return loadAvatarInternal(user, imageRequestUri, false, placeholder)
|
||||
return loadAvatarInternal(user, imageRequestUri, finalIgnoreCache, placeholder)
|
||||
}
|
||||
|
||||
fun ImageView.loadUserAvatar(
|
||||
|
Loading…
Reference in New Issue
Block a user