Remove stringResource() id named argument (#3618)

This commit is contained in:
Phil Oliver 2025-11-04 21:36:26 -05:00 committed by GitHub
parent 828edc653f
commit a687328f08
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
68 changed files with 196 additions and 224 deletions

View file

@ -38,7 +38,7 @@ fun MeshProtos.Position.formatPositionTime(dateFormat: DateFormat): String {
val isOlderThanSixMonths = time * SECONDS_TO_MILLIS < sixMonthsAgo
val timeText =
if (isOlderThanSixMonths) {
stringResource(id = org.meshtastic.core.strings.R.string.unknown_age)
stringResource(org.meshtastic.core.strings.R.string.unknown_age)
} else {
dateFormat.format(time * SECONDS_TO_MILLIS)
}

View file

@ -72,7 +72,7 @@ fun SimpleAlertDialog(
Text(text = message.orEmpty())
}
},
confirmButton = { TextButton(onClick = onConfirmRequest) { Text(stringResource(id = R.string.okay)) } },
confirmButton = { TextButton(onClick = onConfirmRequest) { Text(stringResource(R.string.okay)) } },
)
}

View file

@ -32,11 +32,7 @@ import kotlinx.coroutines.launch
import org.meshtastic.core.strings.R
@Composable
fun CopyIconButton(
valueToCopy: String,
modifier: Modifier = Modifier,
label: String = stringResource(id = R.string.copy),
) {
fun CopyIconButton(valueToCopy: String, modifier: Modifier = Modifier, label: String = stringResource(R.string.copy)) {
val clipboardManager = LocalClipboard.current
val coroutineScope = rememberCoroutineScope()
IconButton(

View file

@ -234,7 +234,7 @@ fun EditTextPreference(
{
Icon(
imageVector = Icons.TwoTone.Info,
contentDescription = stringResource(id = R.string.error),
contentDescription = stringResource(R.string.error),
tint = MaterialTheme.colorScheme.error,
)
}

View file

@ -191,9 +191,7 @@ fun IndoorAirQuality(iaq: Int?, displayMode: IaqDisplayMode = IaqDisplayMode.Pil
shape = RoundedCornerShape(16.dp),
text = { IAQScale() },
confirmButton = {
TextButton(onClick = { isLegendOpen = false }) {
Text(text = stringResource(id = R.string.close))
}
TextButton(onClick = { isLegendOpen = false }) { Text(text = stringResource(R.string.close)) }
},
)
}

View file

@ -142,7 +142,7 @@ fun Snr(snr: Float) {
}
Text(
text = "%s %.2fdB".format(stringResource(id = R.string.snr), snr),
text = "%s %.2fdB".format(stringResource(R.string.snr), snr),
color = color,
style = MaterialTheme.typography.labelSmall,
)
@ -159,7 +159,7 @@ fun Rssi(rssi: Int) {
Quality.BAD.color.invoke()
}
Text(
text = "%s %ddBm".format(stringResource(id = R.string.rssi), rssi),
text = "%s %ddBm".format(stringResource(R.string.rssi), rssi),
color = color,
style = MaterialTheme.typography.labelSmall,
)

View file

@ -75,7 +75,7 @@ fun MainAppBar(
IconButton(onClick = onNavigateUp) {
Icon(
imageVector = Icons.AutoMirrored.Filled.ArrowBack,
contentDescription = stringResource(id = R.string.navigate_back),
contentDescription = stringResource(R.string.navigate_back),
)
}
}
@ -85,7 +85,7 @@ fun MainAppBar(
Icon(
imageVector =
ImageVector.vectorResource(id = org.meshtastic.core.ui.R.drawable.ic_meshtastic),
contentDescription = stringResource(id = R.string.application_icon),
contentDescription = stringResource(R.string.application_icon),
)
}
}

View file

@ -174,7 +174,7 @@ private fun KeyStatusDialog(@StringRes title: Int, @StringRes text: Int, key: By
if (showAll) {
Text(stringResource(R.string.show_all_key_title))
} else {
Text(stringResource(id = title))
Text(stringResource(title))
}
},
text = {
@ -182,12 +182,12 @@ private fun KeyStatusDialog(@StringRes title: Int, @StringRes text: Int, key: By
AllKeyStates()
} else {
Column(horizontalAlignment = Alignment.CenterHorizontally) {
Text(text = stringResource(id = text), textAlign = TextAlign.Center)
Text(text = stringResource(text), textAlign = TextAlign.Center)
Spacer(Modifier.height(16.dp))
if (key != null && title == R.string.encryption_pkc) {
val keyString = Base64.encodeToString(key.toByteArray(), Base64.NO_WRAP)
Text(
text = stringResource(id = R.string.config_security_public_key) + ":",
text = stringResource(R.string.config_security_public_key) + ":",
textAlign = TextAlign.Center,
)
Spacer(Modifier.height(8.dp))

View file

@ -45,9 +45,9 @@ fun PreferenceFooter(
) {
PreferenceFooter(
enabled = enabled,
negativeText = stringResource(id = negativeText),
negativeText = stringResource(negativeText),
onNegativeClicked = onNegativeClicked,
positiveText = stringResource(id = positiveText),
positiveText = stringResource(positiveText),
onPositiveClicked = onPositiveClicked,
modifier = modifier,
)

View file

@ -211,11 +211,11 @@ private fun determineSecurityState(
@Composable
fun SecurityIcon(
securityState: SecurityState,
baseContentDescription: String = stringResource(id = R.string.security_icon_description),
baseContentDescription: String = stringResource(R.string.security_icon_description),
externalOnClick: (() -> Unit)? = null,
) {
var showHelpDialog by rememberSaveable { mutableStateOf(false) }
val fullContentDescription = baseContentDescription + " " + stringResource(id = securityState.descriptionResId)
val fullContentDescription = baseContentDescription + " " + stringResource(securityState.descriptionResId)
IconButton(
onClick = {
@ -252,7 +252,7 @@ fun SecurityIcon(
isLowEntropyKey: Boolean,
isPreciseLocation: Boolean = false,
isMqttEnabled: Boolean = false,
baseContentDescription: String = stringResource(id = R.string.security_icon_description),
baseContentDescription: String = stringResource(R.string.security_icon_description),
externalOnClick: (() -> Unit)? = null,
) {
val securityState = determineSecurityState(isLowEntropyKey, isPreciseLocation, isMqttEnabled)
@ -285,7 +285,7 @@ val Channel.isMqttEnabled: Boolean
@Composable
fun SecurityIcon(
channel: Channel,
baseContentDescription: String = stringResource(id = R.string.security_icon_description),
baseContentDescription: String = stringResource(R.string.security_icon_description),
externalOnClick: (() -> Unit)? = null,
) = SecurityIcon(
isLowEntropyKey = channel.isLowEntropyKey,
@ -305,7 +305,7 @@ fun SecurityIcon(
fun SecurityIcon(
channelSettings: ChannelSettings,
loraConfig: LoRaConfig,
baseContentDescription: String = stringResource(id = R.string.security_icon_description),
baseContentDescription: String = stringResource(R.string.security_icon_description),
externalOnClick: (() -> Unit)? = null,
) {
val channel = Channel(channelSettings, loraConfig)
@ -331,7 +331,7 @@ fun SecurityIcon(
fun SecurityIcon(
channelSet: AppOnlyProtos.ChannelSet,
channelIndex: Int,
baseContentDescription: String = stringResource(id = R.string.security_icon_description),
baseContentDescription: String = stringResource(R.string.security_icon_description),
externalOnClick: (() -> Unit)? = null,
) {
channelSet.getChannel(channelIndex)?.let { channel ->
@ -357,7 +357,7 @@ fun SecurityIcon(
fun SecurityIcon(
channelSet: AppOnlyProtos.ChannelSet,
channelName: String,
baseContentDescription: String = stringResource(id = R.string.security_icon_description),
baseContentDescription: String = stringResource(R.string.security_icon_description),
externalOnClick: (() -> Unit)? = null,
) {
val channelByNameMap =

View file

@ -51,7 +51,7 @@ fun SimpleAlertDialog(
modifier = Modifier.padding(horizontal = 16.dp),
colors = ButtonDefaults.textButtonColors(contentColor = MaterialTheme.colorScheme.onSurface),
) {
Text(text = dismissText ?: stringResource(id = R.string.cancel))
Text(text = dismissText ?: stringResource(R.string.cancel))
}
},
confirmButton = {
@ -61,12 +61,12 @@ fun SimpleAlertDialog(
modifier = Modifier.padding(horizontal = 16.dp),
colors = ButtonDefaults.textButtonColors(contentColor = MaterialTheme.colorScheme.onSurface),
) {
Text(text = confirmText ?: stringResource(id = R.string.okay))
Text(text = confirmText ?: stringResource(R.string.okay))
}
}
},
title = {
Text(text = stringResource(id = title), modifier = Modifier.fillMaxWidth(), textAlign = TextAlign.Center)
Text(text = stringResource(title), modifier = Modifier.fillMaxWidth(), textAlign = TextAlign.Center)
},
text = text,
shape = RoundedCornerShape(16.dp),
@ -82,9 +82,7 @@ fun SimpleAlertDialog(
onConfirm = onConfirm,
onDismiss = onDismiss,
title = title,
text = {
Text(text = stringResource(id = text), modifier = Modifier.fillMaxWidth(), textAlign = TextAlign.Center)
},
text = { Text(text = stringResource(text), modifier = Modifier.fillMaxWidth(), textAlign = TextAlign.Center) },
)
@Composable

View file

@ -189,7 +189,7 @@ fun ScannedQrCodeDialog(
) {
item {
Text(
text = stringResource(id = R.string.new_channel_rcvd),
text = stringResource(R.string.new_channel_rcvd),
modifier = Modifier.padding(20.dp),
style = MaterialTheme.typography.titleLarge,
)
@ -261,7 +261,7 @@ fun ScannedQrCodeDialog(
) {
TextButton(onClick = { onDismiss() }) {
Text(
text = stringResource(id = R.string.cancel),
text = stringResource(R.string.cancel),
color = MaterialTheme.colorScheme.onSurface,
overflow = TextOverflow.Ellipsis,
maxLines = 1,
@ -277,7 +277,7 @@ fun ScannedQrCodeDialog(
enabled = selectedChannelSet.settingsCount in 1..8,
) {
Text(
text = stringResource(id = R.string.accept),
text = stringResource(R.string.accept),
color = MaterialTheme.colorScheme.onSurface,
overflow = TextOverflow.Ellipsis,
maxLines = 1,