Fix app version name RTL issue

Before fix, the version name under app label has this issue and the
version name at the footer of page does not has this issue because it's
BidiFormatter wrapped.

Always BidiFormatter wrap the version name to fix this issue.

Fix: 283407883
Test: Visual
Change-Id: I2c73c69caf80e90e4eaadeb42bc4afe62fa05cf0
This commit is contained in:
Chaohui Wang
2023-05-24 13:30:53 +08:00
parent af4534f615
commit 6a6cfd96a3

View File

@@ -76,7 +76,7 @@ class AppInfoProvider(private val packageInfo: PackageInfo) {
private fun AppVersion() {
if (packageInfo.versionName == null) return
Spacer(modifier = Modifier.height(4.dp))
SettingsBody(packageInfo.versionName)
SettingsBody(packageInfo.versionNameBidiWrapped)
}
@Composable
@@ -84,10 +84,15 @@ class AppInfoProvider(private val packageInfo: PackageInfo) {
if (packageInfo.versionName == null) return
Divider()
Box(modifier = Modifier.padding(SettingsDimension.itemPadding)) {
val versionName = BidiFormatter.getInstance().unicodeWrap(packageInfo.versionName)
SettingsBody(stringResource(R.string.version_text, versionName))
SettingsBody(stringResource(R.string.version_text, packageInfo.versionNameBidiWrapped))
}
}
private companion object {
/** Wrapped the version name, so its directionality still keep same when RTL. */
val PackageInfo.versionNameBidiWrapped: String
get() = BidiFormatter.getInstance().unicodeWrap(versionName)
}
}
@Composable