mirror of
https://github.com/oxen-io/session-android.git
synced 2025-02-16 12:48:26 +00:00
Fix open group profile picture bug
This commit is contained in:
parent
60cdad756c
commit
4f3526d20d
@ -797,14 +797,21 @@ public class ConversationItem extends LinearLayout
|
|||||||
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams)bodyBubble.getLayoutParams();
|
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams)bodyBubble.getLayoutParams();
|
||||||
int groupThreadMargin = (int)((12 * getResources().getDisplayMetrics().density) + getResources().getDimension(R.dimen.small_profile_picture_size));
|
int groupThreadMargin = (int)((12 * getResources().getDisplayMetrics().density) + getResources().getDimension(R.dimen.small_profile_picture_size));
|
||||||
int defaultMargin = 0;
|
int defaultMargin = 0;
|
||||||
Recipient r = DatabaseFactory.getThreadDatabase(context).getRecipientForThreadId(messageRecord.getThreadId());
|
long threadID = messageRecord.getThreadId();
|
||||||
|
Recipient r = DatabaseFactory.getThreadDatabase(context).getRecipientForThreadId(threadID);
|
||||||
String threadName = r != null ? r.getName() : "";
|
String threadName = r != null ? r.getName() : "";
|
||||||
boolean isRSSFeed = threadName != null && (threadName.equals("Loki News") || threadName.equals("Session Updates"));
|
boolean isRSSFeed = threadName != null && (threadName.equals("Loki News") || threadName.equals("Session Updates"));
|
||||||
layoutParams.setMarginStart((groupThread && !isRSSFeed) ? groupThreadMargin : defaultMargin);
|
layoutParams.setMarginStart((groupThread && !isRSSFeed) ? groupThreadMargin : defaultMargin);
|
||||||
bodyBubble.setLayoutParams(layoutParams);
|
bodyBubble.setLayoutParams(layoutParams);
|
||||||
if (profilePictureView == null) return;
|
if (profilePictureView == null) return;
|
||||||
profilePictureView.setPublicKey(recipient.getAddress().toString());
|
String publicKey = recipient.getAddress().toString();
|
||||||
profilePictureView.setDisplayName(recipient.getName());
|
profilePictureView.setPublicKey(publicKey);
|
||||||
|
String displayName = recipient.getName();
|
||||||
|
PublicChat publicChat = DatabaseFactory.getLokiThreadDatabase(context).getPublicChat(threadID);
|
||||||
|
if (displayName == null && publicChat != null) {
|
||||||
|
displayName = DatabaseFactory.getLokiUserDatabase(context).getServerDisplayName(publicChat.getId(), publicKey);
|
||||||
|
}
|
||||||
|
profilePictureView.setDisplayName(displayName);
|
||||||
profilePictureView.setAdditionalPublicKey(null);
|
profilePictureView.setAdditionalPublicKey(null);
|
||||||
profilePictureView.setRSSFeed(false);
|
profilePictureView.setRSSFeed(false);
|
||||||
profilePictureView.setGlide(glideRequests);
|
profilePictureView.setGlide(glideRequests);
|
||||||
|
@ -60,7 +60,12 @@ class ProfilePictureView : RelativeLayout {
|
|||||||
if (publicKey == null || publicKey.isBlank()) {
|
if (publicKey == null || publicKey.isBlank()) {
|
||||||
return null
|
return null
|
||||||
} else {
|
} else {
|
||||||
return DatabaseFactory.getLokiUserDatabase(context).getDisplayName(publicKey!!)
|
var result = DatabaseFactory.getLokiUserDatabase(context).getDisplayName(publicKey)
|
||||||
|
val publicChat = DatabaseFactory.getLokiThreadDatabase(context).getPublicChat(threadID)
|
||||||
|
if (result == null && publicChat != null) {
|
||||||
|
result = DatabaseFactory.getLokiUserDatabase(context).getServerDisplayName(publicChat.id, publicKey)
|
||||||
|
}
|
||||||
|
return result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (recipient.isGroupRecipient) {
|
if (recipient.isGroupRecipient) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user