Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.onClick
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
Expand Down Expand Up @@ -233,14 +236,15 @@ fun OngoingCallScreen(
}

BackHandler {
when {
scaffoldState.bottomSheetState.currentValue == SheetValue.Expanded -> scope.launch {
scaffoldState.bottomSheetState.partialExpand()
}
ongoingCallViewModel.state.selectedParticipant != null -> ongoingCallViewModel.onSelectedParticipant(null)
shouldUsePiPMode -> (activity as OngoingCallActivity).enterPiPMode(conversationId, ongoingCallViewModel.currentUserId)
else -> activity.moveTaskToBack(true)
when {
scaffoldState.bottomSheetState.currentValue == SheetValue.Expanded -> scope.launch {
scaffoldState.bottomSheetState.partialExpand()
}

ongoingCallViewModel.state.selectedParticipant != null -> ongoingCallViewModel.onSelectedParticipant(null)
shouldUsePiPMode -> (activity as OngoingCallActivity).enterPiPMode(conversationId, ongoingCallViewModel.currentUserId)
else -> activity.moveTaskToBack(true)
}
}

OngoingCallContent(
Expand Down Expand Up @@ -437,7 +441,21 @@ private fun OngoingCallContent(
}
},
sheetDragHandle = {
WireDragHandle(progress = if (scaffoldState.bottomSheetState.targetValue == SheetValue.Expanded) 0f else 1f)
val dragHandleContentDescription = when (scaffoldState.bottomSheetState.targetValue) {
SheetValue.Expanded -> stringResource(id = R.string.content_description_calling_expanded_participants_list)
else -> stringResource(id = R.string.content_description_calling_collapsed_participants_list)
}
val dragHandleClickContentDescription = when (scaffoldState.bottomSheetState.targetValue) {
SheetValue.Expanded -> stringResource(id = R.string.content_description_calling_collapse)
else -> stringResource(id = R.string.content_description_calling_expand)
}
WireDragHandle(
progress = if (scaffoldState.bottomSheetState.targetValue == SheetValue.Expanded) 0f else 1f,
modifier = Modifier.semantics {
this.contentDescription = dragHandleContentDescription
this.onClick(label = dragHandleClickContentDescription, action = null)
}
)
},
sheetPeekHeight = with(LocalDensity.current) { sheetPeekHeight.toDp() },
scaffoldState = scaffoldState,
Expand Down Expand Up @@ -497,7 +515,7 @@ private fun OngoingCallContent(
}
ParticipantList(
lazyListState = lazyListState,
participants = participants,
participants = participants.sortedBy { it.name }.toPersistentList(),
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.alpha
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextOverflow
Expand All @@ -46,6 +48,8 @@
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.ui.theme.wireColorScheme
import com.wire.android.ui.theme.wireTypography
import com.wire.android.util.ui.PreviewMultipleThemes

@Composable
Expand All @@ -56,7 +60,11 @@
RowItemTemplate(
leadingIcon = {
UserProfileAvatar(
UserAvatarData(asset = participant.avatar, nameBasedAvatar = NameBasedAvatar(participant.name, participant.accentId)),
avatarData = UserAvatarData(
asset = participant.avatar,
nameBasedAvatar = NameBasedAvatar(participant.name, participant.accentId)
),
modifier = Modifier.alpha(if (participant.hasEstablishedAudio) 1f else 0.5f)
)
},
titleStartPadding = dimensions().spacing0x,
Expand All @@ -68,48 +76,77 @@
Text(
text = participant.name.orEmpty(),
style = typography().title02,
color = colorsScheme().onSurface,
color = when (participant.hasEstablishedAudio) {
true -> colorsScheme().onSurface
false -> colorsScheme().secondaryText
},
maxLines = 1,
overflow = TextOverflow.Ellipsis,
modifier = Modifier.weight(weight = 1f, fill = false)
)
if (participant.isSelfUser) {
Text(
text = stringResource(R.string.conversation_participant_you_label),
style = MaterialTheme.wireTypography.title02,
color = MaterialTheme.wireColorScheme.secondaryText,
)
}
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,
)
}
when (participant.hasEstablishedAudio) {
true -> ConnectedActionIcons(participant)
false -> ConnectingLabel()
}
},
modifier = modifier.padding(start = dimensions().spacing8x),
)
}

@Composable
private fun ConnectingLabel() {
Text(
color = colorsScheme().error,
style = MaterialTheme.wireTypography.label01,
text = stringResource(id = R.string.participant_tile_call_connecting_label),
maxLines = 1,
)
}

@Composable
private fun ConnectedActionIcons(participant: UICallParticipant) {
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,
)
}
}
}

@Composable
private fun ActionIcon(
@DrawableRes icon: Int,
Expand Down Expand Up @@ -179,3 +216,15 @@
fun PreviewParticipantItem_MutedGuest() = WireTheme {
ParticipantItem(participant = previewParticipant.copy(isMuted = true, membership = Membership.Guest))
}

@PreviewMultipleThemes
@Composable
fun PreviewParticipantItem_SelfUser() = WireTheme {

Check warning on line 222 in app/src/main/kotlin/com/wire/android/ui/calling/ongoing/participantslist/ParticipantItem.kt

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename function "PreviewParticipantItem_SelfUser" to match the regular expression ^[a-zA-Z][a-zA-Z0-9]*$

See more on https://sonarcloud.io/project/issues?id=wireapp_wire-android&issues=AZ4hB8YyEf5RldweKt73&open=AZ4hB8YyEf5RldweKt73&pullRequest=4823
ParticipantItem(participant = previewParticipant.copy(isSelfUser = true, name = "Participant with a very long name to be truncated"))
}

@PreviewMultipleThemes
@Composable
fun PreviewParticipantItem_Connecting() = WireTheme {

Check warning on line 228 in app/src/main/kotlin/com/wire/android/ui/calling/ongoing/participantslist/ParticipantItem.kt

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename function "PreviewParticipantItem_Connecting" to match the regular expression ^[a-zA-Z][a-zA-Z0-9]*$

See more on https://sonarcloud.io/project/issues?id=wireapp_wire-android&issues=AZ4hB8YyEf5RldweKt74&open=AZ4hB8YyEf5RldweKt74&pullRequest=4823
ParticipantItem(participant = previewParticipant.copy(hasEstablishedAudio = false))
}
5 changes: 5 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,11 @@
<string name="content_description_calling_microphone_on">Microphone on</string>
<string name="content_description_calling_microphone_off">Microphone off</string>
<string name="content_description_calling_active_speaker">Active speaker</string>
<string name="content_description_calling_participants_list_drag_handle">Expand list of participants</string>
<string name="content_description_calling_expand">Expand</string>
<string name="content_description_calling_collapse">Collapse</string>
<string name="content_description_calling_expanded_participants_list">Expanded list of participants</string>
<string name="content_description_calling_collapsed_participants_list">Collapsed list of participants</string>
<string name="content_description_calling_in_call_reactions_show">Show in call reactions panel</string>
<string name="content_description_calling_in_call_reactions_hide">Hide in call reactions panel</string>
<string name="content_description_call_open_calling_details">Open calling details</string>
Expand Down
Loading