mirror of
https://github.com/oxen-io/session-android.git
synced 2025-02-19 20:48:27 +00:00
fix profile picture update
This commit is contained in:
parent
9ddb45dbdc
commit
97a9446eae
@ -145,14 +145,14 @@ class ProfilePictureView : RelativeLayout {
|
||||
|
||||
private fun setProfilePictureIfNeeded(imageView: ImageView, publicKey: String, displayName: String?, @DimenRes sizeResId: Int) {
|
||||
if (publicKey.isNotEmpty()) {
|
||||
if (imagesCached.contains(publicKey)) return
|
||||
val recipient = Recipient.from(context, Address.fromSerialized(publicKey), false)
|
||||
if (imagesCached.contains(recipient.profileAvatar.orEmpty())) return
|
||||
val signalProfilePicture = recipient.contactPhoto
|
||||
if (signalProfilePicture != null && (signalProfilePicture as? ProfileContactPhoto)?.avatarObject != "0"
|
||||
&& (signalProfilePicture as? ProfileContactPhoto)?.avatarObject != "") {
|
||||
glide.clear(imageView)
|
||||
glide.load(signalProfilePicture).diskCacheStrategy(DiskCacheStrategy.AUTOMATIC).circleCrop().into(imageView)
|
||||
imagesCached.add(publicKey)
|
||||
imagesCached.add(recipient.profileAvatar.orEmpty())
|
||||
} else {
|
||||
val sizeInPX = resources.getDimensionPixelSize(sizeResId)
|
||||
glide.clear(imageView)
|
||||
@ -162,7 +162,7 @@ class ProfilePictureView : RelativeLayout {
|
||||
publicKey,
|
||||
displayName
|
||||
)).diskCacheStrategy(DiskCacheStrategy.ALL).circleCrop().into(imageView)
|
||||
imagesCached.add(publicKey)
|
||||
imagesCached.add(recipient.profileAvatar.orEmpty())
|
||||
}
|
||||
} else {
|
||||
imageView.setImageDrawable(null)
|
||||
|
Loading…
x
Reference in New Issue
Block a user