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
|
|
@ -97,7 +97,6 @@ import org.meshtastic.core.model.util.mpsToKmph
|
|||
import org.meshtastic.core.model.util.mpsToMph
|
||||
import org.meshtastic.core.model.util.toString
|
||||
import org.meshtastic.core.proto.formatPositionTime
|
||||
import org.meshtastic.core.strings.R
|
||||
import org.meshtastic.core.ui.component.NodeChip
|
||||
import org.meshtastic.feature.map.component.ClusterItemsListDialog
|
||||
import org.meshtastic.feature.map.component.CustomMapLayersSheet
|
||||
|
|
@ -114,6 +113,7 @@ import org.meshtastic.proto.copy
|
|||
import org.meshtastic.proto.waypoint
|
||||
import timber.log.Timber
|
||||
import java.text.DateFormat
|
||||
import org.meshtastic.core.strings.R as Res
|
||||
|
||||
private const val MIN_TRACK_POINT_DISTANCE_METERS = 20f
|
||||
private const val DEG_D = 1e-7
|
||||
|
|
@ -381,7 +381,7 @@ fun MapView(
|
|||
} else {
|
||||
MarkerInfoWindowComposable(
|
||||
state = markerState,
|
||||
title = stringResource(R.string.position),
|
||||
title = stringResource(Res.string.position),
|
||||
snippet = formatAgo(position.time),
|
||||
zIndex = alpha,
|
||||
infoContent = {
|
||||
|
|
@ -394,7 +394,7 @@ fun MapView(
|
|||
) {
|
||||
Icon(
|
||||
imageVector = androidx.compose.material.icons.Icons.Default.TripOrigin,
|
||||
contentDescription = stringResource(R.string.track_point),
|
||||
contentDescription = stringResource(Res.string.track_point),
|
||||
tint = color,
|
||||
)
|
||||
}
|
||||
|
|
@ -639,25 +639,28 @@ private fun PositionInfoWindowContent(
|
|||
|
||||
Card {
|
||||
Column(modifier = Modifier.padding(8.dp)) {
|
||||
PositionRow(label = stringResource(R.string.latitude), value = "%.5f".format(position.latitudeI * DEG_D))
|
||||
|
||||
PositionRow(label = stringResource(R.string.longitude), value = "%.5f".format(position.longitudeI * DEG_D))
|
||||
|
||||
PositionRow(label = stringResource(R.string.sats), value = position.satsInView.toString())
|
||||
PositionRow(label = stringResource(Res.string.latitude), value = "%.5f".format(position.latitudeI * DEG_D))
|
||||
|
||||
PositionRow(
|
||||
label = stringResource(R.string.alt),
|
||||
label = stringResource(Res.string.longitude),
|
||||
value = "%.5f".format(position.longitudeI * DEG_D),
|
||||
)
|
||||
|
||||
PositionRow(label = stringResource(Res.string.sats), value = position.satsInView.toString())
|
||||
|
||||
PositionRow(
|
||||
label = stringResource(Res.string.alt),
|
||||
value = position.altitude.metersIn(displayUnits).toString(displayUnits),
|
||||
)
|
||||
|
||||
PositionRow(label = stringResource(R.string.speed), value = speedFromPosition(position, displayUnits))
|
||||
PositionRow(label = stringResource(Res.string.speed), value = speedFromPosition(position, displayUnits))
|
||||
|
||||
PositionRow(
|
||||
label = stringResource(R.string.heading),
|
||||
label = stringResource(Res.string.heading),
|
||||
value = "%.0f°".format(position.groundTrack * HEADING_DEG),
|
||||
)
|
||||
|
||||
PositionRow(label = stringResource(R.string.timestamp), value = position.formatPositionTime(dateFormat))
|
||||
PositionRow(label = stringResource(Res.string.timestamp), value = position.formatPositionTime(dateFormat))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,9 +31,9 @@ import androidx.compose.runtime.Composable
|
|||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import org.meshtastic.core.strings.R
|
||||
import org.meshtastic.core.ui.component.NodeChip
|
||||
import org.meshtastic.feature.map.model.NodeClusterItem
|
||||
import org.meshtastic.core.strings.R as Res
|
||||
|
||||
@Composable
|
||||
fun ClusterItemsListDialog(
|
||||
|
|
@ -43,7 +43,7 @@ fun ClusterItemsListDialog(
|
|||
) {
|
||||
AlertDialog(
|
||||
onDismissRequest = onDismiss,
|
||||
title = { Text(text = stringResource(R.string.nodes_at_this_location)) },
|
||||
title = { Text(text = stringResource(Res.string.nodes_at_this_location)) },
|
||||
text = {
|
||||
// Use a LazyColumn for potentially long lists of items
|
||||
LazyColumn(contentPadding = PaddingValues(vertical = 8.dp)) {
|
||||
|
|
@ -52,7 +52,7 @@ fun ClusterItemsListDialog(
|
|||
}
|
||||
}
|
||||
},
|
||||
confirmButton = { TextButton(onClick = onDismiss) { Text(stringResource(R.string.okay)) } },
|
||||
confirmButton = { TextButton(onClick = onDismiss) { Text(stringResource(Res.string.okay)) } },
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,8 +39,8 @@ import androidx.compose.runtime.Composable
|
|||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import org.meshtastic.core.strings.R
|
||||
import org.meshtastic.feature.map.MapLayerItem
|
||||
import org.meshtastic.core.strings.R as Res
|
||||
|
||||
@Suppress("LongMethod")
|
||||
@Composable
|
||||
|
|
@ -55,7 +55,7 @@ fun CustomMapLayersSheet(
|
|||
item {
|
||||
Text(
|
||||
modifier = Modifier.padding(16.dp),
|
||||
text = stringResource(R.string.manage_map_layers),
|
||||
text = stringResource(Res.string.manage_map_layers),
|
||||
style = MaterialTheme.typography.headlineSmall,
|
||||
)
|
||||
HorizontalDivider()
|
||||
|
|
@ -63,7 +63,7 @@ fun CustomMapLayersSheet(
|
|||
item {
|
||||
Text(
|
||||
modifier = Modifier.padding(start = 16.dp, end = 16.dp, top = 8.dp, bottom = 0.dp),
|
||||
text = stringResource(R.string.map_layer_formats),
|
||||
text = stringResource(Res.string.map_layer_formats),
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
)
|
||||
}
|
||||
|
|
@ -72,7 +72,7 @@ fun CustomMapLayersSheet(
|
|||
item {
|
||||
Text(
|
||||
modifier = Modifier.padding(16.dp),
|
||||
text = stringResource(R.string.no_map_layers_loaded),
|
||||
text = stringResource(Res.string.no_map_layers_loaded),
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
)
|
||||
}
|
||||
|
|
@ -93,9 +93,9 @@ fun CustomMapLayersSheet(
|
|||
contentDescription =
|
||||
stringResource(
|
||||
if (layer.isVisible) {
|
||||
R.string.hide_layer
|
||||
Res.string.hide_layer
|
||||
} else {
|
||||
R.string.show_layer
|
||||
Res.string.show_layer
|
||||
},
|
||||
),
|
||||
)
|
||||
|
|
@ -103,7 +103,7 @@ fun CustomMapLayersSheet(
|
|||
IconButton(onClick = { onRemoveLayer(layer.id) }) {
|
||||
Icon(
|
||||
imageVector = Icons.Filled.Delete,
|
||||
contentDescription = stringResource(R.string.remove_layer),
|
||||
contentDescription = stringResource(Res.string.remove_layer),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -114,7 +114,7 @@ fun CustomMapLayersSheet(
|
|||
}
|
||||
item {
|
||||
Button(modifier = Modifier.fillMaxWidth().padding(16.dp), onClick = onAddLayerClicked) {
|
||||
Text(stringResource(R.string.add_layer))
|
||||
Text(stringResource(Res.string.add_layer))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,8 +53,8 @@ import androidx.compose.ui.unit.dp
|
|||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import kotlinx.coroutines.flow.collectLatest
|
||||
import org.meshtastic.core.data.model.CustomTileProviderConfig
|
||||
import org.meshtastic.core.strings.R
|
||||
import org.meshtastic.feature.map.MapViewModel
|
||||
import org.meshtastic.core.strings.R as Res
|
||||
|
||||
@Suppress("LongMethod")
|
||||
@Composable
|
||||
|
|
@ -89,7 +89,7 @@ fun CustomTileProviderManagerSheet(mapViewModel: MapViewModel) {
|
|||
LazyColumn(contentPadding = PaddingValues(bottom = 16.dp)) {
|
||||
item {
|
||||
Text(
|
||||
text = stringResource(R.string.manage_custom_tile_sources),
|
||||
text = stringResource(Res.string.manage_custom_tile_sources),
|
||||
style = MaterialTheme.typography.headlineSmall,
|
||||
modifier = Modifier.padding(16.dp),
|
||||
)
|
||||
|
|
@ -99,7 +99,7 @@ fun CustomTileProviderManagerSheet(mapViewModel: MapViewModel) {
|
|||
if (customTileProviders.isEmpty()) {
|
||||
item {
|
||||
Text(
|
||||
text = stringResource(R.string.no_custom_tile_sources_found),
|
||||
text = stringResource(Res.string.no_custom_tile_sources_found),
|
||||
modifier = Modifier.padding(16.dp),
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
)
|
||||
|
|
@ -119,13 +119,13 @@ fun CustomTileProviderManagerSheet(mapViewModel: MapViewModel) {
|
|||
) {
|
||||
Icon(
|
||||
Icons.Filled.Edit,
|
||||
contentDescription = stringResource(R.string.edit_custom_tile_source),
|
||||
contentDescription = stringResource(Res.string.edit_custom_tile_source),
|
||||
)
|
||||
}
|
||||
IconButton(onClick = { mapViewModel.removeCustomTileProvider(config.id) }) {
|
||||
Icon(
|
||||
Icons.Filled.Delete,
|
||||
contentDescription = stringResource(R.string.delete_custom_tile_source),
|
||||
contentDescription = stringResource(Res.string.delete_custom_tile_source),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -143,7 +143,7 @@ fun CustomTileProviderManagerSheet(mapViewModel: MapViewModel) {
|
|||
},
|
||||
modifier = Modifier.fillMaxWidth().padding(16.dp),
|
||||
) {
|
||||
Text(stringResource(R.string.add_custom_tile_source))
|
||||
Text(stringResource(Res.string.add_custom_tile_source))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -163,10 +163,10 @@ private fun AddEditCustomTileProviderDialog(
|
|||
var urlError by remember { mutableStateOf<String?>(null) }
|
||||
val customTileProviders by mapViewModel.customTileProviderConfigs.collectAsStateWithLifecycle()
|
||||
|
||||
val emptyNameError = stringResource(R.string.name_cannot_be_empty)
|
||||
val providerNameExistsError = stringResource(R.string.provider_name_exists)
|
||||
val urlCannotBeEmptyError = stringResource(R.string.url_cannot_be_empty)
|
||||
val urlMustContainPlaceholdersError = stringResource(R.string.url_must_contain_placeholders)
|
||||
val emptyNameError = stringResource(Res.string.name_cannot_be_empty)
|
||||
val providerNameExistsError = stringResource(Res.string.provider_name_exists)
|
||||
val urlCannotBeEmptyError = stringResource(Res.string.url_cannot_be_empty)
|
||||
val urlMustContainPlaceholdersError = stringResource(Res.string.url_must_contain_placeholders)
|
||||
|
||||
fun validateAndSave() {
|
||||
val currentNameError =
|
||||
|
|
@ -186,9 +186,9 @@ private fun AddEditCustomTileProviderDialog(
|
|||
title = {
|
||||
Text(
|
||||
if (config == null) {
|
||||
stringResource(R.string.add_custom_tile_source)
|
||||
stringResource(Res.string.add_custom_tile_source)
|
||||
} else {
|
||||
stringResource(R.string.edit_custom_tile_source)
|
||||
stringResource(Res.string.edit_custom_tile_source)
|
||||
},
|
||||
)
|
||||
},
|
||||
|
|
@ -200,7 +200,7 @@ private fun AddEditCustomTileProviderDialog(
|
|||
name = it
|
||||
nameError = null
|
||||
},
|
||||
label = { Text(stringResource(R.string.name)) },
|
||||
label = { Text(stringResource(Res.string.name)) },
|
||||
isError = nameError != null,
|
||||
supportingText = { nameError?.let { Text(it) } },
|
||||
singleLine = true,
|
||||
|
|
@ -211,13 +211,13 @@ private fun AddEditCustomTileProviderDialog(
|
|||
url = it
|
||||
urlError = null
|
||||
},
|
||||
label = { Text(stringResource(R.string.url_template)) },
|
||||
label = { Text(stringResource(Res.string.url_template)) },
|
||||
isError = urlError != null,
|
||||
supportingText = {
|
||||
if (urlError != null) {
|
||||
Text(urlError!!)
|
||||
} else {
|
||||
Text(stringResource(R.string.url_template_hint))
|
||||
Text(stringResource(Res.string.url_template_hint))
|
||||
}
|
||||
},
|
||||
singleLine = false,
|
||||
|
|
@ -225,8 +225,8 @@ private fun AddEditCustomTileProviderDialog(
|
|||
)
|
||||
}
|
||||
},
|
||||
confirmButton = { Button(onClick = { validateAndSave() }) { Text(stringResource(R.string.save)) } },
|
||||
dismissButton = { TextButton(onClick = onDismiss) { Text(stringResource(R.string.cancel)) } },
|
||||
confirmButton = { Button(onClick = { validateAndSave() }) { Text(stringResource(Res.string.save)) } },
|
||||
dismissButton = { TextButton(onClick = onDismiss) { Text(stringResource(Res.string.cancel)) } },
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -62,7 +62,6 @@ import androidx.compose.ui.text.input.KeyboardType
|
|||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import org.meshtastic.core.strings.R
|
||||
import org.meshtastic.core.ui.emoji.EmojiPickerDialog
|
||||
import org.meshtastic.proto.MeshProtos.Waypoint
|
||||
import org.meshtastic.proto.copy
|
||||
|
|
@ -70,6 +69,7 @@ import java.text.SimpleDateFormat
|
|||
import java.util.Calendar
|
||||
import java.util.Locale
|
||||
import java.util.TimeZone
|
||||
import org.meshtastic.core.strings.R as Res
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Suppress("LongMethod", "CyclomaticComplexMethod", "MagicNumber")
|
||||
|
|
@ -82,7 +82,7 @@ fun EditWaypointDialog(
|
|||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
var waypointInput by remember { mutableStateOf(waypoint) }
|
||||
val title = if (waypoint.id == 0) R.string.waypoint_new else R.string.waypoint_edit
|
||||
val title = if (waypoint.id == 0) Res.string.waypoint_new else Res.string.waypoint_edit
|
||||
val defaultEmoji = 0x1F4CD // 📍 Round Pushpin
|
||||
val currentEmojiCodepoint = if (waypointInput.icon == 0) defaultEmoji else waypointInput.icon
|
||||
var showEmojiPickerView by remember { mutableStateOf(false) }
|
||||
|
|
@ -149,7 +149,7 @@ fun EditWaypointDialog(
|
|||
OutlinedTextField(
|
||||
value = waypointInput.name,
|
||||
onValueChange = { waypointInput = waypointInput.copy { name = it.take(29) } },
|
||||
label = { Text(stringResource(R.string.name)) },
|
||||
label = { Text(stringResource(Res.string.name)) },
|
||||
singleLine = true,
|
||||
keyboardOptions =
|
||||
KeyboardOptions.Default.copy(keyboardType = KeyboardType.Text, imeAction = ImeAction.Next),
|
||||
|
|
@ -170,7 +170,7 @@ fun EditWaypointDialog(
|
|||
OutlinedTextField(
|
||||
value = waypointInput.description,
|
||||
onValueChange = { waypointInput = waypointInput.copy { description = it.take(99) } },
|
||||
label = { Text(stringResource(R.string.description)) },
|
||||
label = { Text(stringResource(Res.string.description)) },
|
||||
keyboardOptions =
|
||||
KeyboardOptions.Default.copy(keyboardType = KeyboardType.Text, imeAction = ImeAction.Done),
|
||||
keyboardActions = KeyboardActions(onDone = { /* Handle next/done focus */ }),
|
||||
|
|
@ -187,10 +187,10 @@ fun EditWaypointDialog(
|
|||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
Image(
|
||||
imageVector = Icons.Default.Lock,
|
||||
contentDescription = stringResource(R.string.locked),
|
||||
contentDescription = stringResource(Res.string.locked),
|
||||
)
|
||||
Spacer(modifier = Modifier.width(8.dp))
|
||||
Text(stringResource(R.string.locked))
|
||||
Text(stringResource(Res.string.locked))
|
||||
}
|
||||
Switch(
|
||||
checked = waypointInput.lockedTo != 0,
|
||||
|
|
@ -206,10 +206,10 @@ fun EditWaypointDialog(
|
|||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
Image(
|
||||
imageVector = Icons.Default.CalendarMonth,
|
||||
contentDescription = stringResource(R.string.expires),
|
||||
contentDescription = stringResource(Res.string.expires),
|
||||
)
|
||||
Spacer(modifier = Modifier.width(8.dp))
|
||||
Text(stringResource(R.string.expires))
|
||||
Text(stringResource(Res.string.expires))
|
||||
}
|
||||
Switch(
|
||||
checked = isExpiryEnabled,
|
||||
|
|
@ -285,7 +285,7 @@ fun EditWaypointDialog(
|
|||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
Column(horizontalAlignment = Alignment.CenterHorizontally) {
|
||||
Button(onClick = { datePickerDialog.show() }) { Text(stringResource(R.string.date)) }
|
||||
Button(onClick = { datePickerDialog.show() }) { Text(stringResource(Res.string.date)) }
|
||||
Text(
|
||||
modifier = Modifier.padding(top = 4.dp),
|
||||
text = selectedDateString,
|
||||
|
|
@ -293,7 +293,7 @@ fun EditWaypointDialog(
|
|||
)
|
||||
}
|
||||
Column(horizontalAlignment = Alignment.CenterHorizontally) {
|
||||
Button(onClick = { timePickerDialog.show() }) { Text(stringResource(R.string.time)) }
|
||||
Button(onClick = { timePickerDialog.show() }) { Text(stringResource(Res.string.time)) }
|
||||
Text(
|
||||
modifier = Modifier.padding(top = 4.dp),
|
||||
text = selectedTimeString,
|
||||
|
|
@ -314,15 +314,15 @@ fun EditWaypointDialog(
|
|||
onClick = { onDeleteClicked(waypointInput) },
|
||||
modifier = Modifier.padding(end = 8.dp),
|
||||
) {
|
||||
Text(stringResource(R.string.delete), color = MaterialTheme.colorScheme.error)
|
||||
Text(stringResource(Res.string.delete), color = MaterialTheme.colorScheme.error)
|
||||
}
|
||||
}
|
||||
Spacer(modifier = Modifier.weight(1f)) // Pushes delete to left and cancel/send to right
|
||||
TextButton(onClick = onDismissRequest, modifier = Modifier.padding(end = 8.dp)) {
|
||||
Text(stringResource(R.string.cancel))
|
||||
Text(stringResource(Res.string.cancel))
|
||||
}
|
||||
Button(onClick = { onSendClicked(waypointInput) }, enabled = waypointInput.name.isNotBlank()) {
|
||||
Text(stringResource(R.string.send))
|
||||
Text(stringResource(Res.string.send))
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -33,9 +33,9 @@ import androidx.compose.runtime.Composable
|
|||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.rotate
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import org.meshtastic.core.strings.R
|
||||
import org.meshtastic.core.ui.theme.StatusColors.StatusRed
|
||||
import org.meshtastic.feature.map.MapViewModel
|
||||
import org.meshtastic.core.strings.R as Res
|
||||
|
||||
@OptIn(ExperimentalMaterial3ExpressiveApi::class)
|
||||
@Composable
|
||||
|
|
@ -69,7 +69,7 @@ fun MapControlsOverlay(
|
|||
if (isNodeMap) {
|
||||
MapButton(
|
||||
icon = Icons.Outlined.Tune,
|
||||
contentDescription = stringResource(R.string.map_filter),
|
||||
contentDescription = stringResource(Res.string.map_filter),
|
||||
onClick = onToggleMapFilterMenu,
|
||||
)
|
||||
NodeMapFilterDropdown(
|
||||
|
|
@ -81,7 +81,7 @@ fun MapControlsOverlay(
|
|||
Box {
|
||||
MapButton(
|
||||
icon = Icons.Outlined.Tune,
|
||||
contentDescription = stringResource(R.string.map_filter),
|
||||
contentDescription = stringResource(Res.string.map_filter),
|
||||
onClick = onToggleMapFilterMenu,
|
||||
)
|
||||
MapFilterDropdown(
|
||||
|
|
@ -95,7 +95,7 @@ fun MapControlsOverlay(
|
|||
Box {
|
||||
MapButton(
|
||||
icon = Icons.Outlined.Map,
|
||||
contentDescription = stringResource(R.string.map_tile_source),
|
||||
contentDescription = stringResource(Res.string.map_tile_source),
|
||||
onClick = onToggleMapTypeMenu,
|
||||
)
|
||||
MapTypeDropdown(
|
||||
|
|
@ -108,7 +108,7 @@ fun MapControlsOverlay(
|
|||
|
||||
MapButton(
|
||||
icon = Icons.Outlined.Layers,
|
||||
contentDescription = stringResource(R.string.manage_map_layers),
|
||||
contentDescription = stringResource(Res.string.manage_map_layers),
|
||||
onClick = onManageLayersClicked,
|
||||
)
|
||||
|
||||
|
|
@ -121,7 +121,7 @@ fun MapControlsOverlay(
|
|||
} else {
|
||||
Icons.Outlined.MyLocation
|
||||
},
|
||||
contentDescription = stringResource(R.string.toggle_my_position),
|
||||
contentDescription = stringResource(Res.string.toggle_my_position),
|
||||
onClick = onToggleLocationTracking,
|
||||
)
|
||||
}
|
||||
|
|
@ -137,7 +137,7 @@ private fun CompassButton(onClick: () -> Unit, bearing: Float, isFollowing: Bool
|
|||
modifier = Modifier.rotate(-bearing),
|
||||
icon = icon,
|
||||
iconTint = MaterialTheme.colorScheme.StatusRed.takeIf { bearing == 0f },
|
||||
contentDescription = stringResource(R.string.orient_north),
|
||||
contentDescription = stringResource(Res.string.orient_north),
|
||||
onClick = onClick,
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,20 +40,20 @@ import androidx.compose.ui.Modifier
|
|||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import org.meshtastic.core.strings.R
|
||||
import org.meshtastic.feature.map.LastHeardFilter
|
||||
import org.meshtastic.feature.map.MapViewModel
|
||||
import kotlin.math.roundToInt
|
||||
import org.meshtastic.core.strings.R as Res
|
||||
|
||||
@Composable
|
||||
internal fun MapFilterDropdown(expanded: Boolean, onDismissRequest: () -> Unit, mapViewModel: MapViewModel) {
|
||||
val mapFilterState by mapViewModel.mapFilterStateFlow.collectAsStateWithLifecycle()
|
||||
DropdownMenu(expanded = expanded, onDismissRequest = onDismissRequest) {
|
||||
DropdownMenuItem(
|
||||
text = { Text(stringResource(R.string.only_favorites)) },
|
||||
text = { Text(stringResource(Res.string.only_favorites)) },
|
||||
onClick = { mapViewModel.toggleOnlyFavorites() },
|
||||
leadingIcon = {
|
||||
Icon(imageVector = Icons.Filled.Star, contentDescription = stringResource(R.string.only_favorites))
|
||||
Icon(imageVector = Icons.Filled.Star, contentDescription = stringResource(Res.string.only_favorites))
|
||||
},
|
||||
trailingIcon = {
|
||||
Checkbox(
|
||||
|
|
@ -63,10 +63,10 @@ internal fun MapFilterDropdown(expanded: Boolean, onDismissRequest: () -> Unit,
|
|||
},
|
||||
)
|
||||
DropdownMenuItem(
|
||||
text = { Text(stringResource(R.string.show_waypoints)) },
|
||||
text = { Text(stringResource(Res.string.show_waypoints)) },
|
||||
onClick = { mapViewModel.toggleShowWaypointsOnMap() },
|
||||
leadingIcon = {
|
||||
Icon(imageVector = Icons.Filled.Place, contentDescription = stringResource(R.string.show_waypoints))
|
||||
Icon(imageVector = Icons.Filled.Place, contentDescription = stringResource(Res.string.show_waypoints))
|
||||
},
|
||||
trailingIcon = {
|
||||
Checkbox(
|
||||
|
|
@ -76,12 +76,12 @@ internal fun MapFilterDropdown(expanded: Boolean, onDismissRequest: () -> Unit,
|
|||
},
|
||||
)
|
||||
DropdownMenuItem(
|
||||
text = { Text(stringResource(R.string.show_precision_circle)) },
|
||||
text = { Text(stringResource(Res.string.show_precision_circle)) },
|
||||
onClick = { mapViewModel.toggleShowPrecisionCircleOnMap() },
|
||||
leadingIcon = {
|
||||
Icon(
|
||||
imageVector = Icons.Outlined.RadioButtonUnchecked, // Placeholder icon
|
||||
contentDescription = stringResource(R.string.show_precision_circle),
|
||||
contentDescription = stringResource(Res.string.show_precision_circle),
|
||||
)
|
||||
},
|
||||
trailingIcon = {
|
||||
|
|
@ -100,7 +100,7 @@ internal fun MapFilterDropdown(expanded: Boolean, onDismissRequest: () -> Unit,
|
|||
Text(
|
||||
text =
|
||||
stringResource(
|
||||
R.string.last_heard_filter_label,
|
||||
Res.string.last_heard_filter_label,
|
||||
stringResource(mapFilterState.lastHeardFilter.label),
|
||||
),
|
||||
style = MaterialTheme.typography.labelLarge,
|
||||
|
|
@ -131,7 +131,7 @@ internal fun NodeMapFilterDropdown(expanded: Boolean, onDismissRequest: () -> Un
|
|||
Text(
|
||||
text =
|
||||
stringResource(
|
||||
R.string.last_heard_filter_label,
|
||||
Res.string.last_heard_filter_label,
|
||||
stringResource(mapFilterState.lastHeardTrackFilter.label),
|
||||
),
|
||||
style = MaterialTheme.typography.labelLarge,
|
||||
|
|
|
|||
|
|
@ -29,8 +29,8 @@ import androidx.compose.runtime.getValue
|
|||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import com.google.maps.android.compose.MapType
|
||||
import org.meshtastic.core.strings.R
|
||||
import org.meshtastic.feature.map.MapViewModel
|
||||
import org.meshtastic.core.strings.R as Res
|
||||
|
||||
@Suppress("LongMethod")
|
||||
@Composable
|
||||
|
|
@ -46,10 +46,10 @@ internal fun MapTypeDropdown(
|
|||
|
||||
val googleMapTypes =
|
||||
listOf(
|
||||
stringResource(R.string.map_type_normal) to MapType.NORMAL,
|
||||
stringResource(R.string.map_type_satellite) to MapType.SATELLITE,
|
||||
stringResource(R.string.map_type_terrain) to MapType.TERRAIN,
|
||||
stringResource(R.string.map_type_hybrid) to MapType.HYBRID,
|
||||
stringResource(Res.string.map_type_normal) to MapType.NORMAL,
|
||||
stringResource(Res.string.map_type_satellite) to MapType.SATELLITE,
|
||||
stringResource(Res.string.map_type_terrain) to MapType.TERRAIN,
|
||||
stringResource(Res.string.map_type_hybrid) to MapType.HYBRID,
|
||||
)
|
||||
|
||||
DropdownMenu(expanded = expanded, onDismissRequest = onDismissRequest) {
|
||||
|
|
@ -62,7 +62,7 @@ internal fun MapTypeDropdown(
|
|||
},
|
||||
trailingIcon =
|
||||
if (selectedCustomUrl == null && selectedGoogleMapType == type) {
|
||||
{ Icon(Icons.Filled.Check, contentDescription = stringResource(R.string.selected_map_type)) }
|
||||
{ Icon(Icons.Filled.Check, contentDescription = stringResource(Res.string.selected_map_type)) }
|
||||
} else {
|
||||
null
|
||||
},
|
||||
|
|
@ -83,7 +83,7 @@ internal fun MapTypeDropdown(
|
|||
{
|
||||
Icon(
|
||||
Icons.Filled.Check,
|
||||
contentDescription = stringResource(R.string.selected_map_type),
|
||||
contentDescription = stringResource(Res.string.selected_map_type),
|
||||
)
|
||||
}
|
||||
} else {
|
||||
|
|
@ -94,7 +94,7 @@ internal fun MapTypeDropdown(
|
|||
}
|
||||
HorizontalDivider()
|
||||
DropdownMenuItem(
|
||||
text = { Text(stringResource(R.string.manage_custom_tile_sources)) },
|
||||
text = { Text(stringResource(Res.string.manage_custom_tile_sources)) },
|
||||
onClick = {
|
||||
onManageCustomTileProvidersClicked()
|
||||
onDismissRequest()
|
||||
|
|
|
|||
|
|
@ -24,9 +24,9 @@ import com.google.android.gms.maps.model.BitmapDescriptor
|
|||
import com.google.android.gms.maps.model.LatLng
|
||||
import com.google.maps.android.compose.Marker
|
||||
import com.google.maps.android.compose.rememberUpdatedMarkerState
|
||||
import org.meshtastic.core.strings.R
|
||||
import org.meshtastic.feature.map.BaseMapViewModel
|
||||
import org.meshtastic.proto.MeshProtos
|
||||
import org.meshtastic.core.strings.R as Res
|
||||
|
||||
private const val DEG_D = 1e-7
|
||||
|
||||
|
|
@ -60,7 +60,7 @@ fun WaypointMarkers(
|
|||
if (waypoint.lockedTo == 0 || waypoint.lockedTo == myNodeNum || !isConnected) {
|
||||
onEditWaypointRequest(waypoint)
|
||||
} else {
|
||||
Toast.makeText(context, context.getString(R.string.locked), Toast.LENGTH_SHORT).show()
|
||||
Toast.makeText(context, context.getString(Res.string.locked), Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
},
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue