fix: Arabic text reads right to left when it mixes in English words (#1568)

This commit is contained in:
MaxsTechReview authored and GitHub committed 2026-10-25 14:25:43 -04:00
1 parent 645dc3e781
commit 1f3f1ebc6a
2 files changed
+23 -2

No files matched your search

@@ -1969,7 +1969,9 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
repairOffered = hint?.repair == true
loading.showEnded(
hint?.text ?: stopped,
getString(R.string.session_ended_detail, status, SessionState.logFile?.path ?: getString(R.string.session_ended_no_log)),
getString(R.string.session_ended_detail, status,
SessionState.logFile?.path?.let { android.text.BidiFormatter.getInstance().unicodeWrap(it, android.text.TextDirectionHeuristics.LTR) }
?: getString(R.string.session_ended_no_log)),
)
focusEndedScreen()
}
@@ -2,6 +2,10 @@ package com.droiddeck.launcher.ui
import androidx.annotation.StringRes
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.ProvideTextStyle
import androidx.compose.material3.Typography
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.style.TextDirection
import androidx.compose.material3.darkColorScheme
import androidx.compose.animation.core.LinearEasing
import androidx.compose.animation.core.RepeatMode
@@ -164,7 +168,22 @@ fun DroidDeckTheme(theme: String? = null, appScale: Int = AppUiPrefs.DEFAULT_SCA
LocalPalette provides p,
LocalDensity provides density,
LocalConfiguration provides configuration,
) { MaterialTheme(colorScheme = scheme, content = content) }
) {
MaterialTheme(colorScheme = scheme, typography = ContentDirected) {
ProvideTextStyle(TextStyle(textDirection = TextDirection.Content), content)
}
}
}
private val ContentDirected = Typography().run {
fun TextStyle.byContent() = copy(textDirection = TextDirection.Content)
Typography(
displayLarge.byContent(), displayMedium.byContent(), displaySmall.byContent(),
headlineLarge.byContent(), headlineMedium.byContent(), headlineSmall.byContent(),
titleLarge.byContent(), titleMedium.byContent(), titleSmall.byContent(),
bodyLarge.byContent(), bodyMedium.byContent(), bodySmall.byContent(),
labelLarge.byContent(), labelMedium.byContent(), labelSmall.byContent(),
)
}
/** Turns the colour wheel on the system's own animation clock; with animations off, in the app or in Android, the colour holds still. */