Skip to content

Commit

Permalink
Additional design updates
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksandar-apostolov committed Oct 30, 2023
1 parent 56d3184 commit 7bdcab2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.layout.onGloballyPositioned
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.platform.LocalInspectionMode
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.painterResource
Expand Down Expand Up @@ -294,6 +296,10 @@ public fun BoxScope.ParticipantLabel(
)
},
) {
var componentWidth by remember { mutableStateOf(0.dp) }
componentWidth = VideoTheme.dimens.participantLabelTextMaxWidth
// get local density from composable
val density = LocalDensity.current
Box(
modifier = Modifier
.align(labelPosition)
Expand All @@ -302,15 +308,19 @@ public fun BoxScope.ParticipantLabel(
.background(
VideoTheme.colors.participantLabelBackground,
shape = VideoTheme.shapes.participantLabelShape,
),
).onGloballyPositioned {
componentWidth = with(density) {
it.size.width.toDp()
}
},
) {
Row(
modifier = Modifier.align(Center),
verticalAlignment = CenterVertically,
) {
Text(
modifier = Modifier
.widthIn(max = VideoTheme.dimens.participantLabelTextMaxWidth)
.widthIn(max = componentWidth)
.padding(start = VideoTheme.dimens.participantLabelTextPaddingStart)
.align(CenterVertically),
text = nameLabel,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.tooling.preview.Preview
import io.getstream.video.android.compose.theme.VideoTheme
import io.getstream.video.android.core.model.NetworkQuality

Expand Down Expand Up @@ -96,11 +95,3 @@ internal fun ConnectionBars(modifier: Modifier = Modifier, colors: Triple<Color,
)
}
}

@Preview
@Composable
private fun BarsPreview() {
VideoTheme {
ConnectionBars(colors = Triple(Color.Red, Color.Blue, Color.Green))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
<dimen name="stream_video_callParticipantSoundIndicatorPaddingStart">8dp</dimen>
<dimen name="stream_video_participantsGridPadding">4dp</dimen>
<dimen name="stream_video_callParticipantLabelPadding">8dp</dimen>
<dimen name="stream_video_callParticipantLabelTextMaxWidth">64dp</dimen>
<dimen name="stream_video_callParticipantLabelTextMaxWidth">120dp</dimen>
<dimen name="stream_video_callParticipantLabelTextPadding">4dp</dimen>
<dimen name="stream_video_screenShareParticipantItemSize">110dp</dimen>
<dimen name="stream_video_screenShareParticipantsListHeight">125dp</dimen>
Expand Down

0 comments on commit 7bdcab2

Please sign in to comment.