diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/MessageEventBubble.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/MessageEventBubble.kt index f080bc58dd..50a1dd2a94 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/MessageEventBubble.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/MessageEventBubble.kt @@ -29,7 +29,9 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.CompositingStrategy import androidx.compose.ui.graphics.Shape import androidx.compose.ui.graphics.graphicsLayer +import androidx.compose.ui.platform.LocalLayoutDirection import androidx.compose.ui.tooling.preview.PreviewParameter +import androidx.compose.ui.unit.LayoutDirection import androidx.compose.ui.unit.dp import io.element.android.compound.theme.ElementTheme import io.element.android.features.messages.impl.timeline.model.TimelineItemGroupPosition @@ -101,6 +103,7 @@ fun MessageEventBubble( val bubbleShape = bubbleShape() val radiusPx = (avatarRadius + SENDER_AVATAR_BORDER_WIDTH).toPx() val yOffsetPx = -(NEGATIVE_MARGIN_FOR_BUBBLE + avatarRadius).toPx() + val isRtl = LocalLayoutDirection.current == LayoutDirection.Rtl BoxWithConstraints( modifier = modifier .graphicsLayer { @@ -112,7 +115,7 @@ fun MessageEventBubble( drawCircle( color = Color.Black, center = Offset( - x = 0f, + x = if (isRtl) size.width else 0f, y = yOffsetPx, ), radius = radiusPx, @@ -129,7 +132,9 @@ fun MessageEventBubble( .testTag(TestTags.messageBubble) .widthIn( min = MIN_BUBBLE_WIDTH, - max = (constraints.maxWidth * BUBBLE_WIDTH_RATIO).toInt().toDp() + max = (constraints.maxWidth * BUBBLE_WIDTH_RATIO) + .toInt() + .toDp() ) .clip(bubbleShape) .combinedClickable( diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/TimelineItemEventRow.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/TimelineItemEventRow.kt index 67342203bd..06567f2d32 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/TimelineItemEventRow.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/TimelineItemEventRow.kt @@ -301,6 +301,8 @@ private fun TimelineItemEventRowContent( Modifier .constrainAs(sender) { top.linkTo(parent.top) + // Required for correct RTL layout + start.linkTo(parent.start) } .padding(horizontal = 16.dp) .zIndex(1f)