mirror of
https://github.com/oxen-io/session-android.git
synced 2025-04-21 01:51:30 +00:00
Fix open group member count display
This commit is contained in:
parent
11bf0a06a8
commit
f599238b03
@ -50,17 +50,17 @@ class ConversationActionBarView : LinearLayout {
|
|||||||
mediator.attach()
|
mediator.attach()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun bind(recipient: Recipient, delegate: ConversationActionBarDelegate) {
|
fun bind(delegate: ConversationActionBarDelegate, recipient: Recipient, openGroup: OpenGroup? = null) {
|
||||||
this.delegate = delegate
|
this.delegate = delegate
|
||||||
update(recipient)
|
update(recipient, openGroup)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun update(recipient: Recipient) {
|
fun update(recipient: Recipient, openGroup: OpenGroup? = null) {
|
||||||
binding.conversationTitleView.text = when {
|
binding.conversationTitleView.text = when {
|
||||||
recipient.isLocalNumber -> context.getString(R.string.note_to_self)
|
recipient.isLocalNumber -> context.getString(R.string.note_to_self)
|
||||||
else -> recipient.toShortString()
|
else -> recipient.toShortString()
|
||||||
}
|
}
|
||||||
updateSubtitle(recipient)
|
updateSubtitle(recipient, openGroup)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun updateSubtitle(recipient: Recipient, openGroup: OpenGroup? = null) {
|
fun updateSubtitle(recipient: Recipient, openGroup: OpenGroup? = null) {
|
||||||
@ -88,15 +88,16 @@ class ConversationActionBarView : LinearLayout {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (recipient.isGroupRecipient) {
|
if (recipient.isGroupRecipient) {
|
||||||
settings.add(
|
val title = if (recipient.isOpenGroupRecipient) {
|
||||||
ConversationSetting(
|
val userCount = openGroup?.let { lokiApiDb.getUserCount(it.room, it.server) } ?: 0
|
||||||
openGroup?.let {
|
|
||||||
val userCount = lokiApiDb.getUserCount(it.room, it.server) ?: 0
|
|
||||||
context.getString(R.string.ConversationActivity_active_member_count, userCount)
|
context.getString(R.string.ConversationActivity_active_member_count, userCount)
|
||||||
} ?: run {
|
} else {
|
||||||
val userCount = groupDb.getGroupMemberAddresses(recipient.address.toGroupString(), true).size
|
val userCount = groupDb.getGroupMemberAddresses(recipient.address.toGroupString(), true).size
|
||||||
context.getString(R.string.ConversationActivity_member_count, userCount)
|
context.getString(R.string.ConversationActivity_member_count, userCount)
|
||||||
},
|
}
|
||||||
|
settings.add(
|
||||||
|
ConversationSetting(
|
||||||
|
title,
|
||||||
ConversationSettingType.MEMBER_COUNT,
|
ConversationSettingType.MEMBER_COUNT,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -456,7 +456,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
|||||||
actionBar.title = ""
|
actionBar.title = ""
|
||||||
actionBar.setDisplayHomeAsUpEnabled(true)
|
actionBar.setDisplayHomeAsUpEnabled(true)
|
||||||
actionBar.setHomeButtonEnabled(true)
|
actionBar.setHomeButtonEnabled(true)
|
||||||
binding!!.toolbarContent.bind(recipient, this)
|
binding!!.toolbarContent.bind(this, recipient, viewModel.openGroup)
|
||||||
maybeUpdateToolbar(recipient)
|
maybeUpdateToolbar(recipient)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -647,7 +647,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun maybeUpdateToolbar(recipient: Recipient) {
|
private fun maybeUpdateToolbar(recipient: Recipient) {
|
||||||
binding?.toolbarContent?.update(recipient)
|
binding?.toolbarContent?.update(recipient, viewModel.openGroup)
|
||||||
val profilePictureView = overflowMenuItem?.actionView?.findViewById<ProfilePictureView>(R.id.profilePictureView)
|
val profilePictureView = overflowMenuItem?.actionView?.findViewById<ProfilePictureView>(R.id.profilePictureView)
|
||||||
profilePictureView?.glide = glide
|
profilePictureView?.glide = glide
|
||||||
MentionManagerUtilities.populateUserPublicKeyCacheIfNeeded(viewModel.threadId, this)
|
MentionManagerUtilities.populateUserPublicKeyCacheIfNeeded(viewModel.threadId, this)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user