mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
Alias strings R to Res (#3619)
This commit is contained in:
parent
a687328f08
commit
0833a6767e
153 changed files with 1403 additions and 1350 deletions
|
|
@ -28,12 +28,12 @@ import org.junit.Rule
|
|||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.meshtastic.core.model.Channel
|
||||
import org.meshtastic.core.strings.R
|
||||
import org.meshtastic.proto.AppOnlyProtos.ChannelSet
|
||||
import org.meshtastic.proto.ConfigProtos
|
||||
import org.meshtastic.proto.channelSet
|
||||
import org.meshtastic.proto.channelSettings
|
||||
import org.meshtastic.proto.copy
|
||||
import org.meshtastic.core.strings.R as Res
|
||||
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class ScannedQrCodeDialogTest {
|
||||
|
|
@ -82,7 +82,7 @@ class ScannedQrCodeDialogTest {
|
|||
testScannedQrCodeDialog()
|
||||
|
||||
// Verify that the dialog title is displayed
|
||||
onNodeWithText(getString(R.string.new_channel_rcvd)).assertIsDisplayed()
|
||||
onNodeWithText(getString(Res.string.new_channel_rcvd)).assertIsDisplayed()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -92,8 +92,8 @@ class ScannedQrCodeDialogTest {
|
|||
testScannedQrCodeDialog()
|
||||
|
||||
// Verify that the "Add" and "Replace" buttons are displayed
|
||||
onNodeWithText(getString(R.string.add)).assertIsDisplayed()
|
||||
onNodeWithText(getString(R.string.replace)).assertIsDisplayed()
|
||||
onNodeWithText(getString(Res.string.add)).assertIsDisplayed()
|
||||
onNodeWithText(getString(Res.string.replace)).assertIsDisplayed()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -103,8 +103,8 @@ class ScannedQrCodeDialogTest {
|
|||
testScannedQrCodeDialog()
|
||||
|
||||
// Verify the "Cancel" and "Accept" buttons are displayed
|
||||
onNodeWithText(getString(R.string.cancel)).assertIsDisplayed()
|
||||
onNodeWithText(getString(R.string.accept)).assertIsDisplayed()
|
||||
onNodeWithText(getString(Res.string.cancel)).assertIsDisplayed()
|
||||
onNodeWithText(getString(Res.string.accept)).assertIsDisplayed()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -115,7 +115,7 @@ class ScannedQrCodeDialogTest {
|
|||
testScannedQrCodeDialog(onDismiss = { onDismissClicked = true })
|
||||
|
||||
// Click the "Cancel" button
|
||||
onNodeWithText(getString(R.string.cancel)).performClick()
|
||||
onNodeWithText(getString(Res.string.cancel)).performClick()
|
||||
}
|
||||
|
||||
// Verify onDismiss is called
|
||||
|
|
@ -129,7 +129,7 @@ class ScannedQrCodeDialogTest {
|
|||
testScannedQrCodeDialog(onConfirm = { actualChannelSet = it })
|
||||
|
||||
// Click the "Accept" button
|
||||
onNodeWithText(getString(R.string.accept)).performClick()
|
||||
onNodeWithText(getString(Res.string.accept)).performClick()
|
||||
}
|
||||
|
||||
// Verify onConfirm is called with the correct ChannelSet
|
||||
|
|
@ -143,8 +143,8 @@ class ScannedQrCodeDialogTest {
|
|||
testScannedQrCodeDialog(onConfirm = { actualChannelSet = it })
|
||||
|
||||
// Click the "Add" button then the "Accept" button
|
||||
onNodeWithText(getString(R.string.add)).performClick()
|
||||
onNodeWithText(getString(R.string.accept)).performClick()
|
||||
onNodeWithText(getString(Res.string.add)).performClick()
|
||||
onNodeWithText(getString(Res.string.accept)).performClick()
|
||||
}
|
||||
|
||||
// Verify onConfirm is called with the correct ChannelSet
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ import androidx.compose.ui.text.font.FontStyle
|
|||
import androidx.compose.ui.text.fromHtml
|
||||
import androidx.compose.ui.text.style.TextDecoration
|
||||
import androidx.compose.ui.unit.dp
|
||||
import org.meshtastic.core.strings.R
|
||||
import org.meshtastic.core.strings.R as Res
|
||||
|
||||
@Composable
|
||||
fun SimpleAlertDialog(
|
||||
|
|
@ -72,7 +72,7 @@ fun SimpleAlertDialog(
|
|||
Text(text = message.orEmpty())
|
||||
}
|
||||
},
|
||||
confirmButton = { TextButton(onClick = onConfirmRequest) { Text(stringResource(R.string.okay)) } },
|
||||
confirmButton = { TextButton(onClick = onConfirmRequest) { Text(stringResource(Res.string.okay)) } },
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ import androidx.compose.ui.Modifier
|
|||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import org.meshtastic.core.strings.R
|
||||
import org.meshtastic.core.strings.R as Res
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
|
|
@ -90,9 +90,9 @@ fun BitwisePreference(
|
|||
}
|
||||
PreferenceFooter(
|
||||
enabled = enabled,
|
||||
negativeText = R.string.clear,
|
||||
negativeText = Res.string.clear,
|
||||
onNegativeClicked = { onItemSelected(0) },
|
||||
positiveText = R.string.close,
|
||||
positiveText = Res.string.close,
|
||||
onPositiveClicked = { expanded = false },
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@ import org.meshtastic.proto.AdminProtos
|
|||
import org.meshtastic.proto.MeshProtos
|
||||
import timber.log.Timber
|
||||
import java.net.MalformedURLException
|
||||
import org.meshtastic.core.strings.R as Res
|
||||
|
||||
/**
|
||||
* Composable FloatingActionButton to initiate scanning a QR code for adding a contact. Handles camera permission
|
||||
|
|
@ -127,17 +128,14 @@ fun AddContactFAB(
|
|||
}
|
||||
},
|
||||
) {
|
||||
Icon(
|
||||
imageVector = Icons.TwoTone.QrCodeScanner,
|
||||
contentDescription = stringResource(org.meshtastic.core.strings.R.string.scan_qr_code),
|
||||
)
|
||||
Icon(imageVector = Icons.TwoTone.QrCodeScanner, contentDescription = stringResource(Res.string.scan_qr_code))
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun QrCodeImage(uri: Uri, modifier: Modifier = Modifier) = Image(
|
||||
painter = uri.qrCode?.let { BitmapPainter(it.asImageBitmap()) } ?: painterResource(id = R.drawable.qrcode),
|
||||
contentDescription = stringResource(org.meshtastic.core.strings.R.string.qr_code),
|
||||
contentDescription = stringResource(Res.string.qr_code),
|
||||
modifier = modifier,
|
||||
contentScale = ContentScale.Inside,
|
||||
)
|
||||
|
|
@ -165,7 +163,7 @@ fun SharedContactDialog(contact: Node?, onDismiss: () -> Unit) {
|
|||
val sharedContact = AdminProtos.SharedContact.newBuilder().setUser(contact.user).setNodeNum(contact.num).build()
|
||||
val uri = sharedContact.getSharedContactUrl()
|
||||
SimpleAlertDialog(
|
||||
title = org.meshtastic.core.strings.R.string.share_contact,
|
||||
title = Res.string.share_contact,
|
||||
text = {
|
||||
Column {
|
||||
Text(contact.user.longName)
|
||||
|
|
|
|||
|
|
@ -29,10 +29,14 @@ import androidx.compose.ui.platform.ClipEntry
|
|||
import androidx.compose.ui.platform.LocalClipboard
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import kotlinx.coroutines.launch
|
||||
import org.meshtastic.core.strings.R
|
||||
import org.meshtastic.core.strings.R as Res
|
||||
|
||||
@Composable
|
||||
fun CopyIconButton(valueToCopy: String, modifier: Modifier = Modifier, label: String = stringResource(R.string.copy)) {
|
||||
fun CopyIconButton(
|
||||
valueToCopy: String,
|
||||
modifier: Modifier = Modifier,
|
||||
label: String = stringResource(Res.string.copy),
|
||||
) {
|
||||
val clipboardManager = LocalClipboard.current
|
||||
val coroutineScope = rememberCoroutineScope()
|
||||
IconButton(
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ import com.google.protobuf.ByteString
|
|||
import org.meshtastic.core.model.Channel
|
||||
import org.meshtastic.core.model.util.encodeToString
|
||||
import org.meshtastic.core.model.util.toByteString
|
||||
import org.meshtastic.core.strings.R
|
||||
import org.meshtastic.core.strings.R as Res
|
||||
|
||||
@Suppress("LongMethod")
|
||||
@Composable
|
||||
|
|
@ -77,8 +77,8 @@ fun EditBase64Preference(
|
|||
|
||||
val (icon, description) =
|
||||
when {
|
||||
isError -> Icons.TwoTone.Close to stringResource(R.string.error)
|
||||
onGenerateKey != null && !isFocused -> Icons.TwoTone.Refresh to stringResource(R.string.reset)
|
||||
isError -> Icons.TwoTone.Close to stringResource(Res.string.error)
|
||||
onGenerateKey != null && !isFocused -> Icons.TwoTone.Refresh to stringResource(Res.string.reset)
|
||||
else -> null to null
|
||||
}
|
||||
Column(modifier = modifier.padding(horizontal = 16.dp, vertical = 8.dp)) {
|
||||
|
|
|
|||
|
|
@ -41,11 +41,11 @@ import androidx.compose.ui.text.input.KeyboardType
|
|||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.google.protobuf.ByteString
|
||||
import org.meshtastic.core.strings.R
|
||||
import org.meshtastic.proto.ModuleConfigProtos.RemoteHardwarePin
|
||||
import org.meshtastic.proto.ModuleConfigProtos.RemoteHardwarePinType
|
||||
import org.meshtastic.proto.copy
|
||||
import org.meshtastic.proto.remoteHardwarePin
|
||||
import org.meshtastic.core.strings.R as Res
|
||||
|
||||
@Suppress("LongMethod")
|
||||
@Composable
|
||||
|
|
@ -84,7 +84,7 @@ inline fun <reified T> EditListPreference(
|
|||
) {
|
||||
Icon(
|
||||
imageVector = Icons.TwoTone.Close,
|
||||
contentDescription = stringResource(R.string.delete),
|
||||
contentDescription = stringResource(Res.string.delete),
|
||||
modifier = Modifier.wrapContentSize(),
|
||||
)
|
||||
}
|
||||
|
|
@ -119,7 +119,7 @@ inline fun <reified T> EditListPreference(
|
|||
}
|
||||
is RemoteHardwarePin -> {
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.gpio_pin),
|
||||
title = stringResource(Res.string.gpio_pin),
|
||||
value = value.gpioPin,
|
||||
enabled = enabled,
|
||||
keyboardActions = keyboardActions,
|
||||
|
|
@ -131,7 +131,7 @@ inline fun <reified T> EditListPreference(
|
|||
},
|
||||
)
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.name),
|
||||
title = stringResource(Res.string.name),
|
||||
value = value.name,
|
||||
maxSize = 14, // name max_size:15
|
||||
enabled = enabled,
|
||||
|
|
@ -146,7 +146,7 @@ inline fun <reified T> EditListPreference(
|
|||
trailingIcon = trailingIcon,
|
||||
)
|
||||
DropDownPreference(
|
||||
title = stringResource(R.string.type),
|
||||
title = stringResource(Res.string.type),
|
||||
enabled = enabled,
|
||||
items =
|
||||
RemoteHardwarePinType.entries
|
||||
|
|
@ -176,7 +176,7 @@ inline fun <reified T> EditListPreference(
|
|||
},
|
||||
enabled = maxCount > listState.size,
|
||||
) {
|
||||
Text(text = stringResource(R.string.add))
|
||||
Text(text = stringResource(Res.string.add))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -186,7 +186,7 @@ inline fun <reified T> EditListPreference(
|
|||
private fun EditListPreferencePreview() {
|
||||
Column {
|
||||
EditListPreference(
|
||||
title = stringResource(R.string.ignore_incoming),
|
||||
title = stringResource(Res.string.ignore_incoming),
|
||||
summary = "This is a summary",
|
||||
list = listOf(12345, 67890),
|
||||
maxCount = 4,
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ import androidx.compose.ui.text.input.KeyboardType
|
|||
import androidx.compose.ui.text.input.PasswordVisualTransformation
|
||||
import androidx.compose.ui.text.input.VisualTransformation
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import org.meshtastic.core.strings.R
|
||||
import org.meshtastic.core.strings.R as Res
|
||||
|
||||
@Composable
|
||||
fun EditPasswordPreference(
|
||||
|
|
@ -67,9 +67,9 @@ fun EditPasswordPreference(
|
|||
imageVector = if (isPasswordVisible) Icons.TwoTone.VisibilityOff else Icons.TwoTone.VisibilityOff,
|
||||
contentDescription =
|
||||
if (isPasswordVisible) {
|
||||
stringResource(R.string.hide_password)
|
||||
stringResource(Res.string.hide_password)
|
||||
} else {
|
||||
stringResource(R.string.show_password)
|
||||
stringResource(Res.string.show_password)
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ import androidx.compose.ui.text.input.KeyboardType
|
|||
import androidx.compose.ui.text.input.VisualTransformation
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import org.meshtastic.core.strings.R
|
||||
import org.meshtastic.core.strings.R as Res
|
||||
|
||||
@Composable
|
||||
fun SignedIntegerEditTextPreference(
|
||||
|
|
@ -234,7 +234,7 @@ fun EditTextPreference(
|
|||
{
|
||||
Icon(
|
||||
imageVector = Icons.TwoTone.Info,
|
||||
contentDescription = stringResource(R.string.error),
|
||||
contentDescription = stringResource(Res.string.error),
|
||||
tint = MaterialTheme.colorScheme.error,
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,6 @@ import androidx.compose.ui.text.style.TextAlign
|
|||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import org.meshtastic.core.strings.R
|
||||
import org.meshtastic.core.ui.theme.IAQColors.IAQDangerouslyPolluted
|
||||
import org.meshtastic.core.ui.theme.IAQColors.IAQExcellent
|
||||
import org.meshtastic.core.ui.theme.IAQColors.IAQExtremelyPolluted
|
||||
|
|
@ -66,6 +65,7 @@ import org.meshtastic.core.ui.theme.IAQColors.IAQHeavilyPolluted
|
|||
import org.meshtastic.core.ui.theme.IAQColors.IAQLightlyPolluted
|
||||
import org.meshtastic.core.ui.theme.IAQColors.IAQModeratelyPolluted
|
||||
import org.meshtastic.core.ui.theme.IAQColors.IAQSeverelyPolluted
|
||||
import org.meshtastic.core.strings.R as Res
|
||||
|
||||
@Suppress("MagicNumber")
|
||||
enum class Iaq(val color: Color, val description: String, val range: IntRange) {
|
||||
|
|
@ -135,7 +135,7 @@ fun IndoorAirQuality(iaq: Int?, displayMode: IaqDisplayMode = IaqDisplayMode.Pil
|
|||
Icon(
|
||||
imageVector =
|
||||
if (iaqEnum.range.first < 100) Icons.Default.ThumbUp else Icons.Filled.Warning,
|
||||
contentDescription = stringResource(R.string.air_quality_icon),
|
||||
contentDescription = stringResource(Res.string.air_quality_icon),
|
||||
tint = Color.White,
|
||||
)
|
||||
}
|
||||
|
|
@ -191,7 +191,7 @@ fun IndoorAirQuality(iaq: Int?, displayMode: IaqDisplayMode = IaqDisplayMode.Pil
|
|||
shape = RoundedCornerShape(16.dp),
|
||||
text = { IAQScale() },
|
||||
confirmButton = {
|
||||
TextButton(onClick = { isLegendOpen = false }) { Text(text = stringResource(R.string.close)) }
|
||||
TextButton(onClick = { isLegendOpen = false }) { Text(text = stringResource(Res.string.close)) }
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
@ -207,7 +207,7 @@ fun IndoorAirQuality(iaq: Int?, displayMode: IaqDisplayMode = IaqDisplayMode.Pil
|
|||
fun IAQScale(modifier: Modifier = Modifier) {
|
||||
Column(modifier = modifier.padding(16.dp), horizontalAlignment = Alignment.Start) {
|
||||
Text(
|
||||
text = stringResource(R.string.indoor_air_quality_iaq),
|
||||
text = stringResource(Res.string.indoor_air_quality_iaq),
|
||||
style =
|
||||
MaterialTheme.typography.titleLarge.copy(fontWeight = FontWeight.Bold, textAlign = TextAlign.Center),
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
|
|
|
|||
|
|
@ -45,11 +45,11 @@ import androidx.compose.ui.graphics.Color
|
|||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import org.meshtastic.core.strings.R
|
||||
import org.meshtastic.core.ui.theme.StatusColors.StatusGreen
|
||||
import org.meshtastic.core.ui.theme.StatusColors.StatusOrange
|
||||
import org.meshtastic.core.ui.theme.StatusColors.StatusRed
|
||||
import org.meshtastic.core.ui.theme.StatusColors.StatusYellow
|
||||
import org.meshtastic.core.strings.R as Res
|
||||
|
||||
const val SNR_GOOD_THRESHOLD = -7f
|
||||
const val SNR_FAIR_THRESHOLD = -15f
|
||||
|
|
@ -63,10 +63,10 @@ enum class Quality(
|
|||
@Stable val imageVector: ImageVector,
|
||||
@Stable val color: @Composable () -> Color,
|
||||
) {
|
||||
NONE(R.string.none_quality, Icons.Default.SignalCellularAlt1Bar, { colorScheme.StatusRed }),
|
||||
BAD(R.string.bad, Icons.Default.SignalCellularAlt2Bar, { colorScheme.StatusOrange }),
|
||||
FAIR(R.string.fair, Icons.Default.SignalCellularAlt, { colorScheme.StatusYellow }),
|
||||
GOOD(R.string.good, Icons.Default.SignalCellular4Bar, { colorScheme.StatusGreen }),
|
||||
NONE(Res.string.none_quality, Icons.Default.SignalCellularAlt1Bar, { colorScheme.StatusRed }),
|
||||
BAD(Res.string.bad, Icons.Default.SignalCellularAlt2Bar, { colorScheme.StatusOrange }),
|
||||
FAIR(Res.string.fair, Icons.Default.SignalCellularAlt, { colorScheme.StatusYellow }),
|
||||
GOOD(Res.string.good, Icons.Default.SignalCellular4Bar, { colorScheme.StatusGreen }),
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -85,14 +85,14 @@ fun NodeSignalQuality(snr: Float, rssi: Int, modifier: Modifier = Modifier) {
|
|||
Snr(snr)
|
||||
Rssi(rssi)
|
||||
Text(
|
||||
text = "${stringResource(R.string.signal)} ${stringResource(quality.nameRes)}",
|
||||
text = "${stringResource(Res.string.signal)} ${stringResource(quality.nameRes)}",
|
||||
style = MaterialTheme.typography.labelSmall,
|
||||
maxLines = 1,
|
||||
)
|
||||
Icon(
|
||||
modifier = Modifier.size(20.dp),
|
||||
imageVector = quality.imageVector,
|
||||
contentDescription = stringResource(R.string.signal_quality),
|
||||
contentDescription = stringResource(Res.string.signal_quality),
|
||||
tint = quality.color.invoke(),
|
||||
)
|
||||
}
|
||||
|
|
@ -119,11 +119,11 @@ fun LoraSignalIndicator(snr: Float, rssi: Int, contentColor: Color = MaterialThe
|
|||
Icon(
|
||||
modifier = Modifier.size(20.dp),
|
||||
imageVector = quality.imageVector,
|
||||
contentDescription = stringResource(R.string.signal_quality),
|
||||
contentDescription = stringResource(Res.string.signal_quality),
|
||||
tint = quality.color.invoke(),
|
||||
)
|
||||
Text(
|
||||
text = "${stringResource(R.string.signal)} ${stringResource(quality.nameRes)}",
|
||||
text = "${stringResource(Res.string.signal)} ${stringResource(quality.nameRes)}",
|
||||
style = MaterialTheme.typography.labelSmall,
|
||||
color = contentColor,
|
||||
)
|
||||
|
|
@ -142,7 +142,7 @@ fun Snr(snr: Float) {
|
|||
}
|
||||
|
||||
Text(
|
||||
text = "%s %.2fdB".format(stringResource(R.string.snr), snr),
|
||||
text = "%s %.2fdB".format(stringResource(Res.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(R.string.rssi), rssi),
|
||||
text = "%s %ddBm".format(stringResource(Res.string.rssi), rssi),
|
||||
color = color,
|
||||
style = MaterialTheme.typography.labelSmall,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -40,10 +40,10 @@ import androidx.compose.ui.tooling.preview.PreviewLightDark
|
|||
import androidx.compose.ui.tooling.preview.PreviewParameter
|
||||
import androidx.compose.ui.unit.dp
|
||||
import org.meshtastic.core.database.model.Node
|
||||
import org.meshtastic.core.strings.R
|
||||
import org.meshtastic.core.ui.component.preview.BooleanProvider
|
||||
import org.meshtastic.core.ui.component.preview.previewNode
|
||||
import org.meshtastic.core.ui.theme.AppTheme
|
||||
import org.meshtastic.core.strings.R as Res
|
||||
|
||||
@OptIn(ExperimentalMaterial3ExpressiveApi::class, ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
|
|
@ -75,7 +75,7 @@ fun MainAppBar(
|
|||
IconButton(onClick = onNavigateUp) {
|
||||
Icon(
|
||||
imageVector = Icons.AutoMirrored.Filled.ArrowBack,
|
||||
contentDescription = stringResource(R.string.navigate_back),
|
||||
contentDescription = stringResource(Res.string.navigate_back),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -85,7 +85,7 @@ fun MainAppBar(
|
|||
Icon(
|
||||
imageVector =
|
||||
ImageVector.vectorResource(id = org.meshtastic.core.ui.R.drawable.ic_meshtastic),
|
||||
contentDescription = stringResource(R.string.application_icon),
|
||||
contentDescription = stringResource(Res.string.application_icon),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@ import androidx.compose.ui.tooling.preview.PreviewLightDark
|
|||
import androidx.compose.ui.tooling.preview.PreviewParameter
|
||||
import androidx.compose.ui.tooling.preview.PreviewParameterProvider
|
||||
import androidx.compose.ui.unit.dp
|
||||
import org.meshtastic.core.strings.R
|
||||
import org.meshtastic.core.ui.icon.BatteryEmpty
|
||||
import org.meshtastic.core.ui.icon.BatteryUnknown
|
||||
import org.meshtastic.core.ui.icon.MeshtasticIcons
|
||||
|
|
@ -46,6 +45,7 @@ import org.meshtastic.core.ui.theme.AppTheme
|
|||
import org.meshtastic.core.ui.theme.StatusColors.StatusGreen
|
||||
import org.meshtastic.core.ui.theme.StatusColors.StatusOrange
|
||||
import org.meshtastic.core.ui.theme.StatusColors.StatusRed
|
||||
import org.meshtastic.core.strings.R as Res
|
||||
|
||||
private const val FORMAT = "%d%%"
|
||||
private const val SIZE_ICON = 20
|
||||
|
|
@ -70,7 +70,7 @@ fun MaterialBatteryInfo(
|
|||
modifier = Modifier.size(SIZE_ICON.dp),
|
||||
imageVector = MeshtasticIcons.BatteryUnknown,
|
||||
tint = contentColor,
|
||||
contentDescription = stringResource(R.string.unknown),
|
||||
contentDescription = stringResource(Res.string.unknown),
|
||||
)
|
||||
} else if (level > 100) {
|
||||
Icon(
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@ import androidx.compose.ui.tooling.preview.PreviewLightDark
|
|||
import androidx.compose.ui.tooling.preview.PreviewParameter
|
||||
import androidx.compose.ui.tooling.preview.PreviewParameterProvider
|
||||
import androidx.compose.ui.unit.dp
|
||||
import org.meshtastic.core.strings.R
|
||||
import org.meshtastic.core.ui.icon.MeshtasticIcons
|
||||
import org.meshtastic.core.ui.icon.SignalCellular0Bar
|
||||
import org.meshtastic.core.ui.icon.SignalCellular1Bar
|
||||
|
|
@ -52,6 +51,7 @@ import org.meshtastic.core.ui.theme.StatusColors.StatusGreen
|
|||
import org.meshtastic.core.ui.theme.StatusColors.StatusOrange
|
||||
import org.meshtastic.core.ui.theme.StatusColors.StatusRed
|
||||
import org.meshtastic.core.ui.theme.StatusColors.StatusYellow
|
||||
import org.meshtastic.core.strings.R as Res
|
||||
|
||||
private const val SIZE_ICON = 20
|
||||
|
||||
|
|
@ -116,7 +116,7 @@ fun MaterialBluetoothSignalInfo(rssi: Int, modifier: Modifier = Modifier) {
|
|||
MaterialSignalInfo(
|
||||
modifier = modifier,
|
||||
signalBars = getBluetoothSignalBars(rssi = rssi),
|
||||
signalStrengthValue = stringResource(R.string.dbm_value, rssi),
|
||||
signalStrengthValue = stringResource(Res.string.dbm_value, rssi),
|
||||
typeIcon = Icons.Rounded.Bluetooth,
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,11 +61,11 @@ import androidx.compose.ui.tooling.preview.PreviewLightDark
|
|||
import androidx.compose.ui.unit.dp
|
||||
import com.google.protobuf.ByteString
|
||||
import org.meshtastic.core.model.Channel
|
||||
import org.meshtastic.core.strings.R
|
||||
import org.meshtastic.core.ui.theme.AppTheme
|
||||
import org.meshtastic.core.ui.theme.StatusColors.StatusGreen
|
||||
import org.meshtastic.core.ui.theme.StatusColors.StatusRed
|
||||
import org.meshtastic.core.ui.theme.StatusColors.StatusYellow
|
||||
import org.meshtastic.core.strings.R as Res
|
||||
|
||||
/**
|
||||
* function to display information about the current node's encryption key.
|
||||
|
|
@ -85,9 +85,9 @@ fun NodeKeyStatusIcon(
|
|||
if (showEncryptionDialog) {
|
||||
val (title, text) =
|
||||
when {
|
||||
mismatchKey -> R.string.encryption_error to R.string.encryption_error_text
|
||||
hasPKC -> R.string.encryption_pkc to R.string.encryption_pkc_text
|
||||
else -> R.string.encryption_psk to R.string.encryption_psk_text
|
||||
mismatchKey -> Res.string.encryption_error to Res.string.encryption_error_text
|
||||
hasPKC -> Res.string.encryption_pkc to Res.string.encryption_pkc_text
|
||||
else -> Res.string.encryption_psk to Res.string.encryption_psk_text
|
||||
}
|
||||
KeyStatusDialog(title, text, publicKey) { showEncryptionDialog = false }
|
||||
}
|
||||
|
|
@ -108,9 +108,9 @@ fun NodeKeyStatusIcon(
|
|||
stringResource(
|
||||
id =
|
||||
when {
|
||||
mismatchKey -> R.string.encryption_error
|
||||
hasPKC -> R.string.encryption_pkc
|
||||
else -> R.string.encryption_psk
|
||||
mismatchKey -> Res.string.encryption_error
|
||||
hasPKC -> Res.string.encryption_pkc
|
||||
else -> Res.string.encryption_psk
|
||||
},
|
||||
),
|
||||
tint = tint,
|
||||
|
|
@ -140,27 +140,27 @@ enum class NodeKeySecurityState(
|
|||
PKM(
|
||||
icon = Icons.Default.KeyOff,
|
||||
color = { colorScheme.StatusRed },
|
||||
descriptionResId = R.string.encryption_error,
|
||||
helpTextResId = R.string.encryption_error_text,
|
||||
title = R.string.encryption_error,
|
||||
descriptionResId = Res.string.encryption_error,
|
||||
helpTextResId = Res.string.encryption_error_text,
|
||||
title = Res.string.encryption_error,
|
||||
),
|
||||
|
||||
// State for public key encryption
|
||||
PKC(
|
||||
icon = Icons.Default.Lock,
|
||||
color = { colorScheme.StatusGreen },
|
||||
title = R.string.encryption_pkc,
|
||||
helpTextResId = R.string.encryption_pkc_text,
|
||||
descriptionResId = R.string.encryption_pkc,
|
||||
title = Res.string.encryption_pkc,
|
||||
helpTextResId = Res.string.encryption_pkc_text,
|
||||
descriptionResId = Res.string.encryption_pkc,
|
||||
),
|
||||
|
||||
// State for shared key encryption
|
||||
PSK(
|
||||
icon = Icons.Default.LockOpen,
|
||||
color = { colorScheme.StatusYellow },
|
||||
title = R.string.encryption_psk,
|
||||
helpTextResId = R.string.encryption_psk_text,
|
||||
descriptionResId = R.string.encryption_psk,
|
||||
title = Res.string.encryption_psk,
|
||||
helpTextResId = Res.string.encryption_psk_text,
|
||||
descriptionResId = Res.string.encryption_psk,
|
||||
),
|
||||
}
|
||||
|
||||
|
|
@ -172,7 +172,7 @@ private fun KeyStatusDialog(@StringRes title: Int, @StringRes text: Int, key: By
|
|||
onDismissRequest = onDismiss,
|
||||
title = {
|
||||
if (showAll) {
|
||||
Text(stringResource(R.string.show_all_key_title))
|
||||
Text(stringResource(Res.string.show_all_key_title))
|
||||
} else {
|
||||
Text(stringResource(title))
|
||||
}
|
||||
|
|
@ -184,10 +184,10 @@ private fun KeyStatusDialog(@StringRes title: Int, @StringRes text: Int, key: By
|
|||
Column(horizontalAlignment = Alignment.CenterHorizontally) {
|
||||
Text(text = stringResource(text), textAlign = TextAlign.Center)
|
||||
Spacer(Modifier.height(16.dp))
|
||||
if (key != null && title == R.string.encryption_pkc) {
|
||||
if (key != null && title == Res.string.encryption_pkc) {
|
||||
val keyString = Base64.encodeToString(key.toByteArray(), Base64.NO_WRAP)
|
||||
Text(
|
||||
text = stringResource(R.string.config_security_public_key) + ":",
|
||||
text = stringResource(Res.string.config_security_public_key) + ":",
|
||||
textAlign = TextAlign.Center,
|
||||
)
|
||||
Spacer(Modifier.height(8.dp))
|
||||
|
|
@ -208,13 +208,13 @@ private fun KeyStatusDialog(@StringRes title: Int, @StringRes text: Int, key: By
|
|||
TextButton(onClick = { showAll = !showAll }) {
|
||||
Text(
|
||||
if (showAll) {
|
||||
stringResource(R.string.security_icon_help_show_less)
|
||||
stringResource(Res.string.security_icon_help_show_less)
|
||||
} else {
|
||||
stringResource(R.string.security_icon_help_show_all)
|
||||
stringResource(Res.string.security_icon_help_show_all)
|
||||
},
|
||||
)
|
||||
}
|
||||
TextButton(onClick = onDismiss) { Text(stringResource(R.string.security_icon_help_dismiss)) }
|
||||
TextButton(onClick = onDismiss) { Text(stringResource(Res.string.security_icon_help_dismiss)) }
|
||||
}
|
||||
},
|
||||
)
|
||||
|
|
@ -256,7 +256,9 @@ private fun AllKeyStates() {
|
|||
@PreviewLightDark
|
||||
@Composable
|
||||
private fun KeyStatusDialogErrorPreview() {
|
||||
AppTheme { KeyStatusDialog(title = R.string.encryption_error, text = R.string.encryption_error_text, key = null) }
|
||||
AppTheme {
|
||||
KeyStatusDialog(title = Res.string.encryption_error, text = Res.string.encryption_error_text, key = null)
|
||||
}
|
||||
}
|
||||
|
||||
@PreviewLightDark
|
||||
|
|
@ -264,8 +266,8 @@ private fun KeyStatusDialogErrorPreview() {
|
|||
private fun KeyStatusDialogPkcPreview() {
|
||||
AppTheme {
|
||||
KeyStatusDialog(
|
||||
title = R.string.encryption_pkc,
|
||||
text = R.string.encryption_pkc_text,
|
||||
title = Res.string.encryption_pkc,
|
||||
text = Res.string.encryption_pkc_text,
|
||||
key = Channel.getRandomKey(),
|
||||
)
|
||||
}
|
||||
|
|
@ -274,7 +276,7 @@ private fun KeyStatusDialogPkcPreview() {
|
|||
@PreviewLightDark
|
||||
@Composable
|
||||
private fun KeyStatusDialogPskPreview() {
|
||||
AppTheme { KeyStatusDialog(title = R.string.encryption_psk, text = R.string.encryption_psk_text, key = null) }
|
||||
AppTheme { KeyStatusDialog(title = Res.string.encryption_psk, text = Res.string.encryption_psk_text, key = null) }
|
||||
}
|
||||
|
||||
@Preview
|
||||
|
|
|
|||
|
|
@ -33,9 +33,9 @@ import androidx.compose.ui.tooling.preview.Preview
|
|||
import androidx.compose.ui.unit.dp
|
||||
import org.meshtastic.core.model.util.DistanceUnit
|
||||
import org.meshtastic.core.model.util.toDistanceString
|
||||
import org.meshtastic.core.strings.R
|
||||
import kotlin.math.pow
|
||||
import kotlin.math.roundToInt
|
||||
import org.meshtastic.core.strings.R as Res
|
||||
|
||||
private const val POSITION_ENABLED = 32
|
||||
private const val POSITION_DISABLED = 0
|
||||
|
|
@ -58,7 +58,7 @@ fun PositionPrecisionPreference(
|
|||
|
||||
Column(modifier = modifier) {
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.position_enabled),
|
||||
title = stringResource(Res.string.position_enabled),
|
||||
checked = value != POSITION_DISABLED,
|
||||
enabled = enabled,
|
||||
onCheckedChange = { enabled ->
|
||||
|
|
@ -69,7 +69,7 @@ fun PositionPrecisionPreference(
|
|||
)
|
||||
if (value != POSITION_DISABLED) {
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.precise_location),
|
||||
title = stringResource(Res.string.precise_location),
|
||||
checked = value == POSITION_ENABLED,
|
||||
enabled = enabled,
|
||||
onCheckedChange = { enabled ->
|
||||
|
|
|
|||
|
|
@ -62,13 +62,13 @@ import androidx.compose.ui.tooling.preview.Preview
|
|||
import androidx.compose.ui.unit.dp
|
||||
import org.meshtastic.core.model.Channel
|
||||
import org.meshtastic.core.model.util.getChannel
|
||||
import org.meshtastic.core.strings.R
|
||||
import org.meshtastic.core.ui.theme.StatusColors.StatusGreen
|
||||
import org.meshtastic.core.ui.theme.StatusColors.StatusRed
|
||||
import org.meshtastic.core.ui.theme.StatusColors.StatusYellow
|
||||
import org.meshtastic.proto.AppOnlyProtos
|
||||
import org.meshtastic.proto.ChannelProtos.ChannelSettings
|
||||
import org.meshtastic.proto.ConfigProtos.Config.LoRaConfig
|
||||
import org.meshtastic.core.strings.R as Res
|
||||
|
||||
private const val PRECISE_POSITION_BITS = 32
|
||||
|
||||
|
|
@ -96,8 +96,8 @@ enum class SecurityState(
|
|||
SECURE(
|
||||
icon = Icons.Filled.Lock,
|
||||
color = { colorScheme.StatusGreen },
|
||||
descriptionResId = R.string.security_icon_secure,
|
||||
helpTextResId = R.string.security_icon_help_green_lock,
|
||||
descriptionResId = Res.string.security_icon_secure,
|
||||
helpTextResId = Res.string.security_icon_help_green_lock,
|
||||
),
|
||||
|
||||
/**
|
||||
|
|
@ -107,8 +107,8 @@ enum class SecurityState(
|
|||
INSECURE_NO_PRECISE(
|
||||
icon = Icons.Filled.LockOpen,
|
||||
color = { colorScheme.StatusYellow },
|
||||
descriptionResId = R.string.security_icon_insecure_no_precise,
|
||||
helpTextResId = R.string.security_icon_help_yellow_open_lock,
|
||||
descriptionResId = Res.string.security_icon_insecure_no_precise,
|
||||
helpTextResId = Res.string.security_icon_help_yellow_open_lock,
|
||||
),
|
||||
|
||||
/**
|
||||
|
|
@ -118,8 +118,8 @@ enum class SecurityState(
|
|||
INSECURE_PRECISE_ONLY(
|
||||
icon = Icons.Filled.LockOpen,
|
||||
color = { colorScheme.StatusRed },
|
||||
descriptionResId = R.string.security_icon_insecure_precise_only,
|
||||
helpTextResId = R.string.security_icon_help_red_open_lock,
|
||||
descriptionResId = Res.string.security_icon_insecure_precise_only,
|
||||
helpTextResId = Res.string.security_icon_help_red_open_lock,
|
||||
),
|
||||
|
||||
/**
|
||||
|
|
@ -129,8 +129,8 @@ enum class SecurityState(
|
|||
INSECURE_PRECISE_MQTT_WARNING(
|
||||
icon = Icons.Filled.LockOpen,
|
||||
color = { colorScheme.StatusRed },
|
||||
descriptionResId = R.string.security_icon_warning_precise_mqtt,
|
||||
helpTextResId = R.string.security_icon_help_warning_precise_mqtt,
|
||||
descriptionResId = Res.string.security_icon_warning_precise_mqtt,
|
||||
helpTextResId = Res.string.security_icon_help_warning_precise_mqtt,
|
||||
badgeIcon = Icons.Filled.Warning,
|
||||
badgeIconColor = { colorScheme.StatusYellow },
|
||||
),
|
||||
|
|
@ -163,7 +163,7 @@ private fun SecurityIconDisplay(
|
|||
) {
|
||||
Icon(
|
||||
imageVector = badgeIcon,
|
||||
contentDescription = stringResource(R.string.security_icon_badge_warning_description),
|
||||
contentDescription = stringResource(Res.string.security_icon_badge_warning_description),
|
||||
tint = badgeIconColor ?: colorScheme.onError, // Default for contrast
|
||||
modifier = Modifier.size(16.dp), // Adjusted badge icon size
|
||||
)
|
||||
|
|
@ -211,7 +211,7 @@ private fun determineSecurityState(
|
|||
@Composable
|
||||
fun SecurityIcon(
|
||||
securityState: SecurityState,
|
||||
baseContentDescription: String = stringResource(R.string.security_icon_description),
|
||||
baseContentDescription: String = stringResource(Res.string.security_icon_description),
|
||||
externalOnClick: (() -> Unit)? = null,
|
||||
) {
|
||||
var showHelpDialog by rememberSaveable { mutableStateOf(false) }
|
||||
|
|
@ -252,7 +252,7 @@ fun SecurityIcon(
|
|||
isLowEntropyKey: Boolean,
|
||||
isPreciseLocation: Boolean = false,
|
||||
isMqttEnabled: Boolean = false,
|
||||
baseContentDescription: String = stringResource(R.string.security_icon_description),
|
||||
baseContentDescription: String = stringResource(Res.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(R.string.security_icon_description),
|
||||
baseContentDescription: String = stringResource(Res.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(R.string.security_icon_description),
|
||||
baseContentDescription: String = stringResource(Res.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(R.string.security_icon_description),
|
||||
baseContentDescription: String = stringResource(Res.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(R.string.security_icon_description),
|
||||
baseContentDescription: String = stringResource(Res.string.security_icon_description),
|
||||
externalOnClick: (() -> Unit)? = null,
|
||||
) {
|
||||
val channelByNameMap =
|
||||
|
|
@ -394,9 +394,9 @@ private fun SecurityHelpDialog(securityState: SecurityState, onDismiss: () -> Un
|
|||
title = {
|
||||
Text(
|
||||
if (showAll) {
|
||||
stringResource(R.string.security_icon_help_title_all)
|
||||
stringResource(Res.string.security_icon_help_title_all)
|
||||
} else {
|
||||
stringResource(R.string.security_icon_help_title)
|
||||
stringResource(Res.string.security_icon_help_title)
|
||||
},
|
||||
)
|
||||
},
|
||||
|
|
@ -416,13 +416,13 @@ private fun SecurityHelpDialog(securityState: SecurityState, onDismiss: () -> Un
|
|||
TextButton(onClick = { showAll = !showAll }) {
|
||||
Text(
|
||||
if (showAll) {
|
||||
stringResource(R.string.security_icon_help_show_less)
|
||||
stringResource(Res.string.security_icon_help_show_less)
|
||||
} else {
|
||||
stringResource(R.string.security_icon_help_show_all)
|
||||
stringResource(Res.string.security_icon_help_show_all)
|
||||
},
|
||||
)
|
||||
}
|
||||
TextButton(onClick = onDismiss) { Text(stringResource(R.string.security_icon_help_dismiss)) }
|
||||
TextButton(onClick = onDismiss) { Text(stringResource(Res.string.security_icon_help_dismiss)) }
|
||||
}
|
||||
},
|
||||
)
|
||||
|
|
|
|||
|
|
@ -34,9 +34,9 @@ import androidx.compose.ui.tooling.preview.PreviewLightDark
|
|||
import androidx.compose.ui.tooling.preview.PreviewParameter
|
||||
import androidx.compose.ui.unit.dp
|
||||
import org.meshtastic.core.database.model.Node
|
||||
import org.meshtastic.core.strings.R
|
||||
import org.meshtastic.core.ui.component.preview.NodePreviewParameterProvider
|
||||
import org.meshtastic.core.ui.theme.AppTheme
|
||||
import org.meshtastic.core.strings.R as Res
|
||||
|
||||
const val MAX_VALID_SNR = 100F
|
||||
const val MAX_VALID_RSSI = 0
|
||||
|
|
@ -51,14 +51,14 @@ fun SignalInfo(
|
|||
) {
|
||||
val text =
|
||||
if (isThisNode) {
|
||||
stringResource(R.string.channel_air_util)
|
||||
stringResource(Res.string.channel_air_util)
|
||||
.format(node.deviceMetrics.channelUtilization, node.deviceMetrics.airUtilTx)
|
||||
} else {
|
||||
buildList {
|
||||
val hopsString =
|
||||
"%s: %s"
|
||||
.format(
|
||||
stringResource(R.string.hops_away),
|
||||
stringResource(Res.string.hops_away),
|
||||
if (node.hopsAway == -1) {
|
||||
"?"
|
||||
} else {
|
||||
|
|
@ -98,11 +98,11 @@ fun SignalInfo(
|
|||
Icon(
|
||||
modifier = Modifier.size(20.dp),
|
||||
imageVector = quality.imageVector,
|
||||
contentDescription = stringResource(R.string.signal_quality),
|
||||
contentDescription = stringResource(Res.string.signal_quality),
|
||||
tint = quality.color.invoke(),
|
||||
)
|
||||
Text(
|
||||
text = "${stringResource(R.string.signal)} ${stringResource(quality.nameRes)}",
|
||||
text = "${stringResource(Res.string.signal)} ${stringResource(quality.nameRes)}",
|
||||
style = MaterialTheme.typography.labelSmall,
|
||||
color = contentColor,
|
||||
maxLines = 1,
|
||||
|
|
|
|||
|
|
@ -32,8 +32,8 @@ import androidx.compose.ui.res.stringResource
|
|||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.tooling.preview.PreviewLightDark
|
||||
import androidx.compose.ui.unit.dp
|
||||
import org.meshtastic.core.strings.R
|
||||
import org.meshtastic.core.ui.theme.AppTheme
|
||||
import org.meshtastic.core.strings.R as Res
|
||||
|
||||
@Composable
|
||||
fun SimpleAlertDialog(
|
||||
|
|
@ -51,7 +51,7 @@ fun SimpleAlertDialog(
|
|||
modifier = Modifier.padding(horizontal = 16.dp),
|
||||
colors = ButtonDefaults.textButtonColors(contentColor = MaterialTheme.colorScheme.onSurface),
|
||||
) {
|
||||
Text(text = dismissText ?: stringResource(R.string.cancel))
|
||||
Text(text = dismissText ?: stringResource(Res.string.cancel))
|
||||
}
|
||||
},
|
||||
confirmButton = {
|
||||
|
|
@ -61,7 +61,7 @@ fun SimpleAlertDialog(
|
|||
modifier = Modifier.padding(horizontal = 16.dp),
|
||||
colors = ButtonDefaults.textButtonColors(contentColor = MaterialTheme.colorScheme.onSurface),
|
||||
) {
|
||||
Text(text = confirmText ?: stringResource(R.string.okay))
|
||||
Text(text = confirmText ?: stringResource(Res.string.okay))
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
@ -101,5 +101,5 @@ fun SimpleAlertDialog(
|
|||
@PreviewLightDark
|
||||
@Composable
|
||||
private fun SimpleAlertDialogPreview() {
|
||||
AppTheme { SimpleAlertDialog(title = R.string.message, text = R.string.sample_message) }
|
||||
AppTheme { SimpleAlertDialog(title = Res.string.message, text = Res.string.sample_message) }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,12 +52,12 @@ import androidx.compose.ui.window.DialogProperties
|
|||
import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import org.meshtastic.core.model.Channel
|
||||
import org.meshtastic.core.strings.R
|
||||
import org.meshtastic.core.ui.component.ChannelSelection
|
||||
import org.meshtastic.proto.AppOnlyProtos.ChannelSet
|
||||
import org.meshtastic.proto.ConfigProtos.Config.LoRaConfig.ModemPreset
|
||||
import org.meshtastic.proto.channelSet
|
||||
import org.meshtastic.proto.copy
|
||||
import org.meshtastic.core.strings.R as Res
|
||||
|
||||
@Composable
|
||||
fun ScannedQrCodeDialog(
|
||||
|
|
@ -189,7 +189,7 @@ fun ScannedQrCodeDialog(
|
|||
) {
|
||||
item {
|
||||
Text(
|
||||
text = stringResource(R.string.new_channel_rcvd),
|
||||
text = stringResource(Res.string.new_channel_rcvd),
|
||||
modifier = Modifier.padding(20.dp),
|
||||
style = MaterialTheme.typography.titleLarge,
|
||||
)
|
||||
|
|
@ -239,7 +239,7 @@ fun ScannedQrCodeDialog(
|
|||
modifier = Modifier.height(48.dp).weight(1f),
|
||||
colors = if (!shouldReplace) selectedColors else unselectedColors,
|
||||
) {
|
||||
Text(text = stringResource(R.string.add))
|
||||
Text(text = stringResource(Res.string.add))
|
||||
}
|
||||
|
||||
OutlinedButton(
|
||||
|
|
@ -248,7 +248,7 @@ fun ScannedQrCodeDialog(
|
|||
enabled = incoming.hasLoraConfig(),
|
||||
colors = if (shouldReplace) selectedColors else unselectedColors,
|
||||
) {
|
||||
Text(text = stringResource(R.string.replace))
|
||||
Text(text = stringResource(Res.string.replace))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -261,7 +261,7 @@ fun ScannedQrCodeDialog(
|
|||
) {
|
||||
TextButton(onClick = { onDismiss() }) {
|
||||
Text(
|
||||
text = stringResource(R.string.cancel),
|
||||
text = stringResource(Res.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(R.string.accept),
|
||||
text = stringResource(Res.string.accept),
|
||||
color = MaterialTheme.colorScheme.onSurface,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
maxLines = 1,
|
||||
|
|
|
|||
|
|
@ -26,11 +26,11 @@ import androidx.compose.runtime.getValue
|
|||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import org.meshtastic.core.strings.R
|
||||
import org.meshtastic.core.ui.component.SimpleAlertDialog
|
||||
import org.meshtastic.core.ui.component.compareUsers
|
||||
import org.meshtastic.core.ui.component.userFieldsToString
|
||||
import org.meshtastic.proto.AdminProtos
|
||||
import org.meshtastic.core.strings.R as Res
|
||||
|
||||
/** A dialog for importing a shared contact that was scanned from a QR code. */
|
||||
@Composable
|
||||
|
|
@ -45,14 +45,14 @@ fun SharedContactDialog(
|
|||
val node = unfilteredNodes.find { it.num == nodeNum }
|
||||
|
||||
SimpleAlertDialog(
|
||||
title = R.string.import_shared_contact,
|
||||
title = Res.string.import_shared_contact,
|
||||
text = {
|
||||
Column {
|
||||
if (node != null) {
|
||||
Text(text = stringResource(R.string.import_known_shared_contact_text))
|
||||
Text(text = stringResource(Res.string.import_known_shared_contact_text))
|
||||
if (node.user.publicKey.size() > 0 && node.user.publicKey != sharedContact.user?.publicKey) {
|
||||
Text(
|
||||
text = stringResource(R.string.public_key_changed),
|
||||
text = stringResource(Res.string.public_key_changed),
|
||||
color = MaterialTheme.colorScheme.error,
|
||||
)
|
||||
}
|
||||
|
|
@ -63,9 +63,9 @@ fun SharedContactDialog(
|
|||
}
|
||||
}
|
||||
},
|
||||
dismissText = stringResource(R.string.cancel),
|
||||
dismissText = stringResource(Res.string.cancel),
|
||||
onDismiss = onDismiss,
|
||||
confirmText = stringResource(R.string.import_label),
|
||||
confirmText = stringResource(Res.string.import_label),
|
||||
onConfirm = {
|
||||
viewModel.addSharedContact(sharedContact)
|
||||
onDismiss()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue