fix: pfp broken closed groups why
This commit is contained in:
parent
c988573952
commit
77e948feec
|
@ -52,12 +52,19 @@ class ProfilePictureView @JvmOverloads constructor(
|
||||||
.sorted()
|
.sorted()
|
||||||
.take(2)
|
.take(2)
|
||||||
.toMutableList()
|
.toMutableList()
|
||||||
val pk = members.getOrNull(0)?.serialize() ?: ""
|
if (members.size <= 1) {
|
||||||
publicKey = pk
|
publicKey = ""
|
||||||
displayName = getUserDisplayName(pk)
|
displayName = ""
|
||||||
val apk = members.getOrNull(1)?.serialize() ?: ""
|
additionalPublicKey = ""
|
||||||
additionalPublicKey = apk
|
additionalDisplayName = ""
|
||||||
additionalDisplayName = getUserDisplayName(apk)
|
} else {
|
||||||
|
val pk = members.getOrNull(0)?.serialize() ?: ""
|
||||||
|
publicKey = pk
|
||||||
|
displayName = getUserDisplayName(pk)
|
||||||
|
val apk = members.getOrNull(1)?.serialize() ?: ""
|
||||||
|
additionalPublicKey = apk
|
||||||
|
additionalDisplayName = getUserDisplayName(apk)
|
||||||
|
}
|
||||||
} else if(recipient.isOpenGroupInboxRecipient) {
|
} else if(recipient.isOpenGroupInboxRecipient) {
|
||||||
val publicKey = GroupUtil.getDecodedOpenGroupInbox(recipient.address.serialize())
|
val publicKey = GroupUtil.getDecodedOpenGroupInbox(recipient.address.serialize())
|
||||||
this.publicKey = publicKey
|
this.publicKey = publicKey
|
||||||
|
@ -113,7 +120,7 @@ class ProfilePictureView @JvmOverloads constructor(
|
||||||
if (signalProfilePicture != null && avatar != "0" && avatar != "") {
|
if (signalProfilePicture != null && avatar != "0" && avatar != "") {
|
||||||
glide.clear(imageView)
|
glide.clear(imageView)
|
||||||
glide.load(signalProfilePicture)
|
glide.load(signalProfilePicture)
|
||||||
.placeholder(unknownRecipientDrawable)
|
.placeholder(R.drawable.ic_profile_default)
|
||||||
.centerCrop()
|
.centerCrop()
|
||||||
.error(glide.load(placeholder))
|
.error(glide.load(placeholder))
|
||||||
.diskCacheStrategy(DiskCacheStrategy.NONE)
|
.diskCacheStrategy(DiskCacheStrategy.NONE)
|
||||||
|
@ -121,17 +128,21 @@ class ProfilePictureView @JvmOverloads constructor(
|
||||||
.into(imageView)
|
.into(imageView)
|
||||||
} else if (recipient.isOpenGroupRecipient && recipient.groupAvatarId == null) {
|
} else if (recipient.isOpenGroupRecipient && recipient.groupAvatarId == null) {
|
||||||
glide.clear(imageView)
|
glide.clear(imageView)
|
||||||
imageView.setImageDrawable(unknownOpenGroupDrawable)
|
glide.load(R.drawable.ic_notification)
|
||||||
|
.centerCrop()
|
||||||
|
.into(imageView)
|
||||||
} else {
|
} else {
|
||||||
glide.clear(imageView)
|
glide.clear(imageView)
|
||||||
glide.load(placeholder)
|
glide.load(placeholder)
|
||||||
.placeholder(unknownRecipientDrawable)
|
.placeholder(R.drawable.ic_profile_default)
|
||||||
.centerCrop()
|
.centerCrop()
|
||||||
.diskCacheStrategy(DiskCacheStrategy.NONE).circleCrop().into(imageView)
|
.diskCacheStrategy(DiskCacheStrategy.NONE).circleCrop().into(imageView)
|
||||||
}
|
}
|
||||||
profilePicturesCache[publicKey] = recipient.profileAvatar
|
profilePicturesCache[publicKey] = recipient.profileAvatar
|
||||||
} else {
|
} else {
|
||||||
imageView.setImageDrawable(null)
|
glide.load(R.drawable.ic_profile_default)
|
||||||
|
.centerInside()
|
||||||
|
.into(imageView)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
android:layout_height="@dimen/small_profile_picture_size"
|
android:layout_height="@dimen/small_profile_picture_size"
|
||||||
android:layout_alignParentLeft="true"
|
android:layout_alignParentLeft="true"
|
||||||
android:layout_alignParentTop="true"
|
android:layout_alignParentTop="true"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
android:background="@drawable/profile_picture_view_small_background" />
|
android:background="@drawable/profile_picture_view_small_background" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
|
@ -24,6 +25,7 @@
|
||||||
android:layout_height="@dimen/small_profile_picture_size"
|
android:layout_height="@dimen/small_profile_picture_size"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
android:background="@drawable/profile_picture_view_small_background" />
|
android:background="@drawable/profile_picture_view_small_background" />
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
|
@ -33,7 +33,7 @@ public class ResourceContactPhoto implements FallbackContactPhoto {
|
||||||
Drawable background = TextDrawable.builder().buildRound(" ", inverted ? Color.WHITE : color);
|
Drawable background = TextDrawable.builder().buildRound(" ", inverted ? Color.WHITE : color);
|
||||||
RoundedDrawable foreground = (RoundedDrawable) RoundedDrawable.fromDrawable(context.getResources().getDrawable(resourceId));
|
RoundedDrawable foreground = (RoundedDrawable) RoundedDrawable.fromDrawable(context.getResources().getDrawable(resourceId));
|
||||||
|
|
||||||
foreground.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
|
foreground.setScaleType(ImageView.ScaleType.CENTER_CROP);
|
||||||
|
|
||||||
if (inverted) {
|
if (inverted) {
|
||||||
foreground.setColorFilter(color, PorterDuff.Mode.SRC_ATOP);
|
foreground.setColorFilter(color, PorterDuff.Mode.SRC_ATOP);
|
||||||
|
|
Loading…
Reference in New Issue