@@ -531,7 +531,7 @@ class ConversationAdapterV2(
531
531
}
532
532
533
533
inner class ThreadHeaderViewHolder (itemView : View ) : MappingViewHolder<ThreadHeader>(itemView) {
534
- private val conversationBanner: ConversationHeaderView = itemView as ConversationHeaderView
534
+ private val conversationBanner: ConversationHeaderView = itemView.findViewById( R .id.header)
535
535
536
536
override fun bind (model : ThreadHeader ) {
537
537
val (recipient, groupInfo, sharedGroups, messageRequestState) = model.recipientInfo
@@ -570,19 +570,16 @@ class ConversationAdapterV2(
570
570
conversationBanner.hideUnverifiedNameSubtitle()
571
571
}
572
572
573
- if (groupInfo.pendingMemberCount > 0 ) {
574
- val invited = context.resources.getQuantityString(R .plurals.MessageRequestProfileView_invited , groupInfo.pendingMemberCount, groupInfo.pendingMemberCount)
575
- conversationBanner.setSubtitle(context.resources.getQuantityString(R .plurals.MessageRequestProfileView_members_and_invited , groupInfo.fullMemberCount, groupInfo.fullMemberCount, invited), R .drawable.symbol_group_compact_16) { goToGroupSettings(recipient) }
576
- } else if (groupInfo.fullMemberCount > 0 ) {
573
+ if (groupInfo.fullMemberCount > 0 || groupInfo.pendingMemberCount > 0 ) {
577
574
if (groupInfo.fullMemberCount == 1 && recipient.isActiveGroup) {
578
575
conversationBanner.hideUnverifiedNameSubtitle()
579
576
}
580
- conversationBanner. setSubtitle(context.resources.getQuantityString( R .plurals. MessageRequestProfileView_members , groupInfo.fullMemberCount , groupInfo.fullMemberCount), R .drawable.symbol_group_compact_16) { goToGroupSettings( recipient) }
577
+ setSubtitle(context, groupInfo.pendingMemberCount , groupInfo.fullMemberCount, groupInfo.membersPreview, recipient)
581
578
} else {
582
579
conversationBanner.hideSubtitle()
583
580
}
584
581
} else if (isSelf) {
585
- conversationBanner.setSubtitle(context.getString(R .string.ConversationFragment__you_can_add_notes_for_yourself_in_this_conversation ), R .drawable.symbol_note_compact_16, null )
582
+ conversationBanner.setSubtitle(context.getString(R .string.ConversationFragment__you_can_add_notes_for_yourself_in_this_conversation ), R .drawable.symbol_note_compact_16, null , null )
586
583
} else {
587
584
if ((recipient.profileName.toString() == recipient.getDisplayName(context)) && recipient.nickname.isEmpty && ! recipient.isSystemContact) {
588
585
conversationBanner.setUnverifiedNameSubtitle(R .drawable.symbol_person_question_16, false ) {
@@ -596,7 +593,7 @@ class ConversationAdapterV2(
596
593
if (subtitle == null || subtitle == title) {
597
594
conversationBanner.hideSubtitle()
598
595
} else {
599
- conversationBanner.setSubtitle(subtitle, R .drawable.symbol_phone_compact_16, null )
596
+ conversationBanner.setSubtitle(subtitle, R .drawable.symbol_phone_compact_16, null , null )
600
597
}
601
598
}
602
599
@@ -641,6 +638,35 @@ class ConversationAdapterV2(
641
638
conversationBanner.updateOutlineBoxSize()
642
639
}
643
640
641
+ private fun setSubtitle (context : Context , pendingMemberCount : Int , size : Int , members : List <Recipient >, recipient : Recipient ) {
642
+ val names = members.map { member -> member.getDisplayName(context) }
643
+ val otherMembers = if (size > 3 ) context.resources.getQuantityString(R .plurals.MessageRequestProfileView_other_members , size - 3 , size - 3 ) else null
644
+ val membersSubtitle = if (recipient.isActiveGroup) {
645
+ when (size) {
646
+ 1 -> context.getString(R .string.MessageRequestProfileView_group_members_zero )
647
+ 2 -> context.getString(R .string.MessageRequestProfileView_group_members_one_and_you , names[0 ])
648
+ 3 -> context.getString(R .string.MessageRequestProfileView_group_members_two_and_you , names[0 ], names[1 ])
649
+ else -> context.getString(R .string.MessageRequestProfileView_group_members_other , names[0 ], names[1 ], names[2 ], otherMembers)
650
+ }
651
+ } else {
652
+ when (size) {
653
+ 0 -> context.getString(R .string.MessageRequestProfileView_group_members_zero )
654
+ 1 -> context.getString(R .string.MessageRequestProfileView_group_members_one , names[0 ])
655
+ 2 -> context.getString(R .string.MessageRequestProfileView_group_members_two , names[0 ], names[1 ])
656
+ 3 -> context.getString(R .string.MessageRequestProfileView_group_members_three , names[0 ], names[1 ], names[2 ])
657
+ else -> context.getString(R .string.MessageRequestProfileView_group_members_other , names[0 ], names[1 ], names[2 ], otherMembers)
658
+ }
659
+ }
660
+
661
+ if (pendingMemberCount > 0 ) {
662
+ val invited = context.resources.getQuantityString(R .plurals.MessageRequestProfileView_invited , pendingMemberCount, pendingMemberCount)
663
+ val subtitle = context.getString(R .string.MessageRequestProfileView_member_names_and_invited , membersSubtitle, invited)
664
+ conversationBanner.setSubtitle(subtitle, R .drawable.symbol_group_compact_16, otherMembers) { goToGroupSettings(recipient) }
665
+ } else {
666
+ conversationBanner.setSubtitle(membersSubtitle, R .drawable.symbol_group_compact_16, otherMembers) { goToGroupSettings(recipient) }
667
+ }
668
+ }
669
+
644
670
private fun getDescription (context : Context , sharedGroups : List <String >): String {
645
671
return when (sharedGroups.size) {
646
672
0 -> context.getString(R .string.ConversationUpdateItem_no_groups_in_common_review_requests_carefully )
0 commit comments