android, desktop: mirror more RTL icons and placements

Add Painter.mirrorIfRtl() for icons drawn by shared helpers that take a
Painter, and use it for the delivery receipts "Don't enable" chevron and
the "Show message status" arrow. Mirror the forwarded delivery status
chevron. Place the rows of framed messages (e.g. image captions), the
group member name row and the supporter banner image relative to the
layout direction.

Update the plan: these are no longer deferred, and correct its
descriptions of the dropdown, the chat list header and the tail side.
This commit is contained in:
Narasimha-sc committed 2026-10-18 02:20:19 +00:00
1 parent 1dc9849818
commit 64316071c4
7 files changed
+136 -81

No files matched your search

@@ -92,7 +92,7 @@ fun SupportSimpleXBanner(
val heroPlaceable = measurables[1].measure(constraints.copy(minWidth = 0, minHeight = 0))
layout(cardPlaceable.width, cardPlaceable.height) {
cardPlaceable.place(0, 0)
heroPlaceable.place(cardPlaceable.width - heroPlaceable.width, cardPlaceable.height - heroPlaceable.height)
heroPlaceable.placeRelative(cardPlaceable.width - heroPlaceable.width, cardPlaceable.height - heroPlaceable.height)
}
}
}
@@ -413,6 +413,7 @@ fun ChatItemInfoView(chatRh: Long?, ci: ChatItem, ciInfo: ChatItemInfo, devTools
Icon(
painterResource(icon),
contentDescription = null,
modifier = if (icon == MR.images.ic_chevron_right_2) Modifier.mirrorIfRtl() else Modifier,
tint = statusColor
)
}
@@ -548,7 +548,7 @@ fun PriorityLayout(
) {
var y = 0
placeables.forEach {
it.place(0, y)
it.placeRelative(0, y)
y += it.measuredHeight
}
}
@@ -582,7 +582,7 @@ fun DependentLayout(
) {
var y = 0
placeables.forEach {
it.place(0, y)
it.placeRelative(0, y)
y += it.measuredHeight
}
}
@@ -4,8 +4,12 @@ import androidx.compose.foundation.gestures.Orientation
import androidx.compose.foundation.layout.offset
import androidx.compose.material.*
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.scale
import androidx.compose.ui.graphics.drawscope.DrawScope
import androidx.compose.ui.graphics.drawscope.scale
import androidx.compose.ui.graphics.painter.Painter
import androidx.compose.ui.layout.layout
import androidx.compose.ui.platform.LocalLayoutDirection
import androidx.compose.ui.unit.IntOffset
@@ -16,6 +20,20 @@ import kotlin.math.roundToInt
fun Modifier.mirrorIfRtl(): Modifier =
if (LocalLayoutDirection.current == LayoutDirection.Rtl) this.scale(scaleX = -1f, scaleY = 1f) else this
@Composable
fun Painter.mirrorIfRtl(): Painter =
if (LocalLayoutDirection.current == LayoutDirection.Rtl) remember(this) { MirroredPainter(this) } else this
private class MirroredPainter(private val painter: Painter): Painter() {
override val intrinsicSize get() = painter.intrinsicSize
override fun DrawScope.onDraw() {
scale(scaleX = -1f, scaleY = 1f) {
with(painter) { draw(size) }
}
}
}
fun Modifier.badgeLayout() =
layout { measurable, constraints ->
val placeable = measurable.measure(constraints)
@@ -104,7 +104,7 @@ private fun EnableReceiptsButton(onClick: () -> Unit) {
@Composable
private fun SkipButton(onClick: () -> Unit) {
SimpleButtonIconEnded(stringResource(MR.strings.dont_enable_receipts), painterResource(MR.images.ic_chevron_right), click = onClick)
SimpleButtonIconEnded(stringResource(MR.strings.dont_enable_receipts), painterResource(MR.images.ic_chevron_right).mirrorIfRtl(), click = onClick)
TextBelowButton(stringResource(MR.strings.you_can_enable_delivery_receipts_later))
}
@@ -233,7 +233,7 @@ fun ModalData.AdvancedNetworkSettingsView(showModal: (@Composable ModalData.() -
SectionView(generalGetString(MR.strings.settings_section_title_private_message_routing)) {
SMPProxyModePicker(smpProxyMode, showModal, updateSMPProxyMode)
SMPProxyFallbackPicker(smpProxyFallback, showModal, updateSMPProxyFallback, enabled = remember { derivedStateOf { smpProxyMode.value != SMPProxyMode.Never } })
SettingsPreferenceItem(painterResource(MR.images.ic_arrow_forward), stringResource(MR.strings.private_routing_show_message_status), chatModel.controller.appPrefs.showSentViaProxy)
SettingsPreferenceItem(painterResource(MR.images.ic_arrow_forward).mirrorIfRtl(), stringResource(MR.strings.private_routing_show_message_status), chatModel.controller.appPrefs.showSentViaProxy)
}
SectionTextFooter(stringResource(MR.strings.private_routing_explanation))
SectionDividerSpaced()