-
Notifications
You must be signed in to change notification settings - Fork 46
feat: list of call participants [WPB-1057] #4762
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
918fc16
7a4958d
a2885bf
75392d0
0a48531
89b2a24
f350349
bae099d
343af8f
6a25744
50be055
13c14c9
c1c9a5b
8410ead
b3bb64d
eedea57
174f490
a80a2ad
aaeee74
0d94a5a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,178 @@ | ||
| /* | ||
| * Wire | ||
| * Copyright (C) 2026 Wire Swiss GmbH | ||
| * | ||
| * This program is free software: you can redistribute it and/or modify | ||
| * it under the terms of the GNU General Public License as published by | ||
| * the Free Software Foundation, either version 3 of the License, or | ||
| * (at your option) any later version. | ||
| * | ||
| * This program is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU General Public License | ||
| * along with this program. If not, see http://www.gnu.org/licenses/. | ||
| */ | ||
| package com.wire.android.ui.calling.ongoing.participantslist | ||
|
|
||
| import androidx.annotation.DrawableRes | ||
| import androidx.annotation.StringRes | ||
| import androidx.compose.foundation.background | ||
| import androidx.compose.foundation.border | ||
| import androidx.compose.foundation.layout.Arrangement | ||
| import androidx.compose.foundation.layout.Row | ||
| import androidx.compose.foundation.layout.padding | ||
| import androidx.compose.foundation.shape.RoundedCornerShape | ||
| import androidx.compose.material3.Icon | ||
| import androidx.compose.material3.Text | ||
| import androidx.compose.runtime.Composable | ||
| import androidx.compose.ui.Alignment | ||
| import androidx.compose.ui.Modifier | ||
| import androidx.compose.ui.res.painterResource | ||
| import androidx.compose.ui.res.stringResource | ||
| import com.wire.android.R | ||
| import com.wire.android.model.NameBasedAvatar | ||
| import com.wire.android.model.UserAvatarData | ||
| import com.wire.android.ui.calling.model.UICallParticipant | ||
| import com.wire.android.ui.calling.ongoing.buildPreviewParticipantsList | ||
| import com.wire.android.ui.common.MembershipQualifierLabel | ||
| import com.wire.android.ui.common.avatar.UserProfileAvatar | ||
| import com.wire.android.ui.common.colorsScheme | ||
| import com.wire.android.ui.common.dimensions | ||
| import com.wire.android.ui.common.rowitem.RowItemTemplate | ||
| import com.wire.android.ui.common.typography | ||
| import com.wire.android.ui.home.conversationslist.model.Membership | ||
| import com.wire.android.ui.theme.WireTheme | ||
| import com.wire.android.util.ui.PreviewMultipleThemes | ||
|
|
||
| @Composable | ||
| fun ParticipantItem( | ||
| participant: UICallParticipant, | ||
| modifier: Modifier = Modifier, | ||
| ) { | ||
| RowItemTemplate( | ||
| leadingIcon = { | ||
| UserProfileAvatar( | ||
| UserAvatarData(asset = participant.avatar, nameBasedAvatar = NameBasedAvatar(participant.name, participant.accentId)), | ||
| ) | ||
| }, | ||
| titleStartPadding = dimensions().spacing0x, | ||
| title = { | ||
| Row( | ||
| verticalAlignment = Alignment.CenterVertically, | ||
| horizontalArrangement = Arrangement.spacedBy(dimensions().spacing6x) | ||
| ) { | ||
| Text( | ||
| text = participant.name.orEmpty(), | ||
| style = typography().title02, | ||
| color = colorsScheme().onSurface, | ||
| ) | ||
| MembershipQualifierLabel(membership = participant.membership) | ||
| } | ||
| }, | ||
| actions = { | ||
| Row( | ||
| verticalAlignment = Alignment.CenterVertically, | ||
| horizontalArrangement = Arrangement.spacedBy(dimensions().spacing8x) | ||
| ) { | ||
| if (participant.isSharingScreen) { | ||
| ActionIcon( | ||
| icon = R.drawable.ic_screen_share, | ||
| contentDescription = R.string.content_description_calling_screen_share_on, | ||
| ) | ||
| } | ||
| if (participant.isCameraOn) { | ||
| ActionIcon( | ||
| icon = R.drawable.ic_camera_on, | ||
| contentDescription = R.string.content_description_calling_camera_on, | ||
| ) | ||
| } | ||
| if (participant.isMuted) { | ||
| ActionIcon( | ||
| icon = R.drawable.ic_microphone_off, | ||
| contentDescription = R.string.content_description_calling_microphone_off, | ||
| ) | ||
| } else { | ||
| ActionIcon( | ||
| icon = R.drawable.ic_microphone_on, | ||
| contentDescription = R.string.content_description_calling_microphone_on, | ||
| active = participant.isSpeaking, | ||
| ) | ||
| } | ||
| } | ||
| }, | ||
| modifier = modifier.padding(start = dimensions().spacing8x), | ||
| ) | ||
| } | ||
|
|
||
| @Composable | ||
| private fun ActionIcon( | ||
| @DrawableRes icon: Int, | ||
| @StringRes contentDescription: Int, | ||
| modifier: Modifier = Modifier, | ||
| active: Boolean = false, | ||
| ) { | ||
| Icon( | ||
| painter = painterResource(icon), | ||
| contentDescription = stringResource(contentDescription), | ||
| tint = if (active) colorsScheme().primary else colorsScheme().onSurface, | ||
| modifier = modifier | ||
| .let { | ||
| if (active) { | ||
| it | ||
| .border( | ||
| color = colorsScheme().primary, | ||
| width = dimensions().spacing1x, | ||
| shape = RoundedCornerShape(dimensions().spacing3x) | ||
| ) | ||
| .background( | ||
| color = colorsScheme().primaryVariant, | ||
| shape = RoundedCornerShape(dimensions().spacing3x) | ||
| ) | ||
| } else { | ||
| it | ||
| } | ||
| } | ||
| .padding(dimensions().spacing3x) | ||
| ) | ||
| } | ||
|
|
||
| private val previewParticipant = buildPreviewParticipantsList(1).first() | ||
|
Check warning on line 142 in app/src/main/kotlin/com/wire/android/ui/calling/ongoing/participantslist/ParticipantItem.kt
|
||
|
|
||
| @PreviewMultipleThemes | ||
| @Composable | ||
| fun PreviewParticipantItem_Muted() = WireTheme { | ||
|
Check warning on line 146 in app/src/main/kotlin/com/wire/android/ui/calling/ongoing/participantslist/ParticipantItem.kt
|
||
| ParticipantItem(participant = previewParticipant.copy(isMuted = true)) | ||
| } | ||
|
|
||
| @PreviewMultipleThemes | ||
| @Composable | ||
| fun PreviewParticipantItem_NotMuted() = WireTheme { | ||
|
Check warning on line 152 in app/src/main/kotlin/com/wire/android/ui/calling/ongoing/participantslist/ParticipantItem.kt
|
||
| ParticipantItem(participant = previewParticipant.copy(isMuted = false)) | ||
| } | ||
|
|
||
| @PreviewMultipleThemes | ||
| @Composable | ||
| fun PreviewParticipantItem_Speaking() = WireTheme { | ||
|
Check warning on line 158 in app/src/main/kotlin/com/wire/android/ui/calling/ongoing/participantslist/ParticipantItem.kt
|
||
| ParticipantItem(participant = previewParticipant.copy(isMuted = false, isSpeaking = true)) | ||
| } | ||
|
|
||
| @PreviewMultipleThemes | ||
| @Composable | ||
| fun PreviewParticipantItem_NotMutedWithCamera() = WireTheme { | ||
|
Check warning on line 164 in app/src/main/kotlin/com/wire/android/ui/calling/ongoing/participantslist/ParticipantItem.kt
|
||
| ParticipantItem(participant = previewParticipant.copy(isMuted = false, isCameraOn = true)) | ||
| } | ||
|
|
||
| @PreviewMultipleThemes | ||
| @Composable | ||
| fun PreviewParticipantItem_NotMutedWithScreenShare() = WireTheme { | ||
|
Check warning on line 170 in app/src/main/kotlin/com/wire/android/ui/calling/ongoing/participantslist/ParticipantItem.kt
|
||
| ParticipantItem(participant = previewParticipant.copy(isMuted = false, isSharingScreen = true)) | ||
| } | ||
|
|
||
| @PreviewMultipleThemes | ||
| @Composable | ||
| fun PreviewParticipantItem_MutedGuest() = WireTheme { | ||
|
Check warning on line 176 in app/src/main/kotlin/com/wire/android/ui/calling/ongoing/participantslist/ParticipantItem.kt
|
||
| ParticipantItem(participant = previewParticipant.copy(isMuted = true, membership = Membership.Guest)) | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| /* | ||
| * Wire | ||
| * Copyright (C) 2026 Wire Swiss GmbH | ||
| * | ||
| * This program is free software: you can redistribute it and/or modify | ||
| * it under the terms of the GNU General Public License as published by | ||
| * the Free Software Foundation, either version 3 of the License, or | ||
| * (at your option) any later version. | ||
| * | ||
| * This program is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU General Public License | ||
| * along with this program. If not, see http://www.gnu.org/licenses/. | ||
| */ | ||
| package com.wire.android.ui.calling.ongoing.participantslist | ||
|
|
||
| import androidx.compose.foundation.lazy.LazyColumn | ||
| import androidx.compose.foundation.lazy.LazyListState | ||
| import androidx.compose.foundation.lazy.items | ||
| import androidx.compose.foundation.lazy.rememberLazyListState | ||
| import androidx.compose.runtime.Composable | ||
| import androidx.compose.ui.Modifier | ||
| import com.wire.android.ui.calling.model.UICallParticipant | ||
| import com.wire.android.ui.calling.ongoing.buildPreviewParticipantsList | ||
| import com.wire.android.ui.theme.WireTheme | ||
| import com.wire.android.util.ui.PreviewMultipleThemes | ||
| import kotlinx.collections.immutable.PersistentList | ||
|
|
||
| @Composable | ||
| fun ParticipantList( | ||
| participants: PersistentList<UICallParticipant>, | ||
| modifier: Modifier = Modifier, | ||
| lazyListState: LazyListState = rememberLazyListState(), | ||
| ) { | ||
| LazyColumn( | ||
| state = lazyListState, | ||
| modifier = modifier, | ||
| ) { | ||
| items( | ||
| items = participants, | ||
| key = { it.id.value + it.clientId }, | ||
| ) { participant -> | ||
| ParticipantItem(participant) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| @PreviewMultipleThemes | ||
| @Composable | ||
| fun PreviewParticipantList() = WireTheme { | ||
| ParticipantList(participants = buildPreviewParticipantsList(3)) | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| <vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
| android:width="16dp" | ||
| android:height="16dp" | ||
| android:viewportWidth="16" | ||
| android:viewportHeight="16"> | ||
| <path | ||
| android:pathData="M12,13V15H4V13H12ZM14.124,1C14.608,1 15,1.379 15,1.845V11.155C15,11.622 14.611,12 14.124,12H9V8H13L8,3L3,8H7L6.999,12H1.876C1.392,12 1,11.621 1,11.155V1.845C1,1.378 1.389,1 1.876,1H14.124Z" | ||
| android:fillColor="#000000" | ||
| android:fillType="evenOdd"/> | ||
| </vector> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of of simulating sticky header, can use
LazyColumwithstickyHeaderUh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not simulating the sticky header, it's actually a different intention than a sticky header. It handles the visuals of the whole list scroll, so it cannot be a part of the list as a sticky header, it needs to stay above the list, so in column it will be drawn first, that's why
zIndexis used so that the background of the list doesn't cover the shadow elevation that this element creates.