mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
refactor (i18n): extract string resources from config for translation (#1794)
This commit is contained in:
parent
2a710ba85f
commit
9c51245003
31 changed files with 1042 additions and 417 deletions
|
|
@ -148,20 +148,20 @@ private fun NodeDetailList(
|
|||
) {
|
||||
if (metricsState.deviceHardware != null) {
|
||||
item {
|
||||
PreferenceCategory("Device") {
|
||||
PreferenceCategory(stringResource(R.string.device)) {
|
||||
DeviceDetailsContent(metricsState)
|
||||
}
|
||||
}
|
||||
}
|
||||
item {
|
||||
PreferenceCategory("Details") {
|
||||
PreferenceCategory(stringResource(R.string.details)) {
|
||||
NodeDetailsContent(node)
|
||||
}
|
||||
}
|
||||
|
||||
if (node.hasEnvironmentMetrics) {
|
||||
item {
|
||||
PreferenceCategory("Environment")
|
||||
PreferenceCategory(stringResource(R.string.environment))
|
||||
EnvironmentMetrics(node, metricsState.isFahrenheit)
|
||||
Spacer(modifier = Modifier.height(8.dp))
|
||||
}
|
||||
|
|
@ -169,7 +169,7 @@ private fun NodeDetailList(
|
|||
|
||||
if (node.hasPowerMetrics) {
|
||||
item {
|
||||
PreferenceCategory("Power")
|
||||
PreferenceCategory(stringResource(R.string.power))
|
||||
PowerMetrics(node)
|
||||
Spacer(modifier = Modifier.height(8.dp))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ inline fun <reified T> EditListPreference(
|
|||
// handle remoteHardware.availablePins: List<RemoteHardwarePin>
|
||||
if (value is RemoteHardwarePin) {
|
||||
EditTextPreference(
|
||||
title = "GPIO pin",
|
||||
title = stringResource(R.string.gpio_pin),
|
||||
value = value.gpioPin,
|
||||
enabled = enabled,
|
||||
keyboardActions = keyboardActions,
|
||||
|
|
@ -134,7 +134,7 @@ inline fun <reified T> EditListPreference(
|
|||
},
|
||||
)
|
||||
EditTextPreference(
|
||||
title = "Name",
|
||||
title = stringResource(R.string.name),
|
||||
value = value.name,
|
||||
maxSize = 14, // name max_size:15
|
||||
enabled = enabled,
|
||||
|
|
@ -150,7 +150,7 @@ inline fun <reified T> EditListPreference(
|
|||
trailingIcon = trailingIcon,
|
||||
)
|
||||
DropDownPreference(
|
||||
title = "Type",
|
||||
title = stringResource(R.string.type),
|
||||
enabled = enabled,
|
||||
items = RemoteHardwarePinType.entries
|
||||
.filter { it != RemoteHardwarePinType.UNRECOGNIZED }
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ import androidx.compose.runtime.remember
|
|||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.input.ImeAction
|
||||
import androidx.compose.ui.text.input.KeyboardType
|
||||
import androidx.compose.ui.text.input.PasswordVisualTransformation
|
||||
|
|
@ -67,7 +68,11 @@ fun EditPasswordPreference(
|
|||
Icon(
|
||||
painter = if (isPasswordVisible) painterResource(R.drawable.ic_twotone_visibility_off_24)
|
||||
else painterResource(R.drawable.ic_twotone_visibility_24),
|
||||
contentDescription = if (isPasswordVisible) "Hide password" else "Show password",
|
||||
contentDescription = if (isPasswordVisible) {
|
||||
stringResource(R.string.hide_password)
|
||||
} else {
|
||||
stringResource(R.string.show_password)
|
||||
},
|
||||
)
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
package com.geeksville.mesh.ui.radioconfig
|
||||
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.automirrored.filled.List
|
||||
import androidx.compose.material.icons.filled.Bluetooth
|
||||
|
|
@ -30,21 +31,22 @@ import androidx.compose.material.icons.filled.Security
|
|||
import androidx.compose.material.icons.filled.Wifi
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import com.geeksville.mesh.MeshProtos.DeviceMetadata
|
||||
import com.geeksville.mesh.R
|
||||
import com.geeksville.mesh.navigation.Route
|
||||
|
||||
@Suppress("MagicNumber")
|
||||
// Config (type = AdminProtos.AdminMessage.ConfigType)
|
||||
enum class ConfigRoute(val title: String, val route: Route, val icon: ImageVector?, val type: Int = 0) {
|
||||
USER("User", Route.User, Icons.Default.Person, 0),
|
||||
CHANNELS("Channels", Route.ChannelConfig, Icons.AutoMirrored.Default.List, 0),
|
||||
DEVICE("Device", Route.Device, Icons.Default.Router, 0),
|
||||
POSITION("Position", Route.Position, Icons.Default.LocationOn, 1),
|
||||
POWER("Power", Route.Power, Icons.Default.Power, 2),
|
||||
NETWORK("Network", Route.Network, Icons.Default.Wifi, 3),
|
||||
DISPLAY("Display", Route.Display, Icons.Default.DisplaySettings, 4),
|
||||
LORA("LoRa", Route.LoRa, Icons.Default.CellTower, 5),
|
||||
BLUETOOTH("Bluetooth", Route.Bluetooth, Icons.Default.Bluetooth, 6),
|
||||
SECURITY("Security", Route.Security, Icons.Default.Security, 7),
|
||||
enum class ConfigRoute(@StringRes val title: Int, val route: Route, val icon: ImageVector?, val type: Int = 0) {
|
||||
USER(R.string.user, Route.User, Icons.Default.Person, 0),
|
||||
CHANNELS(R.string.channels, Route.ChannelConfig, Icons.AutoMirrored.Default.List, 0),
|
||||
DEVICE(R.string.device, Route.Device, Icons.Default.Router, 0),
|
||||
POSITION(R.string.position, Route.Position, Icons.Default.LocationOn, 1),
|
||||
POWER(R.string.power, Route.Power, Icons.Default.Power, 2),
|
||||
NETWORK(R.string.network, Route.Network, Icons.Default.Wifi, 3),
|
||||
DISPLAY(R.string.display, Route.Display, Icons.Default.DisplaySettings, 4),
|
||||
LORA(R.string.lora, Route.LoRa, Icons.Default.CellTower, 5),
|
||||
BLUETOOTH(R.string.bluetooth, Route.Bluetooth, Icons.Default.Bluetooth, 6),
|
||||
SECURITY(R.string.security, Route.Security, Icons.Default.Security, 7),
|
||||
;
|
||||
|
||||
companion object {
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
package com.geeksville.mesh.ui.radioconfig
|
||||
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.automirrored.filled.Forward
|
||||
import androidx.compose.material.icons.automirrored.filled.Message
|
||||
|
|
@ -33,24 +34,25 @@ import androidx.compose.material.icons.filled.Speed
|
|||
import androidx.compose.material.icons.filled.Usb
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import com.geeksville.mesh.MeshProtos.DeviceMetadata
|
||||
import com.geeksville.mesh.R
|
||||
import com.geeksville.mesh.navigation.Route
|
||||
|
||||
@Suppress("MagicNumber")
|
||||
// ModuleConfig (type = AdminProtos.AdminMessage.ModuleConfigType)
|
||||
enum class ModuleRoute(val title: String, val route: Route, val icon: ImageVector?, val type: Int = 0) {
|
||||
MQTT("MQTT", Route.MQTT, Icons.Default.Cloud, 0),
|
||||
SERIAL("Serial", Route.Serial, Icons.Default.Usb, 1),
|
||||
EXT_NOTIFICATION("External Notification", Route.ExtNotification, Icons.Default.Notifications, 2),
|
||||
STORE_FORWARD("Store & Forward", Route.StoreForward, Icons.AutoMirrored.Default.Forward, 3),
|
||||
RANGE_TEST("Range Test", Route.RangeTest, Icons.Default.Speed, 4),
|
||||
TELEMETRY("Telemetry", Route.Telemetry, Icons.Default.DataUsage, 5),
|
||||
CANNED_MESSAGE("Canned Message", Route.CannedMessage, Icons.AutoMirrored.Default.Message, 6),
|
||||
AUDIO("Audio", Route.Audio, Icons.AutoMirrored.Default.VolumeUp, 7),
|
||||
REMOTE_HARDWARE("Remote Hardware", Route.RemoteHardware, Icons.Default.SettingsRemote, 8),
|
||||
NEIGHBOR_INFO("Neighbor Info", Route.NeighborInfo, Icons.Default.People, 9),
|
||||
AMBIENT_LIGHTING("Ambient Lighting", Route.AmbientLighting, Icons.Default.LightMode, 10),
|
||||
DETECTION_SENSOR("Detection Sensor", Route.DetectionSensor, Icons.Default.Sensors, 11),
|
||||
PAXCOUNTER("Paxcounter", Route.Paxcounter, Icons.Default.PermScanWifi, 12),
|
||||
enum class ModuleRoute(@StringRes val title: Int, val route: Route, val icon: ImageVector?, val type: Int = 0) {
|
||||
MQTT(R.string.mqtt, Route.MQTT, Icons.Default.Cloud, 0),
|
||||
SERIAL(R.string.serial, Route.Serial, Icons.Default.Usb, 1),
|
||||
EXT_NOTIFICATION(R.string.external_notification, Route.ExtNotification, Icons.Default.Notifications, 2),
|
||||
STORE_FORWARD(R.string.store_forward, Route.StoreForward, Icons.AutoMirrored.Default.Forward, 3),
|
||||
RANGE_TEST(R.string.range_test, Route.RangeTest, Icons.Default.Speed, 4),
|
||||
TELEMETRY(R.string.telemetry, Route.Telemetry, Icons.Default.DataUsage, 5),
|
||||
CANNED_MESSAGE(R.string.canned_message, Route.CannedMessage, Icons.AutoMirrored.Default.Message, 6),
|
||||
AUDIO(R.string.audio, Route.Audio, Icons.AutoMirrored.Default.VolumeUp, 7),
|
||||
REMOTE_HARDWARE(R.string.remote_hardware, Route.RemoteHardware, Icons.Default.SettingsRemote, 8),
|
||||
NEIGHBOR_INFO(R.string.neighbor_info, Route.NeighborInfo, Icons.Default.People, 9),
|
||||
AMBIENT_LIGHTING(R.string.ambient_lighting, Route.AmbientLighting, Icons.Default.LightMode, 10),
|
||||
DETECTION_SENSOR(R.string.detection_sensor, Route.DetectionSensor, Icons.Default.Sensors, 11),
|
||||
PAXCOUNTER(R.string.paxcounter, Route.Paxcounter, Icons.Default.PermScanWifi, 12),
|
||||
;
|
||||
|
||||
val bitfield: Int get() = 1 shl ordinal
|
||||
|
|
|
|||
|
|
@ -301,12 +301,12 @@ private fun RadioConfigItemList(
|
|||
) {
|
||||
item { PreferenceCategory(stringResource(R.string.device_settings)) }
|
||||
items(ConfigRoute.filterExcludedFrom(state.metadata)) {
|
||||
NavCard(title = it.title, icon = it.icon, enabled = enabled) { onRouteClick(it) }
|
||||
NavCard(title = stringResource(it.title), icon = it.icon, enabled = enabled) { onRouteClick(it) }
|
||||
}
|
||||
|
||||
item { PreferenceCategory(stringResource(R.string.module_settings)) }
|
||||
items(ModuleRoute.filterExcludedFrom(state.metadata)) {
|
||||
NavCard(title = it.title, icon = it.icon, enabled = enabled) { onRouteClick(it) }
|
||||
NavCard(title = stringResource(it.title), icon = it.icon, enabled = enabled) { onRouteClick(it) }
|
||||
}
|
||||
|
||||
if (state.isLocal) {
|
||||
|
|
|
|||
|
|
@ -28,10 +28,12 @@ import androidx.compose.runtime.saveable.rememberSaveable
|
|||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalFocusManager
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.hilt.navigation.compose.hiltViewModel
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import com.geeksville.mesh.ModuleConfigProtos
|
||||
import com.geeksville.mesh.R
|
||||
import com.geeksville.mesh.copy
|
||||
import com.geeksville.mesh.moduleConfig
|
||||
import com.geeksville.mesh.ui.components.EditTextPreference
|
||||
|
|
@ -75,50 +77,60 @@ fun AmbientLightingConfigItemList(
|
|||
LazyColumn(
|
||||
modifier = Modifier.fillMaxSize()
|
||||
) {
|
||||
item { PreferenceCategory(text = "Ambient Lighting Config") }
|
||||
item { PreferenceCategory(text = stringResource(R.string.ambient_lighting_config)) }
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "LED state",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.led_state),
|
||||
checked = ambientLightingInput.ledState,
|
||||
enabled = enabled,
|
||||
onCheckedChange = {
|
||||
ambientLightingInput = ambientLightingInput.copy { ledState = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "Current",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.current),
|
||||
value = ambientLightingInput.current,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = {
|
||||
ambientLightingInput = ambientLightingInput.copy { current = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "Red",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.red),
|
||||
value = ambientLightingInput.red,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = { ambientLightingInput = ambientLightingInput.copy { red = it } })
|
||||
onValueChanged = { ambientLightingInput = ambientLightingInput.copy { red = it } }
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "Green",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.green),
|
||||
value = ambientLightingInput.green,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = { ambientLightingInput = ambientLightingInput.copy { green = it } })
|
||||
onValueChanged = { ambientLightingInput = ambientLightingInput.copy { green = it } }
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "Blue",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.blue),
|
||||
value = ambientLightingInput.blue,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = { ambientLightingInput = ambientLightingInput.copy { blue = it } })
|
||||
onValueChanged = { ambientLightingInput = ambientLightingInput.copy { blue = it } }
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
|
|
|
|||
|
|
@ -28,10 +28,12 @@ import androidx.compose.runtime.saveable.rememberSaveable
|
|||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalFocusManager
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.hilt.navigation.compose.hiltViewModel
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import com.geeksville.mesh.ModuleConfigProtos.ModuleConfig.AudioConfig
|
||||
import com.geeksville.mesh.R
|
||||
import com.geeksville.mesh.copy
|
||||
import com.geeksville.mesh.moduleConfig
|
||||
import com.geeksville.mesh.ui.components.DropDownPreference
|
||||
|
|
@ -76,65 +78,79 @@ fun AudioConfigItemList(
|
|||
LazyColumn(
|
||||
modifier = Modifier.fillMaxSize()
|
||||
) {
|
||||
item { PreferenceCategory(text = "Audio Config") }
|
||||
item { PreferenceCategory(text = stringResource(R.string.audio_config)) }
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "CODEC 2 enabled",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.codec_2_enabled),
|
||||
checked = audioInput.codec2Enabled,
|
||||
enabled = enabled,
|
||||
onCheckedChange = { audioInput = audioInput.copy { codec2Enabled = it } })
|
||||
onCheckedChange = { audioInput = audioInput.copy { codec2Enabled = it } }
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "PTT pin",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.ptt_pin),
|
||||
value = audioInput.pttPin,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = { audioInput = audioInput.copy { pttPin = it } })
|
||||
onValueChanged = { audioInput = audioInput.copy { pttPin = it } }
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
DropDownPreference(title = "CODEC2 sample rate",
|
||||
DropDownPreference(
|
||||
title = stringResource(R.string.codec2_sample_rate),
|
||||
enabled = enabled,
|
||||
items = AudioConfig.Audio_Baud.entries
|
||||
.filter { it != AudioConfig.Audio_Baud.UNRECOGNIZED }
|
||||
.map { it to it.name },
|
||||
selectedItem = audioInput.bitrate,
|
||||
onItemSelected = { audioInput = audioInput.copy { bitrate = it } })
|
||||
onItemSelected = { audioInput = audioInput.copy { bitrate = it } }
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "I2S word select",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.i2s_word_select),
|
||||
value = audioInput.i2SWs,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = { audioInput = audioInput.copy { i2SWs = it } })
|
||||
onValueChanged = { audioInput = audioInput.copy { i2SWs = it } }
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "I2S data in",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.i2s_data_in),
|
||||
value = audioInput.i2SSd,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = { audioInput = audioInput.copy { i2SSd = it } })
|
||||
onValueChanged = { audioInput = audioInput.copy { i2SSd = it } }
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "I2S data out",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.i2s_data_out),
|
||||
value = audioInput.i2SDin,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = { audioInput = audioInput.copy { i2SDin = it } })
|
||||
onValueChanged = { audioInput = audioInput.copy { i2SDin = it } }
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "I2S clock",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.i2s_clock),
|
||||
value = audioInput.i2SSck,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = { audioInput = audioInput.copy { i2SSck = it } })
|
||||
onValueChanged = { audioInput = audioInput.copy { i2SSck = it } }
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
|
|
|
|||
|
|
@ -28,10 +28,12 @@ import androidx.compose.runtime.saveable.rememberSaveable
|
|||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalFocusManager
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.hilt.navigation.compose.hiltViewModel
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import com.geeksville.mesh.ConfigProtos.Config.BluetoothConfig
|
||||
import com.geeksville.mesh.R
|
||||
import com.geeksville.mesh.config
|
||||
import com.geeksville.mesh.copy
|
||||
import com.geeksville.mesh.ui.components.DropDownPreference
|
||||
|
|
@ -76,29 +78,34 @@ fun BluetoothConfigItemList(
|
|||
LazyColumn(
|
||||
modifier = Modifier.fillMaxSize()
|
||||
) {
|
||||
item { PreferenceCategory(text = "Bluetooth Config") }
|
||||
item { PreferenceCategory(text = stringResource(R.string.bluetooth_config)) }
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "Bluetooth enabled",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.bluetooth_enabled),
|
||||
checked = bluetoothInput.enabled,
|
||||
enabled = enabled,
|
||||
onCheckedChange = { bluetoothInput = bluetoothInput.copy { this.enabled = it } })
|
||||
onCheckedChange = { bluetoothInput = bluetoothInput.copy { this.enabled = it } }
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
DropDownPreference(title = "Pairing mode",
|
||||
DropDownPreference(
|
||||
title = stringResource(R.string.pairing_mode),
|
||||
enabled = enabled,
|
||||
items = BluetoothConfig.PairingMode.entries
|
||||
.filter { it != BluetoothConfig.PairingMode.UNRECOGNIZED }
|
||||
.map { it to it.name },
|
||||
selectedItem = bluetoothInput.mode,
|
||||
onItemSelected = { bluetoothInput = bluetoothInput.copy { mode = it } })
|
||||
onItemSelected = { bluetoothInput = bluetoothInput.copy { mode = it } }
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "Fixed PIN",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.fixed_pin),
|
||||
value = bluetoothInput.fixedPin,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
|
|
@ -106,7 +113,8 @@ fun BluetoothConfigItemList(
|
|||
if (it.toString().length == 6) { // ensure 6 digits
|
||||
bluetoothInput = bluetoothInput.copy { fixedPin = it }
|
||||
}
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
|
|
|
|||
|
|
@ -29,12 +29,14 @@ import androidx.compose.runtime.saveable.rememberSaveable
|
|||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalFocusManager
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.input.ImeAction
|
||||
import androidx.compose.ui.text.input.KeyboardType
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.hilt.navigation.compose.hiltViewModel
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import com.geeksville.mesh.ModuleConfigProtos.ModuleConfig.CannedMessageConfig
|
||||
import com.geeksville.mesh.R
|
||||
import com.geeksville.mesh.copy
|
||||
import com.geeksville.mesh.moduleConfig
|
||||
import com.geeksville.mesh.ui.components.DropDownPreference
|
||||
|
|
@ -87,60 +89,71 @@ fun CannedMessageConfigItemList(
|
|||
LazyColumn(
|
||||
modifier = Modifier.fillMaxSize()
|
||||
) {
|
||||
item { PreferenceCategory(text = "Canned Message Config") }
|
||||
item { PreferenceCategory(text = stringResource(R.string.canned_message_config)) }
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "Canned message enabled",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.canned_message_enabled),
|
||||
checked = cannedMessageInput.enabled,
|
||||
enabled = enabled,
|
||||
onCheckedChange = {
|
||||
cannedMessageInput = cannedMessageInput.copy { this.enabled = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "Rotary encoder #1 enabled",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.rotary_encoder_1_enabled),
|
||||
checked = cannedMessageInput.rotary1Enabled,
|
||||
enabled = enabled,
|
||||
onCheckedChange = {
|
||||
cannedMessageInput = cannedMessageInput.copy { rotary1Enabled = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "GPIO pin for rotary encoder A port",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.gpio_pin_for_rotary_encoder_a_port),
|
||||
value = cannedMessageInput.inputbrokerPinA,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = {
|
||||
cannedMessageInput = cannedMessageInput.copy { inputbrokerPinA = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "GPIO pin for rotary encoder B port",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.gpio_pin_for_rotary_encoder_b_port),
|
||||
value = cannedMessageInput.inputbrokerPinB,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = {
|
||||
cannedMessageInput = cannedMessageInput.copy { inputbrokerPinB = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "GPIO pin for rotary encoder Press port",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.gpio_pin_for_rotary_encoder_press_port),
|
||||
value = cannedMessageInput.inputbrokerPinPress,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = {
|
||||
cannedMessageInput = cannedMessageInput.copy { inputbrokerPinPress = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
DropDownPreference(title = "Generate input event on Press",
|
||||
DropDownPreference(
|
||||
title = stringResource(R.string.generate_input_event_on_press),
|
||||
enabled = enabled,
|
||||
items = CannedMessageConfig.InputEventChar.entries
|
||||
.filter { it != CannedMessageConfig.InputEventChar.UNRECOGNIZED }
|
||||
|
|
@ -148,12 +161,14 @@ fun CannedMessageConfigItemList(
|
|||
selectedItem = cannedMessageInput.inputbrokerEventPress,
|
||||
onItemSelected = {
|
||||
cannedMessageInput = cannedMessageInput.copy { inputbrokerEventPress = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
DropDownPreference(title = "Generate input event on CW",
|
||||
DropDownPreference(
|
||||
title = stringResource(R.string.generate_input_event_on_cw),
|
||||
enabled = enabled,
|
||||
items = CannedMessageConfig.InputEventChar.entries
|
||||
.filter { it != CannedMessageConfig.InputEventChar.UNRECOGNIZED }
|
||||
|
|
@ -161,12 +176,14 @@ fun CannedMessageConfigItemList(
|
|||
selectedItem = cannedMessageInput.inputbrokerEventCw,
|
||||
onItemSelected = {
|
||||
cannedMessageInput = cannedMessageInput.copy { inputbrokerEventCw = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
DropDownPreference(title = "Generate input event on CCW",
|
||||
DropDownPreference(
|
||||
title = stringResource(R.string.generate_input_event_on_ccw),
|
||||
enabled = enabled,
|
||||
items = CannedMessageConfig.InputEventChar.entries
|
||||
.filter { it != CannedMessageConfig.InputEventChar.UNRECOGNIZED }
|
||||
|
|
@ -174,22 +191,26 @@ fun CannedMessageConfigItemList(
|
|||
selectedItem = cannedMessageInput.inputbrokerEventCcw,
|
||||
onItemSelected = {
|
||||
cannedMessageInput = cannedMessageInput.copy { inputbrokerEventCcw = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "Up/Down/Select input enabled",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.up_down_select_input_enabled),
|
||||
checked = cannedMessageInput.updown1Enabled,
|
||||
enabled = enabled,
|
||||
onCheckedChange = {
|
||||
cannedMessageInput = cannedMessageInput.copy { updown1Enabled = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "Allow input source",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.allow_input_source),
|
||||
value = cannedMessageInput.allowInputSource,
|
||||
maxSize = 63, // allow_input_source max_size:16
|
||||
enabled = enabled,
|
||||
|
|
@ -200,21 +221,25 @@ fun CannedMessageConfigItemList(
|
|||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = {
|
||||
cannedMessageInput = cannedMessageInput.copy { allowInputSource = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "Send bell",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.send_bell),
|
||||
checked = cannedMessageInput.sendBell,
|
||||
enabled = enabled,
|
||||
onCheckedChange = {
|
||||
cannedMessageInput = cannedMessageInput.copy { sendBell = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "Messages",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.messages),
|
||||
value = messagesInput,
|
||||
maxSize = 200, // messages max_size:201
|
||||
enabled = enabled,
|
||||
|
|
|
|||
|
|
@ -191,10 +191,11 @@ fun ChannelConfigScreen(
|
|||
)
|
||||
}
|
||||
|
||||
@Suppress("LongMethod")
|
||||
@Composable
|
||||
fun ChannelSettingsItemList(
|
||||
settingsList: List<ChannelSettings>,
|
||||
modemPresetName: String = "Default",
|
||||
modemPresetName: String = stringResource(R.string.default_),
|
||||
maxChannels: Int = 8,
|
||||
enabled: Boolean,
|
||||
onNegativeClicked: () -> Unit = { },
|
||||
|
|
@ -249,7 +250,7 @@ fun ChannelSettingsItemList(
|
|||
state = listState,
|
||||
contentPadding = PaddingValues(horizontal = 16.dp),
|
||||
) {
|
||||
item { PreferenceCategory(text = "Channels") }
|
||||
item { PreferenceCategory(text = stringResource(R.string.channels)) }
|
||||
|
||||
dragDropItemsIndexed(
|
||||
items = settingsListInput,
|
||||
|
|
@ -300,9 +301,11 @@ fun ChannelSettingsItemList(
|
|||
FloatingActionButton(
|
||||
onClick = {
|
||||
if (maxChannels > settingsListInput.size) {
|
||||
settingsListInput.add(channelSettings {
|
||||
settingsListInput.add(
|
||||
channelSettings {
|
||||
psk = Channel.default.settings.psk
|
||||
})
|
||||
}
|
||||
)
|
||||
showEditChannelDialog = settingsListInput.lastIndex
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -29,12 +29,14 @@ import androidx.compose.runtime.saveable.rememberSaveable
|
|||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalFocusManager
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.input.ImeAction
|
||||
import androidx.compose.ui.text.input.KeyboardType
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.hilt.navigation.compose.hiltViewModel
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import com.geeksville.mesh.ModuleConfigProtos.ModuleConfig
|
||||
import com.geeksville.mesh.R
|
||||
import com.geeksville.mesh.copy
|
||||
import com.geeksville.mesh.moduleConfig
|
||||
import com.geeksville.mesh.ui.components.DropDownPreference
|
||||
|
|
@ -80,50 +82,59 @@ fun DetectionSensorConfigItemList(
|
|||
LazyColumn(
|
||||
modifier = Modifier.fillMaxSize()
|
||||
) {
|
||||
item { PreferenceCategory(text = "Detection Sensor Config") }
|
||||
item { PreferenceCategory(text = stringResource(R.string.detection_sensor_config)) }
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "Detection Sensor enabled",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.detection_sensor_enabled),
|
||||
checked = detectionSensorInput.enabled,
|
||||
enabled = enabled,
|
||||
onCheckedChange = {
|
||||
detectionSensorInput = detectionSensorInput.copy { this.enabled = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "Minimum broadcast (seconds)",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.minimum_broadcast_seconds),
|
||||
value = detectionSensorInput.minimumBroadcastSecs,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = {
|
||||
detectionSensorInput = detectionSensorInput.copy { minimumBroadcastSecs = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "State broadcast (seconds)",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.state_broadcast_seconds),
|
||||
value = detectionSensorInput.stateBroadcastSecs,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = {
|
||||
detectionSensorInput = detectionSensorInput.copy { stateBroadcastSecs = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "Send bell with alert message",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.send_bell_with_alert_message),
|
||||
checked = detectionSensorInput.sendBell,
|
||||
enabled = enabled,
|
||||
onCheckedChange = {
|
||||
detectionSensorInput = detectionSensorInput.copy { sendBell = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "Friendly name",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.friendly_name),
|
||||
value = detectionSensorInput.name,
|
||||
maxSize = 19, // name max_size:20
|
||||
enabled = enabled,
|
||||
|
|
@ -134,22 +145,25 @@ fun DetectionSensorConfigItemList(
|
|||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = {
|
||||
detectionSensorInput = detectionSensorInput.copy { name = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "GPIO pin to monitor",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.gpio_pin_to_monitor),
|
||||
value = detectionSensorInput.monitorPin,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = {
|
||||
detectionSensorInput = detectionSensorInput.copy { monitorPin = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
DropDownPreference(
|
||||
title = "Detection trigger type",
|
||||
title = stringResource(R.string.detection_trigger_type),
|
||||
enabled = enabled,
|
||||
items = ModuleConfig.DetectionSensorConfig.TriggerType.entries
|
||||
.filter { it != ModuleConfig.DetectionSensorConfig.TriggerType.UNRECOGNIZED }
|
||||
|
|
@ -163,12 +177,14 @@ fun DetectionSensorConfigItemList(
|
|||
item { Divider() }
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "Use INPUT_PULLUP mode",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.use_input_pullup_mode),
|
||||
checked = detectionSensorInput.usePullup,
|
||||
enabled = enabled,
|
||||
onCheckedChange = {
|
||||
detectionSensorInput = detectionSensorInput.copy { usePullup = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
|
|
|
|||
|
|
@ -195,11 +195,11 @@ fun DeviceConfigItemList(
|
|||
LazyColumn(
|
||||
modifier = Modifier.fillMaxSize()
|
||||
) {
|
||||
item { PreferenceCategory(text = "Device Config") }
|
||||
item { PreferenceCategory(text = stringResource(R.string.device_config)) }
|
||||
|
||||
item {
|
||||
DropDownPreference(
|
||||
title = "Role",
|
||||
title = stringResource(R.string.role),
|
||||
enabled = enabled,
|
||||
selectedItem = deviceInput.role,
|
||||
onItemSelected = {
|
||||
|
|
@ -211,28 +211,32 @@ fun DeviceConfigItemList(
|
|||
}
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "Redefine PIN_BUTTON",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.redefine_pin_button),
|
||||
value = deviceInput.buttonGpio,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = {
|
||||
deviceInput = deviceInput.copy { buttonGpio = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "Redefine PIN_BUZZER",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.redefine_pin_buzzer),
|
||||
value = deviceInput.buzzerGpio,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = {
|
||||
deviceInput = deviceInput.copy { buzzerGpio = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
DropDownPreference(
|
||||
title = "Rebroadcast mode",
|
||||
title = stringResource(R.string.rebroadcast_mode),
|
||||
enabled = enabled,
|
||||
selectedItem = deviceInput.rebroadcastMode,
|
||||
onItemSelected = { deviceInput = deviceInput.copy { rebroadcastMode = it } },
|
||||
|
|
@ -242,18 +246,20 @@ fun DeviceConfigItemList(
|
|||
}
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "NodeInfo broadcast interval (seconds)",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.nodeinfo_broadcast_interval_seconds),
|
||||
value = deviceInput.nodeInfoBroadcastSecs,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = {
|
||||
deviceInput = deviceInput.copy { nodeInfoBroadcastSecs = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
SwitchPreference(
|
||||
title = "Double tap as button press",
|
||||
title = stringResource(R.string.double_tap_as_button_press),
|
||||
summary = stringResource(id = R.string.config_device_doubleTapAsButtonPress_summary),
|
||||
checked = deviceInput.doubleTapAsButtonPress,
|
||||
enabled = enabled,
|
||||
|
|
@ -264,7 +270,7 @@ fun DeviceConfigItemList(
|
|||
|
||||
item {
|
||||
SwitchPreference(
|
||||
title = "Disable triple-click",
|
||||
title = stringResource(R.string.disable_triple_click),
|
||||
summary = stringResource(id = R.string.config_device_disableTripleClick_summary),
|
||||
checked = deviceInput.disableTripleClick,
|
||||
enabled = enabled,
|
||||
|
|
@ -274,7 +280,8 @@ fun DeviceConfigItemList(
|
|||
}
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "POSIX Timezone",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.posix_timezone),
|
||||
value = deviceInput.tzdef,
|
||||
maxSize = 64, // tzdef max_size:65
|
||||
enabled = enabled,
|
||||
|
|
@ -291,7 +298,7 @@ fun DeviceConfigItemList(
|
|||
|
||||
item {
|
||||
SwitchPreference(
|
||||
title = "Disable LED heartbeat",
|
||||
title = stringResource(R.string.disable_led_heartbeat),
|
||||
summary = stringResource(id = R.string.config_device_ledHeartbeatDisabled_summary),
|
||||
checked = deviceInput.ledHeartbeatDisabled,
|
||||
enabled = enabled,
|
||||
|
|
|
|||
|
|
@ -28,10 +28,12 @@ import androidx.compose.runtime.saveable.rememberSaveable
|
|||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalFocusManager
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.hilt.navigation.compose.hiltViewModel
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import com.geeksville.mesh.ConfigProtos.Config.DisplayConfig
|
||||
import com.geeksville.mesh.R
|
||||
import com.geeksville.mesh.config
|
||||
import com.geeksville.mesh.copy
|
||||
import com.geeksville.mesh.ui.components.DropDownPreference
|
||||
|
|
@ -76,110 +78,132 @@ fun DisplayConfigItemList(
|
|||
LazyColumn(
|
||||
modifier = Modifier.fillMaxSize()
|
||||
) {
|
||||
item { PreferenceCategory(text = "Display Config") }
|
||||
item { PreferenceCategory(text = stringResource(R.string.display_config)) }
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "Screen timeout (seconds)",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.screen_timeout_seconds),
|
||||
value = displayInput.screenOnSecs,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = { displayInput = displayInput.copy { screenOnSecs = it } })
|
||||
onValueChanged = { displayInput = displayInput.copy { screenOnSecs = it } }
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
DropDownPreference(title = "GPS coordinates format",
|
||||
DropDownPreference(
|
||||
title = stringResource(R.string.gps_coordinates_format),
|
||||
enabled = enabled,
|
||||
items = DisplayConfig.GpsCoordinateFormat.entries
|
||||
.filter { it != DisplayConfig.GpsCoordinateFormat.UNRECOGNIZED }
|
||||
.map { it to it.name },
|
||||
selectedItem = displayInput.gpsFormat,
|
||||
onItemSelected = { displayInput = displayInput.copy { gpsFormat = it } })
|
||||
onItemSelected = { displayInput = displayInput.copy { gpsFormat = it } }
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "Auto screen carousel (seconds)",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.auto_screen_carousel_seconds),
|
||||
value = displayInput.autoScreenCarouselSecs,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = {
|
||||
displayInput = displayInput.copy { autoScreenCarouselSecs = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "Compass north top",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.compass_north_top),
|
||||
checked = displayInput.compassNorthTop,
|
||||
enabled = enabled,
|
||||
onCheckedChange = { displayInput = displayInput.copy { compassNorthTop = it } })
|
||||
onCheckedChange = { displayInput = displayInput.copy { compassNorthTop = it } }
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "Flip screen",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.flip_screen),
|
||||
checked = displayInput.flipScreen,
|
||||
enabled = enabled,
|
||||
onCheckedChange = { displayInput = displayInput.copy { flipScreen = it } })
|
||||
onCheckedChange = { displayInput = displayInput.copy { flipScreen = it } }
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
DropDownPreference(title = "Display units",
|
||||
DropDownPreference(
|
||||
title = stringResource(R.string.display_units),
|
||||
enabled = enabled,
|
||||
items = DisplayConfig.DisplayUnits.entries
|
||||
.filter { it != DisplayConfig.DisplayUnits.UNRECOGNIZED }
|
||||
.map { it to it.name },
|
||||
selectedItem = displayInput.units,
|
||||
onItemSelected = { displayInput = displayInput.copy { units = it } })
|
||||
onItemSelected = { displayInput = displayInput.copy { units = it } }
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
DropDownPreference(title = "Override OLED auto-detect",
|
||||
DropDownPreference(
|
||||
title = stringResource(R.string.override_oled_auto_detect),
|
||||
enabled = enabled,
|
||||
items = DisplayConfig.OledType.entries
|
||||
.filter { it != DisplayConfig.OledType.UNRECOGNIZED }
|
||||
.map { it to it.name },
|
||||
selectedItem = displayInput.oled,
|
||||
onItemSelected = { displayInput = displayInput.copy { oled = it } })
|
||||
onItemSelected = { displayInput = displayInput.copy { oled = it } }
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
DropDownPreference(title = "Display mode",
|
||||
DropDownPreference(
|
||||
title = stringResource(R.string.display_mode),
|
||||
enabled = enabled,
|
||||
items = DisplayConfig.DisplayMode.entries
|
||||
.filter { it != DisplayConfig.DisplayMode.UNRECOGNIZED }
|
||||
.map { it to it.name },
|
||||
selectedItem = displayInput.displaymode,
|
||||
onItemSelected = { displayInput = displayInput.copy { displaymode = it } })
|
||||
onItemSelected = { displayInput = displayInput.copy { displaymode = it } }
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "Heading bold",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.heading_bold),
|
||||
checked = displayInput.headingBold,
|
||||
enabled = enabled,
|
||||
onCheckedChange = { displayInput = displayInput.copy { headingBold = it } })
|
||||
onCheckedChange = { displayInput = displayInput.copy { headingBold = it } }
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "Wake screen on tap or motion",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.wake_screen_on_tap_or_motion),
|
||||
checked = displayInput.wakeOnTapOrMotion,
|
||||
enabled = enabled,
|
||||
onCheckedChange = { displayInput = displayInput.copy { wakeOnTapOrMotion = it } })
|
||||
onCheckedChange = { displayInput = displayInput.copy { wakeOnTapOrMotion = it } }
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
DropDownPreference(title = "Compass orientation",
|
||||
DropDownPreference(
|
||||
title = stringResource(R.string.compass_orientation),
|
||||
enabled = enabled,
|
||||
items = DisplayConfig.CompassOrientation.entries
|
||||
.filter { it != DisplayConfig.CompassOrientation.UNRECOGNIZED }
|
||||
.map { it to it.name },
|
||||
selectedItem = displayInput.compassOrientation,
|
||||
onItemSelected = { displayInput = displayInput.copy { compassOrientation = it } })
|
||||
onItemSelected = { displayInput = displayInput.copy { compassOrientation = it } }
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ fun EditChannelDialog(
|
|||
onAddClick: (ChannelProtos.ChannelSettings) -> Unit,
|
||||
onDismissRequest: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
modemPresetName: String = "Default",
|
||||
modemPresetName: String = stringResource(R.string.default_),
|
||||
) {
|
||||
val focusManager = LocalFocusManager.current
|
||||
var isFocused by remember { mutableStateOf(false) }
|
||||
|
|
@ -111,7 +111,7 @@ fun EditChannelDialog(
|
|||
)
|
||||
|
||||
SwitchPreference(
|
||||
title = "Uplink enabled",
|
||||
title = stringResource(R.string.uplink_enabled),
|
||||
checked = channelInput.uplinkEnabled,
|
||||
enabled = true,
|
||||
onCheckedChange = {
|
||||
|
|
@ -121,7 +121,7 @@ fun EditChannelDialog(
|
|||
)
|
||||
|
||||
SwitchPreference(
|
||||
title = "Downlink enabled",
|
||||
title = stringResource(R.string.downlink_enabled),
|
||||
checked = channelInput.downlinkEnabled,
|
||||
enabled = true,
|
||||
onCheckedChange = {
|
||||
|
|
@ -131,7 +131,7 @@ fun EditChannelDialog(
|
|||
)
|
||||
|
||||
PositionPrecisionPreference(
|
||||
title = "Position enabled",
|
||||
title = stringResource(R.string.position_enabled),
|
||||
enabled = true,
|
||||
value = channelInput.moduleSettings.positionPrecision,
|
||||
onValueChanged = {
|
||||
|
|
|
|||
|
|
@ -29,12 +29,14 @@ import androidx.compose.runtime.saveable.rememberSaveable
|
|||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalFocusManager
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.input.ImeAction
|
||||
import androidx.compose.ui.text.input.KeyboardType
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.hilt.navigation.compose.hiltViewModel
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import com.geeksville.mesh.ModuleConfigProtos.ModuleConfig.ExternalNotificationConfig
|
||||
import com.geeksville.mesh.R
|
||||
import com.geeksville.mesh.copy
|
||||
import com.geeksville.mesh.moduleConfig
|
||||
import com.geeksville.mesh.ui.components.EditTextPreference
|
||||
|
|
@ -87,156 +89,189 @@ fun ExternalNotificationConfigItemList(
|
|||
LazyColumn(
|
||||
modifier = Modifier.fillMaxSize()
|
||||
) {
|
||||
item { PreferenceCategory(text = "External Notification Config") }
|
||||
item { PreferenceCategory(text = stringResource(R.string.external_notification_config)) }
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "External notification enabled",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.external_notification_enabled),
|
||||
checked = externalNotificationInput.enabled,
|
||||
enabled = enabled,
|
||||
onCheckedChange = {
|
||||
externalNotificationInput = externalNotificationInput.copy { this.enabled = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
item { TextDividerPreference("Notifications on message receipt", enabled = enabled) }
|
||||
item { TextDividerPreference(stringResource(R.string.notifications_on_message_receipt), enabled = enabled) }
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "Alert message LED",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.alert_message_led),
|
||||
checked = externalNotificationInput.alertMessage,
|
||||
enabled = enabled,
|
||||
onCheckedChange = {
|
||||
externalNotificationInput = externalNotificationInput.copy { alertMessage = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "Alert message buzzer",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.alert_message_buzzer),
|
||||
checked = externalNotificationInput.alertMessageBuzzer,
|
||||
enabled = enabled,
|
||||
onCheckedChange = {
|
||||
externalNotificationInput =
|
||||
externalNotificationInput.copy { alertMessageBuzzer = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "Alert message vibra",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.alert_message_vibra),
|
||||
checked = externalNotificationInput.alertMessageVibra,
|
||||
enabled = enabled,
|
||||
onCheckedChange = {
|
||||
externalNotificationInput =
|
||||
externalNotificationInput.copy { alertMessageVibra = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
item { TextDividerPreference("Notifications on alert/bell receipt", enabled = enabled) }
|
||||
item { TextDividerPreference(stringResource(R.string.notifications_on_alert_bell_receipt), enabled = enabled) }
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "Alert bell LED",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.alert_bell_led),
|
||||
checked = externalNotificationInput.alertBell,
|
||||
enabled = enabled,
|
||||
onCheckedChange = {
|
||||
externalNotificationInput = externalNotificationInput.copy { alertBell = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "Alert bell buzzer",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.alert_bell_buzzer),
|
||||
checked = externalNotificationInput.alertBellBuzzer,
|
||||
enabled = enabled,
|
||||
onCheckedChange = {
|
||||
externalNotificationInput =
|
||||
externalNotificationInput.copy { alertBellBuzzer = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "Alert bell vibra",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.alert_bell_vibra),
|
||||
checked = externalNotificationInput.alertBellVibra,
|
||||
enabled = enabled,
|
||||
onCheckedChange = {
|
||||
externalNotificationInput =
|
||||
externalNotificationInput.copy { alertBellVibra = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "Output LED (GPIO)",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.output_led_gpio),
|
||||
value = externalNotificationInput.output,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = {
|
||||
externalNotificationInput = externalNotificationInput.copy { output = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
if (externalNotificationInput.output != 0) item {
|
||||
SwitchPreference(title = "Output LED active high",
|
||||
if (externalNotificationInput.output != 0) {
|
||||
item {
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.output_led_active_high),
|
||||
checked = externalNotificationInput.active,
|
||||
enabled = enabled,
|
||||
onCheckedChange = {
|
||||
externalNotificationInput = externalNotificationInput.copy { active = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "Output buzzer (GPIO)",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.output_buzzer_gpio),
|
||||
value = externalNotificationInput.outputBuzzer,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = {
|
||||
externalNotificationInput = externalNotificationInput.copy { outputBuzzer = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
if (externalNotificationInput.outputBuzzer != 0) item {
|
||||
SwitchPreference(title = "Use PWM buzzer",
|
||||
if (externalNotificationInput.outputBuzzer != 0) {
|
||||
item {
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.use_pwm_buzzer),
|
||||
checked = externalNotificationInput.usePwm,
|
||||
enabled = enabled,
|
||||
onCheckedChange = {
|
||||
externalNotificationInput = externalNotificationInput.copy { usePwm = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "Output vibra (GPIO)",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.output_vibra_gpio),
|
||||
value = externalNotificationInput.outputVibra,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = {
|
||||
externalNotificationInput = externalNotificationInput.copy { outputVibra = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "Output duration (milliseconds)",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.output_duration_milliseconds),
|
||||
value = externalNotificationInput.outputMs,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = {
|
||||
externalNotificationInput = externalNotificationInput.copy { outputMs = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "Nag timeout (seconds)",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.nag_timeout_seconds),
|
||||
value = externalNotificationInput.nagTimeout,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = {
|
||||
externalNotificationInput = externalNotificationInput.copy { nagTimeout = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "Ringtone",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.ringtone),
|
||||
value = ringtoneInput,
|
||||
maxSize = 230, // ringtone max_size:231
|
||||
enabled = enabled,
|
||||
|
|
@ -250,12 +285,14 @@ fun ExternalNotificationConfigItemList(
|
|||
}
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "Use I2S as buzzer",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.use_i2s_as_buzzer),
|
||||
checked = externalNotificationInput.useI2SAsBuzzer,
|
||||
enabled = enabled,
|
||||
onCheckedChange = {
|
||||
externalNotificationInput = externalNotificationInput.copy { useI2SAsBuzzer = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
|
|
|
|||
|
|
@ -29,11 +29,13 @@ import androidx.compose.runtime.saveable.rememberSaveable
|
|||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalFocusManager
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.hilt.navigation.compose.hiltViewModel
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import com.geeksville.mesh.ChannelProtos.ChannelSettings
|
||||
import com.geeksville.mesh.ConfigProtos.Config.LoRaConfig
|
||||
import com.geeksville.mesh.R
|
||||
import com.geeksville.mesh.config
|
||||
import com.geeksville.mesh.copy
|
||||
import com.geeksville.mesh.model.Channel
|
||||
|
|
@ -91,89 +93,107 @@ fun LoRaConfigItemList(
|
|||
LazyColumn(
|
||||
modifier = Modifier.fillMaxSize()
|
||||
) {
|
||||
item { PreferenceCategory(text = "LoRa Config") }
|
||||
item { PreferenceCategory(text = stringResource(R.string.lora_config)) }
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "Use modem preset",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.use_modem_preset),
|
||||
checked = loraInput.usePreset,
|
||||
enabled = enabled,
|
||||
onCheckedChange = { loraInput = loraInput.copy { usePreset = it } })
|
||||
onCheckedChange = { loraInput = loraInput.copy { usePreset = it } }
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
if (loraInput.usePreset) {
|
||||
item {
|
||||
DropDownPreference(title = "Modem preset",
|
||||
DropDownPreference(
|
||||
title = stringResource(R.string.modem_preset),
|
||||
enabled = enabled && loraInput.usePreset,
|
||||
items = LoRaConfig.ModemPreset.entries
|
||||
.filter { it != LoRaConfig.ModemPreset.UNRECOGNIZED }
|
||||
.map { it to it.name },
|
||||
selectedItem = loraInput.modemPreset,
|
||||
onItemSelected = { loraInput = loraInput.copy { modemPreset = it } })
|
||||
onItemSelected = { loraInput = loraInput.copy { modemPreset = it } }
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
} else {
|
||||
item {
|
||||
EditTextPreference(title = "Bandwidth",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.bandwidth),
|
||||
value = loraInput.bandwidth,
|
||||
enabled = enabled && !loraInput.usePreset,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = { loraInput = loraInput.copy { bandwidth = it } })
|
||||
onValueChanged = { loraInput = loraInput.copy { bandwidth = it } }
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "Spread factor",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.spread_factor),
|
||||
value = loraInput.spreadFactor,
|
||||
enabled = enabled && !loraInput.usePreset,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = { loraInput = loraInput.copy { spreadFactor = it } })
|
||||
onValueChanged = { loraInput = loraInput.copy { spreadFactor = it } }
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "Coding rate",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.coding_rate),
|
||||
value = loraInput.codingRate,
|
||||
enabled = enabled && !loraInput.usePreset,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = { loraInput = loraInput.copy { codingRate = it } })
|
||||
onValueChanged = { loraInput = loraInput.copy { codingRate = it } }
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "Frequency offset (MHz)",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.frequency_offset_mhz),
|
||||
value = loraInput.frequencyOffset,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = { loraInput = loraInput.copy { frequencyOffset = it } })
|
||||
onValueChanged = { loraInput = loraInput.copy { frequencyOffset = it } }
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
DropDownPreference(title = "Region (frequency plan)",
|
||||
DropDownPreference(
|
||||
title = stringResource(R.string.region_frequency_plan),
|
||||
enabled = enabled,
|
||||
items = RegionInfo.entries.map { it.regionCode to it.description },
|
||||
selectedItem = loraInput.region,
|
||||
onItemSelected = { loraInput = loraInput.copy { region = it } })
|
||||
onItemSelected = { loraInput = loraInput.copy { region = it } }
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "Hop limit",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.hop_limit),
|
||||
value = loraInput.hopLimit,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = { loraInput = loraInput.copy { hopLimit = it } })
|
||||
onValueChanged = { loraInput = loraInput.copy { hopLimit = it } }
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "TX enabled",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.tx_enabled),
|
||||
checked = loraInput.txEnabled,
|
||||
enabled = enabled,
|
||||
onCheckedChange = { loraInput = loraInput.copy { txEnabled = it } })
|
||||
onCheckedChange = { loraInput = loraInput.copy { txEnabled = it } }
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
SignedIntegerEditTextPreference(
|
||||
title = "TX power (dBm)",
|
||||
title = stringResource(R.string.tx_power_dbm),
|
||||
value = loraInput.txPower,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
|
|
@ -183,7 +203,8 @@ fun LoRaConfigItemList(
|
|||
|
||||
item {
|
||||
var isFocused by remember { mutableStateOf(false) }
|
||||
EditTextPreference(title = "Frequency slot",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.frequency_slot),
|
||||
value = if (isFocused || loraInput.channelNum != 0) loraInput.channelNum else primaryChannel.channelNum,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
|
|
@ -192,19 +213,23 @@ fun LoRaConfigItemList(
|
|||
if (it <= loraInput.numChannels) { // total num of LoRa channels
|
||||
loraInput = loraInput.copy { channelNum = it }
|
||||
}
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "Override Duty Cycle",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.override_duty_cycle),
|
||||
checked = loraInput.overrideDutyCycle,
|
||||
enabled = enabled,
|
||||
onCheckedChange = { loraInput = loraInput.copy { overrideDutyCycle = it } })
|
||||
onCheckedChange = { loraInput = loraInput.copy { overrideDutyCycle = it } }
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
EditListPreference(title = "Ignore incoming",
|
||||
EditListPreference(
|
||||
title = stringResource(R.string.ignore_incoming),
|
||||
list = loraInput.ignoreIncomingList,
|
||||
maxCount = 3, // ignore_incoming max_count:3
|
||||
enabled = enabled,
|
||||
|
|
@ -214,51 +239,61 @@ fun LoRaConfigItemList(
|
|||
ignoreIncoming.clear()
|
||||
ignoreIncoming.addAll(list.filter { it != 0 })
|
||||
}
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "SX126X RX boosted gain",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.sx126x_rx_boosted_gain),
|
||||
checked = loraInput.sx126XRxBoostedGain,
|
||||
enabled = enabled,
|
||||
onCheckedChange = { loraInput = loraInput.copy { sx126XRxBoostedGain = it } })
|
||||
onCheckedChange = { loraInput = loraInput.copy { sx126XRxBoostedGain = it } }
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
var isFocused by remember { mutableStateOf(false) }
|
||||
EditTextPreference(title = "Override frequency (MHz)",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.override_frequency_mhz),
|
||||
value = if (isFocused || loraInput.overrideFrequency != 0f) loraInput.overrideFrequency else primaryChannel.radioFreq,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onFocusChanged = { isFocused = it.isFocused },
|
||||
onValueChanged = { loraInput = loraInput.copy { overrideFrequency = it } })
|
||||
onValueChanged = { loraInput = loraInput.copy { overrideFrequency = it } }
|
||||
)
|
||||
}
|
||||
|
||||
if (hasPaFan) {
|
||||
item {
|
||||
SwitchPreference(
|
||||
title = "PA fan disabled",
|
||||
title = stringResource(R.string.pa_fan_disabled),
|
||||
checked = loraInput.paFanDisabled,
|
||||
enabled = enabled,
|
||||
onCheckedChange = { loraInput = loraInput.copy { paFanDisabled = it } })
|
||||
onCheckedChange = { loraInput = loraInput.copy { paFanDisabled = it } }
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
}
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "Ignore MQTT",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.ignore_mqtt),
|
||||
checked = loraInput.ignoreMqtt,
|
||||
enabled = enabled,
|
||||
onCheckedChange = { loraInput = loraInput.copy { ignoreMqtt = it } })
|
||||
onCheckedChange = { loraInput = loraInput.copy { ignoreMqtt = it } }
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "OK to MQTT",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.ok_to_mqtt),
|
||||
checked = loraInput.configOkToMqtt,
|
||||
enabled = enabled,
|
||||
onCheckedChange = { loraInput = loraInput.copy { configOkToMqtt = it } })
|
||||
onCheckedChange = { loraInput = loraInput.copy { configOkToMqtt = it } }
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ import androidx.compose.runtime.saveable.rememberSaveable
|
|||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalFocusManager
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.input.ImeAction
|
||||
import androidx.compose.ui.text.input.KeyboardType
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
|
|
@ -37,6 +38,7 @@ import androidx.compose.ui.unit.dp
|
|||
import androidx.hilt.navigation.compose.hiltViewModel
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import com.geeksville.mesh.ModuleConfigProtos.ModuleConfig.MQTTConfig
|
||||
import com.geeksville.mesh.R
|
||||
import com.geeksville.mesh.copy
|
||||
import com.geeksville.mesh.moduleConfig
|
||||
import com.geeksville.mesh.ui.components.EditPasswordPreference
|
||||
|
|
@ -82,18 +84,21 @@ fun MQTTConfigItemList(
|
|||
LazyColumn(
|
||||
modifier = Modifier.fillMaxSize()
|
||||
) {
|
||||
item { PreferenceCategory(text = "MQTT Config") }
|
||||
item { PreferenceCategory(text = stringResource(R.string.mqtt_config)) }
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "MQTT enabled",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.mqtt_enabled),
|
||||
checked = mqttInput.enabled,
|
||||
enabled = enabled,
|
||||
onCheckedChange = { mqttInput = mqttInput.copy { this.enabled = it } })
|
||||
onCheckedChange = { mqttInput = mqttInput.copy { this.enabled = it } }
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "Address",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.address),
|
||||
value = mqttInput.address,
|
||||
maxSize = 63, // address max_size:64
|
||||
enabled = enabled,
|
||||
|
|
@ -102,11 +107,13 @@ fun MQTTConfigItemList(
|
|||
keyboardType = KeyboardType.Text, imeAction = ImeAction.Done
|
||||
),
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = { mqttInput = mqttInput.copy { address = it } })
|
||||
onValueChanged = { mqttInput = mqttInput.copy { address = it } }
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "Username",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.username),
|
||||
value = mqttInput.username,
|
||||
maxSize = 63, // username max_size:64
|
||||
enabled = enabled,
|
||||
|
|
@ -115,44 +122,54 @@ fun MQTTConfigItemList(
|
|||
keyboardType = KeyboardType.Text, imeAction = ImeAction.Done
|
||||
),
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = { mqttInput = mqttInput.copy { username = it } })
|
||||
onValueChanged = { mqttInput = mqttInput.copy { username = it } }
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
EditPasswordPreference(title = "Password",
|
||||
EditPasswordPreference(
|
||||
title = stringResource(R.string.password),
|
||||
value = mqttInput.password,
|
||||
maxSize = 63, // password max_size:64
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = { mqttInput = mqttInput.copy { password = it } })
|
||||
onValueChanged = { mqttInput = mqttInput.copy { password = it } }
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "Encryption enabled",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.encryption_enabled),
|
||||
checked = mqttInput.encryptionEnabled,
|
||||
enabled = enabled,
|
||||
onCheckedChange = { mqttInput = mqttInput.copy { encryptionEnabled = it } })
|
||||
onCheckedChange = { mqttInput = mqttInput.copy { encryptionEnabled = it } }
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "JSON output enabled",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.json_output_enabled),
|
||||
checked = mqttInput.jsonEnabled,
|
||||
enabled = enabled,
|
||||
onCheckedChange = { mqttInput = mqttInput.copy { jsonEnabled = it } })
|
||||
onCheckedChange = { mqttInput = mqttInput.copy { jsonEnabled = it } }
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "TLS enabled",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.tls_enabled),
|
||||
checked = mqttInput.tlsEnabled,
|
||||
enabled = enabled,
|
||||
onCheckedChange = { mqttInput = mqttInput.copy { tlsEnabled = it } })
|
||||
onCheckedChange = { mqttInput = mqttInput.copy { tlsEnabled = it } }
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "Root topic",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.root_topic),
|
||||
value = mqttInput.root,
|
||||
maxSize = 31, // root max_size:32
|
||||
enabled = enabled,
|
||||
|
|
@ -161,20 +178,23 @@ fun MQTTConfigItemList(
|
|||
keyboardType = KeyboardType.Text, imeAction = ImeAction.Done
|
||||
),
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = { mqttInput = mqttInput.copy { root = it } })
|
||||
onValueChanged = { mqttInput = mqttInput.copy { root = it } }
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "Proxy to client enabled",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.proxy_to_client_enabled),
|
||||
checked = mqttInput.proxyToClientEnabled,
|
||||
enabled = enabled,
|
||||
onCheckedChange = { mqttInput = mqttInput.copy { proxyToClientEnabled = it } })
|
||||
onCheckedChange = { mqttInput = mqttInput.copy { proxyToClientEnabled = it } }
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
PositionPrecisionPreference(
|
||||
title = "Map reporting",
|
||||
title = stringResource(R.string.map_reporting),
|
||||
enabled = enabled,
|
||||
value = mqttInput.mapReportSettings.positionPrecision,
|
||||
onValueChanged = {
|
||||
|
|
@ -190,7 +210,8 @@ fun MQTTConfigItemList(
|
|||
item { Divider() }
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "Map reporting interval (seconds)",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.map_reporting_interval_seconds),
|
||||
value = mqttInput.mapReportSettings.publishIntervalSecs,
|
||||
enabled = enabled && mqttInput.mapReportingEnabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
|
|
|
|||
|
|
@ -77,31 +77,35 @@ fun NeighborInfoConfigItemList(
|
|||
LazyColumn(
|
||||
modifier = Modifier.fillMaxSize()
|
||||
) {
|
||||
item { PreferenceCategory(text = "Neighbor Info Config") }
|
||||
item { PreferenceCategory(text = stringResource(R.string.neighbor_info_config)) }
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "Neighbor Info enabled",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.neighbor_info_enabled),
|
||||
checked = neighborInfoInput.enabled,
|
||||
enabled = enabled,
|
||||
onCheckedChange = {
|
||||
neighborInfoInput = neighborInfoInput.copy { this.enabled = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "Update interval (seconds)",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.update_interval_seconds),
|
||||
value = neighborInfoInput.updateInterval,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = {
|
||||
neighborInfoInput = neighborInfoInput.copy { updateInterval = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
SwitchPreference(
|
||||
title = "Transmit over LoRa",
|
||||
title = stringResource(R.string.transmit_over_lora),
|
||||
summary = stringResource(id = R.string.config_device_transmitOverLora_summary),
|
||||
checked = neighborInfoInput.transmitOverLora,
|
||||
enabled = enabled,
|
||||
|
|
|
|||
|
|
@ -117,7 +117,10 @@ fun NetworkConfigItemList(
|
|||
if (result.contents != null) {
|
||||
val (ssid, psk) = extractWifiCredentials(result.contents)
|
||||
if (ssid != null && psk != null) {
|
||||
networkInput = networkInput.copy { wifiSsid = ssid; wifiPsk = psk }
|
||||
networkInput = networkInput.copy {
|
||||
wifiSsid = ssid
|
||||
wifiPsk = psk
|
||||
}
|
||||
} else {
|
||||
showScanErrorDialog = true
|
||||
}
|
||||
|
|
@ -137,18 +140,21 @@ fun NetworkConfigItemList(
|
|||
LazyColumn(
|
||||
modifier = Modifier.fillMaxSize()
|
||||
) {
|
||||
item { PreferenceCategory(text = "Network Config") }
|
||||
item { PreferenceCategory(text = stringResource(R.string.network_config)) }
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "WiFi enabled",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.wifi_enabled),
|
||||
checked = networkInput.wifiEnabled,
|
||||
enabled = enabled && hasWifi,
|
||||
onCheckedChange = { networkInput = networkInput.copy { wifiEnabled = it } })
|
||||
onCheckedChange = { networkInput = networkInput.copy { wifiEnabled = it } }
|
||||
)
|
||||
Divider()
|
||||
}
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "SSID",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.ssid),
|
||||
value = networkInput.wifiSsid,
|
||||
maxSize = 32, // wifi_ssid max_size:33
|
||||
enabled = enabled && hasWifi,
|
||||
|
|
@ -159,16 +165,19 @@ fun NetworkConfigItemList(
|
|||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = {
|
||||
networkInput = networkInput.copy { wifiSsid = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
EditPasswordPreference(title = "PSK",
|
||||
EditPasswordPreference(
|
||||
title = stringResource(R.string.psk),
|
||||
value = networkInput.wifiPsk,
|
||||
maxSize = 64, // wifi_psk max_size:65
|
||||
enabled = enabled && hasWifi,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = { networkInput = networkInput.copy { wifiPsk = it } })
|
||||
onValueChanged = { networkInput = networkInput.copy { wifiPsk = it } }
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
|
|
@ -185,15 +194,18 @@ fun NetworkConfigItemList(
|
|||
}
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "Ethernet enabled",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.ethernet_enabled),
|
||||
checked = networkInput.ethEnabled,
|
||||
enabled = enabled && hasEthernet,
|
||||
onCheckedChange = { networkInput = networkInput.copy { ethEnabled = it } })
|
||||
onCheckedChange = { networkInput = networkInput.copy { ethEnabled = it } }
|
||||
)
|
||||
Divider()
|
||||
}
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "NTP server",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.ntp_server),
|
||||
value = networkInput.ntpServer,
|
||||
maxSize = 32, // ntp_server max_size:33
|
||||
enabled = enabled,
|
||||
|
|
@ -204,11 +216,13 @@ fun NetworkConfigItemList(
|
|||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = {
|
||||
networkInput = networkInput.copy { ntpServer = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "rsyslog server",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.rsyslog_server),
|
||||
value = networkInput.rsyslogServer,
|
||||
maxSize = 32, // rsyslog_server max_size:33
|
||||
enabled = enabled,
|
||||
|
|
@ -219,62 +233,73 @@ fun NetworkConfigItemList(
|
|||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = {
|
||||
networkInput = networkInput.copy { rsyslogServer = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
DropDownPreference(title = "IPv4 mode",
|
||||
DropDownPreference(
|
||||
title = stringResource(R.string.ipv4_mode),
|
||||
enabled = enabled,
|
||||
items = NetworkConfig.AddressMode.entries
|
||||
.filter { it != NetworkConfig.AddressMode.UNRECOGNIZED }
|
||||
.map { it to it.name },
|
||||
selectedItem = networkInput.addressMode,
|
||||
onItemSelected = { networkInput = networkInput.copy { addressMode = it } })
|
||||
onItemSelected = { networkInput = networkInput.copy { addressMode = it } }
|
||||
)
|
||||
Divider()
|
||||
}
|
||||
|
||||
item {
|
||||
EditIPv4Preference(title = "IP",
|
||||
EditIPv4Preference(
|
||||
title = stringResource(R.string.ip),
|
||||
value = networkInput.ipv4Config.ip,
|
||||
enabled = enabled && networkInput.addressMode == NetworkConfig.AddressMode.STATIC,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = {
|
||||
val ipv4 = networkInput.ipv4Config.copy { ip = it }
|
||||
networkInput = networkInput.copy { ipv4Config = ipv4 }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
EditIPv4Preference(title = "Gateway",
|
||||
EditIPv4Preference(
|
||||
title = stringResource(R.string.gateway),
|
||||
value = networkInput.ipv4Config.gateway,
|
||||
enabled = enabled && networkInput.addressMode == NetworkConfig.AddressMode.STATIC,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = {
|
||||
val ipv4 = networkInput.ipv4Config.copy { gateway = it }
|
||||
networkInput = networkInput.copy { ipv4Config = ipv4 }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
EditIPv4Preference(title = "Subnet",
|
||||
EditIPv4Preference(
|
||||
title = stringResource(R.string.subnet),
|
||||
value = networkInput.ipv4Config.subnet,
|
||||
enabled = enabled && networkInput.addressMode == NetworkConfig.AddressMode.STATIC,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = {
|
||||
val ipv4 = networkInput.ipv4Config.copy { subnet = it }
|
||||
networkInput = networkInput.copy { ipv4Config = ipv4 }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
EditIPv4Preference(title = "DNS",
|
||||
EditIPv4Preference(
|
||||
title = "DNS",
|
||||
value = networkInput.ipv4Config.dns,
|
||||
enabled = enabled && networkInput.addressMode == NetworkConfig.AddressMode.STATIC,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = {
|
||||
val ipv4 = networkInput.ipv4Config.copy { dns = it }
|
||||
networkInput = networkInput.copy { ipv4Config = ipv4 }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
if (hasEthernet || hasWifi) {
|
||||
|
|
@ -292,7 +317,8 @@ fun NetworkConfigItemList(
|
|||
networkInput.copy {
|
||||
if (it) enabledProtocols = 1 else enabledProtocols = 0
|
||||
}
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
item { Divider() }
|
||||
|
|
|
|||
|
|
@ -28,10 +28,12 @@ import androidx.compose.runtime.saveable.rememberSaveable
|
|||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalFocusManager
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.hilt.navigation.compose.hiltViewModel
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import com.geeksville.mesh.ModuleConfigProtos
|
||||
import com.geeksville.mesh.R
|
||||
import com.geeksville.mesh.copy
|
||||
import com.geeksville.mesh.moduleConfig
|
||||
import com.geeksville.mesh.ui.components.EditTextPreference
|
||||
|
|
@ -63,6 +65,7 @@ fun PaxcounterConfigScreen(
|
|||
)
|
||||
}
|
||||
|
||||
@Suppress("LongMethod")
|
||||
@Composable
|
||||
fun PaxcounterConfigItemList(
|
||||
paxcounterConfig: ModuleConfigProtos.ModuleConfig.PaxcounterConfig,
|
||||
|
|
@ -75,46 +78,54 @@ fun PaxcounterConfigItemList(
|
|||
LazyColumn(
|
||||
modifier = Modifier.fillMaxSize()
|
||||
) {
|
||||
item { PreferenceCategory(text = "Paxcounter Config") }
|
||||
item { PreferenceCategory(text = stringResource(R.string.paxcounter_config)) }
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "Paxcounter enabled",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.paxcounter_enabled),
|
||||
checked = paxcounterInput.enabled,
|
||||
enabled = enabled,
|
||||
onCheckedChange = {
|
||||
paxcounterInput = paxcounterInput.copy { this.enabled = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "Update interval (seconds)",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.update_interval_seconds),
|
||||
value = paxcounterInput.paxcounterUpdateInterval,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = {
|
||||
paxcounterInput = paxcounterInput.copy { paxcounterUpdateInterval = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "WiFi RSSI threshold (defaults to -80)",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.wifi_rssi_threshold_defaults_to_80),
|
||||
value = paxcounterInput.wifiThreshold,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = {
|
||||
paxcounterInput = paxcounterInput.copy { wifiThreshold = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "BLE RSSI threshold (defaults to -80)",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.ble_rssi_threshold_defaults_to_80),
|
||||
value = paxcounterInput.bleThreshold,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = {
|
||||
paxcounterInput = paxcounterInput.copy { bleThreshold = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
|
|
|
|||
|
|
@ -28,12 +28,14 @@ import androidx.compose.runtime.saveable.rememberSaveable
|
|||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalFocusManager
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.hilt.navigation.compose.hiltViewModel
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import com.geeksville.mesh.ConfigProtos
|
||||
import com.geeksville.mesh.ConfigProtos.Config.PositionConfig
|
||||
import com.geeksville.mesh.Position
|
||||
import com.geeksville.mesh.R
|
||||
import com.geeksville.mesh.config
|
||||
import com.geeksville.mesh.copy
|
||||
import com.geeksville.mesh.ui.components.BitwisePreference
|
||||
|
|
@ -101,61 +103,72 @@ fun PositionConfigItemList(
|
|||
LazyColumn(
|
||||
modifier = Modifier.fillMaxSize()
|
||||
) {
|
||||
item { PreferenceCategory(text = "Position Config") }
|
||||
item { PreferenceCategory(text = stringResource(R.string.position_config)) }
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "Position broadcast interval (seconds)",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.position_broadcast_interval_seconds),
|
||||
value = positionInput.positionBroadcastSecs,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = {
|
||||
positionInput = positionInput.copy { positionBroadcastSecs = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "Smart position enabled",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.smart_position_enabled),
|
||||
checked = positionInput.positionBroadcastSmartEnabled,
|
||||
enabled = enabled,
|
||||
onCheckedChange = {
|
||||
positionInput = positionInput.copy { positionBroadcastSmartEnabled = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
if (positionInput.positionBroadcastSmartEnabled) {
|
||||
item {
|
||||
EditTextPreference(title = "Smart broadcast minimum distance (meters)",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.smart_broadcast_minimum_distance_meters),
|
||||
value = positionInput.broadcastSmartMinimumDistance,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = {
|
||||
positionInput = positionInput.copy { broadcastSmartMinimumDistance = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "Smart broadcast minimum interval (seconds)",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.smart_broadcast_minimum_interval_seconds),
|
||||
value = positionInput.broadcastSmartMinimumIntervalSecs,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = {
|
||||
positionInput = positionInput.copy { broadcastSmartMinimumIntervalSecs = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "Use fixed position",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.use_fixed_position),
|
||||
checked = positionInput.fixedPosition,
|
||||
enabled = enabled,
|
||||
onCheckedChange = { positionInput = positionInput.copy { fixedPosition = it } })
|
||||
onCheckedChange = { positionInput = positionInput.copy { fixedPosition = it } }
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
if (positionInput.fixedPosition) {
|
||||
item {
|
||||
EditTextPreference(title = "Latitude",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.latitude),
|
||||
value = locationInput.latitude,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
|
|
@ -163,10 +176,12 @@ fun PositionConfigItemList(
|
|||
if (value >= -90 && value <= 90.0) {
|
||||
locationInput = locationInput.copy(latitude = value)
|
||||
}
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
item {
|
||||
EditTextPreference(title = "Longitude",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.longitude),
|
||||
value = locationInput.longitude,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
|
|
@ -174,40 +189,48 @@ fun PositionConfigItemList(
|
|||
if (value >= -180 && value <= 180.0) {
|
||||
locationInput = locationInput.copy(longitude = value)
|
||||
}
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
item {
|
||||
EditTextPreference(title = "Altitude (meters)",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.altitude_meters),
|
||||
value = locationInput.altitude,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = { value ->
|
||||
locationInput = locationInput.copy(altitude = value)
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
item {
|
||||
DropDownPreference(title = "GPS mode",
|
||||
DropDownPreference(
|
||||
title = stringResource(R.string.gps_mode),
|
||||
enabled = enabled,
|
||||
items = ConfigProtos.Config.PositionConfig.GpsMode.entries
|
||||
.filter { it != ConfigProtos.Config.PositionConfig.GpsMode.UNRECOGNIZED }
|
||||
.map { it to it.name },
|
||||
selectedItem = positionInput.gpsMode,
|
||||
onItemSelected = { positionInput = positionInput.copy { gpsMode = it } })
|
||||
onItemSelected = { positionInput = positionInput.copy { gpsMode = it } }
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "GPS update interval (seconds)",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.gps_update_interval_seconds),
|
||||
value = positionInput.gpsUpdateInterval,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = { positionInput = positionInput.copy { gpsUpdateInterval = it } })
|
||||
onValueChanged = { positionInput = positionInput.copy { gpsUpdateInterval = it } }
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
BitwisePreference(title = "Position flags",
|
||||
BitwisePreference(
|
||||
title = stringResource(R.string.position_flags),
|
||||
value = positionInput.positionFlags,
|
||||
enabled = enabled,
|
||||
items = ConfigProtos.Config.PositionConfig.PositionFlags.entries
|
||||
|
|
@ -219,27 +242,33 @@ fun PositionConfigItemList(
|
|||
item { Divider() }
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "Redefine GPS_RX_PIN",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.redefine_gps_rx_pin),
|
||||
value = positionInput.rxGpio,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = { positionInput = positionInput.copy { rxGpio = it } })
|
||||
onValueChanged = { positionInput = positionInput.copy { rxGpio = it } }
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "Redefine GPS_TX_PIN",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.redefine_gps_tx_pin),
|
||||
value = positionInput.txGpio,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = { positionInput = positionInput.copy { txGpio = it } })
|
||||
onValueChanged = { positionInput = positionInput.copy { txGpio = it } }
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "Redefine PIN_GPS_EN",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.redefine_pin_gps_en),
|
||||
value = positionInput.gpsEnGpio,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = { positionInput = positionInput.copy { gpsEnGpio = it } })
|
||||
onValueChanged = { positionInput = positionInput.copy { gpsEnGpio = it } }
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
|
|
|
|||
|
|
@ -28,10 +28,12 @@ import androidx.compose.runtime.saveable.rememberSaveable
|
|||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalFocusManager
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.hilt.navigation.compose.hiltViewModel
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import com.geeksville.mesh.ConfigProtos.Config.PowerConfig
|
||||
import com.geeksville.mesh.R
|
||||
import com.geeksville.mesh.config
|
||||
import com.geeksville.mesh.copy
|
||||
import com.geeksville.mesh.ui.components.EditTextPreference
|
||||
|
|
@ -75,72 +77,88 @@ fun PowerConfigItemList(
|
|||
LazyColumn(
|
||||
modifier = Modifier.fillMaxSize()
|
||||
) {
|
||||
item { PreferenceCategory(text = "Power Config") }
|
||||
item { PreferenceCategory(text = stringResource(R.string.power_config)) }
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "Enable power saving mode",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.enable_power_saving_mode),
|
||||
checked = powerInput.isPowerSaving,
|
||||
enabled = enabled,
|
||||
onCheckedChange = { powerInput = powerInput.copy { isPowerSaving = it } })
|
||||
onCheckedChange = { powerInput = powerInput.copy { isPowerSaving = it } }
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "Shutdown on battery delay (seconds)",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.shutdown_on_battery_delay_seconds),
|
||||
value = powerInput.onBatteryShutdownAfterSecs,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = {
|
||||
powerInput = powerInput.copy { onBatteryShutdownAfterSecs = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "ADC multiplier override ratio",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.adc_multiplier_override_ratio),
|
||||
value = powerInput.adcMultiplierOverride,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = { powerInput = powerInput.copy { adcMultiplierOverride = it } })
|
||||
onValueChanged = { powerInput = powerInput.copy { adcMultiplierOverride = it } }
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "Wait for Bluetooth duration (seconds)",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.wait_for_bluetooth_duration_seconds),
|
||||
value = powerInput.waitBluetoothSecs,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = { powerInput = powerInput.copy { waitBluetoothSecs = it } })
|
||||
onValueChanged = { powerInput = powerInput.copy { waitBluetoothSecs = it } }
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "Super deep sleep duration (seconds)",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.super_deep_sleep_duration_seconds),
|
||||
value = powerInput.sdsSecs,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = { powerInput = powerInput.copy { sdsSecs = it } })
|
||||
onValueChanged = { powerInput = powerInput.copy { sdsSecs = it } }
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "Light sleep duration (seconds)",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.light_sleep_duration_seconds),
|
||||
value = powerInput.lsSecs,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = { powerInput = powerInput.copy { lsSecs = it } })
|
||||
onValueChanged = { powerInput = powerInput.copy { lsSecs = it } }
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "Minimum wake time (seconds)",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.minimum_wake_time_seconds),
|
||||
value = powerInput.minWakeSecs,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = { powerInput = powerInput.copy { minWakeSecs = it } })
|
||||
onValueChanged = { powerInput = powerInput.copy { minWakeSecs = it } }
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "Battery INA_2XX I2C address",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.battery_ina_2xx_i2c_address),
|
||||
value = powerInput.deviceBatteryInaAddress,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = { powerInput = powerInput.copy { deviceBatteryInaAddress = it } })
|
||||
onValueChanged = { powerInput = powerInput.copy { deviceBatteryInaAddress = it } }
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
|
|
|
|||
|
|
@ -28,10 +28,12 @@ import androidx.compose.runtime.saveable.rememberSaveable
|
|||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalFocusManager
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.hilt.navigation.compose.hiltViewModel
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import com.geeksville.mesh.ModuleConfigProtos.ModuleConfig.RangeTestConfig
|
||||
import com.geeksville.mesh.R
|
||||
import com.geeksville.mesh.copy
|
||||
import com.geeksville.mesh.moduleConfig
|
||||
import com.geeksville.mesh.ui.components.EditTextPreference
|
||||
|
|
@ -75,29 +77,35 @@ fun RangeTestConfigItemList(
|
|||
LazyColumn(
|
||||
modifier = Modifier.fillMaxSize()
|
||||
) {
|
||||
item { PreferenceCategory(text = "Range Test Config") }
|
||||
item { PreferenceCategory(text = stringResource(R.string.range_test_config)) }
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "Range test enabled",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.range_test_enabled),
|
||||
checked = rangeTestInput.enabled,
|
||||
enabled = enabled,
|
||||
onCheckedChange = { rangeTestInput = rangeTestInput.copy { this.enabled = it } })
|
||||
onCheckedChange = { rangeTestInput = rangeTestInput.copy { this.enabled = it } }
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "Sender message interval (seconds)",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.sender_message_interval_seconds),
|
||||
value = rangeTestInput.sender,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = { rangeTestInput = rangeTestInput.copy { sender = it } })
|
||||
onValueChanged = { rangeTestInput = rangeTestInput.copy { sender = it } }
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "Save .CSV in storage (ESP32 only)",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.save_csv_in_storage_esp32_only),
|
||||
checked = rangeTestInput.save,
|
||||
enabled = enabled,
|
||||
onCheckedChange = { rangeTestInput = rangeTestInput.copy { save = it } })
|
||||
onCheckedChange = { rangeTestInput = rangeTestInput.copy { save = it } }
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
|
|
|
|||
|
|
@ -28,10 +28,12 @@ import androidx.compose.runtime.saveable.rememberSaveable
|
|||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalFocusManager
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.hilt.navigation.compose.hiltViewModel
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import com.geeksville.mesh.ModuleConfigProtos.ModuleConfig.RemoteHardwareConfig
|
||||
import com.geeksville.mesh.R
|
||||
import com.geeksville.mesh.copy
|
||||
import com.geeksville.mesh.moduleConfig
|
||||
import com.geeksville.mesh.ui.components.EditListPreference
|
||||
|
|
@ -75,30 +77,35 @@ fun RemoteHardwareConfigItemList(
|
|||
LazyColumn(
|
||||
modifier = Modifier.fillMaxSize()
|
||||
) {
|
||||
item { PreferenceCategory(text = "Remote Hardware Config") }
|
||||
item { PreferenceCategory(text = stringResource(R.string.remote_hardware_config)) }
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "Remote Hardware enabled",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.remote_hardware_enabled),
|
||||
checked = remoteHardwareInput.enabled,
|
||||
enabled = enabled,
|
||||
onCheckedChange = {
|
||||
remoteHardwareInput = remoteHardwareInput.copy { this.enabled = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "Allow undefined pin access",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.allow_undefined_pin_access),
|
||||
checked = remoteHardwareInput.allowUndefinedPinAccess,
|
||||
enabled = enabled,
|
||||
onCheckedChange = {
|
||||
remoteHardwareInput = remoteHardwareInput.copy { allowUndefinedPinAccess = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
EditListPreference(title = "Available pins",
|
||||
EditListPreference(
|
||||
title = stringResource(R.string.available_pins),
|
||||
list = remoteHardwareInput.availablePinsList,
|
||||
maxCount = 4, // available_pins max_count:4
|
||||
enabled = enabled,
|
||||
|
|
@ -108,7 +115,8 @@ fun RemoteHardwareConfigItemList(
|
|||
availablePins.clear()
|
||||
availablePins.addAll(list)
|
||||
}
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
|
|
|
|||
|
|
@ -28,10 +28,12 @@ import androidx.compose.runtime.saveable.rememberSaveable
|
|||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalFocusManager
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.hilt.navigation.compose.hiltViewModel
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import com.geeksville.mesh.ConfigProtos.Config.SecurityConfig
|
||||
import com.geeksville.mesh.R
|
||||
import com.geeksville.mesh.config
|
||||
import com.geeksville.mesh.copy
|
||||
import com.geeksville.mesh.ui.components.CopyIconButton
|
||||
|
|
@ -79,11 +81,11 @@ fun SecurityConfigItemList(
|
|||
LazyColumn(
|
||||
modifier = Modifier.fillMaxSize()
|
||||
) {
|
||||
item { PreferenceCategory(text = "Security Config") }
|
||||
item { PreferenceCategory(text = stringResource(R.string.security_config)) }
|
||||
|
||||
item {
|
||||
EditBase64Preference(
|
||||
title = "Public Key",
|
||||
title = stringResource(R.string.public_key),
|
||||
value = securityInput.publicKey,
|
||||
enabled = enabled,
|
||||
readOnly = true,
|
||||
|
|
@ -103,7 +105,7 @@ fun SecurityConfigItemList(
|
|||
|
||||
item {
|
||||
EditBase64Preference(
|
||||
title = "Private Key",
|
||||
title = stringResource(R.string.private_key),
|
||||
value = securityInput.privateKey,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
|
|
@ -122,7 +124,7 @@ fun SecurityConfigItemList(
|
|||
|
||||
item {
|
||||
EditListPreference(
|
||||
title = "Admin Key",
|
||||
title = stringResource(R.string.admin_key),
|
||||
list = securityInput.adminKeyList,
|
||||
maxCount = 3,
|
||||
enabled = enabled,
|
||||
|
|
@ -137,40 +139,48 @@ fun SecurityConfigItemList(
|
|||
}
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "Managed Mode",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.managed_mode),
|
||||
checked = securityInput.isManaged,
|
||||
enabled = enabled && securityInput.adminKeyCount > 0,
|
||||
onCheckedChange = {
|
||||
securityInput = securityInput.copy { isManaged = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "Serial console",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.serial_console),
|
||||
checked = securityInput.serialEnabled,
|
||||
enabled = enabled,
|
||||
onCheckedChange = { securityInput = securityInput.copy { serialEnabled = it } })
|
||||
onCheckedChange = { securityInput = securityInput.copy { serialEnabled = it } }
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "Debug log API enabled",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.debug_log_api_enabled),
|
||||
checked = securityInput.debugLogApiEnabled,
|
||||
enabled = enabled,
|
||||
onCheckedChange = {
|
||||
securityInput = securityInput.copy { debugLogApiEnabled = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "Legacy Admin channel",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.legacy_admin_channel),
|
||||
checked = securityInput.adminChannelEnabled,
|
||||
enabled = enabled,
|
||||
onCheckedChange = {
|
||||
securityInput = securityInput.copy { adminChannelEnabled = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
|
|
|
|||
|
|
@ -28,10 +28,12 @@ import androidx.compose.runtime.saveable.rememberSaveable
|
|||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalFocusManager
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.hilt.navigation.compose.hiltViewModel
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import com.geeksville.mesh.ModuleConfigProtos.ModuleConfig.SerialConfig
|
||||
import com.geeksville.mesh.R
|
||||
import com.geeksville.mesh.copy
|
||||
import com.geeksville.mesh.moduleConfig
|
||||
import com.geeksville.mesh.ui.components.DropDownPreference
|
||||
|
|
@ -76,77 +78,93 @@ fun SerialConfigItemList(
|
|||
LazyColumn(
|
||||
modifier = Modifier.fillMaxSize()
|
||||
) {
|
||||
item { PreferenceCategory(text = "Serial Config") }
|
||||
item { PreferenceCategory(text = stringResource(R.string.serial_config)) }
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "Serial enabled",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.serial_enabled),
|
||||
checked = serialInput.enabled,
|
||||
enabled = enabled,
|
||||
onCheckedChange = { serialInput = serialInput.copy { this.enabled = it } })
|
||||
onCheckedChange = { serialInput = serialInput.copy { this.enabled = it } }
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "Echo enabled",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.echo_enabled),
|
||||
checked = serialInput.echo,
|
||||
enabled = enabled,
|
||||
onCheckedChange = { serialInput = serialInput.copy { echo = it } })
|
||||
onCheckedChange = { serialInput = serialInput.copy { echo = it } }
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "RX",
|
||||
EditTextPreference(
|
||||
title = "RX",
|
||||
value = serialInput.rxd,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = { serialInput = serialInput.copy { rxd = it } })
|
||||
onValueChanged = { serialInput = serialInput.copy { rxd = it } }
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "TX",
|
||||
EditTextPreference(
|
||||
title = "TX",
|
||||
value = serialInput.txd,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = { serialInput = serialInput.copy { txd = it } })
|
||||
onValueChanged = { serialInput = serialInput.copy { txd = it } }
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
DropDownPreference(title = "Serial baud rate",
|
||||
DropDownPreference(
|
||||
title = stringResource(R.string.serial_baud_rate),
|
||||
enabled = enabled,
|
||||
items = SerialConfig.Serial_Baud.entries
|
||||
.filter { it != SerialConfig.Serial_Baud.UNRECOGNIZED }
|
||||
.map { it to it.name },
|
||||
selectedItem = serialInput.baud,
|
||||
onItemSelected = { serialInput = serialInput.copy { baud = it } })
|
||||
onItemSelected = { serialInput = serialInput.copy { baud = it } }
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "Timeout",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.timeout),
|
||||
value = serialInput.timeout,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = { serialInput = serialInput.copy { timeout = it } })
|
||||
onValueChanged = { serialInput = serialInput.copy { timeout = it } }
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
DropDownPreference(title = "Serial mode",
|
||||
DropDownPreference(
|
||||
title = stringResource(R.string.serial_mode),
|
||||
enabled = enabled,
|
||||
items = SerialConfig.Serial_Mode.entries
|
||||
.filter { it != SerialConfig.Serial_Mode.UNRECOGNIZED }
|
||||
.map { it to it.name },
|
||||
selectedItem = serialInput.mode,
|
||||
onItemSelected = { serialInput = serialInput.copy { mode = it } })
|
||||
onItemSelected = { serialInput = serialInput.copy { mode = it } }
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "Override console serial port",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.override_console_serial_port),
|
||||
checked = serialInput.overrideConsoleSerialPort,
|
||||
enabled = enabled,
|
||||
onCheckedChange = {
|
||||
serialInput = serialInput.copy { overrideConsoleSerialPort = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
|
|
|
|||
|
|
@ -28,10 +28,12 @@ import androidx.compose.runtime.saveable.rememberSaveable
|
|||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalFocusManager
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.hilt.navigation.compose.hiltViewModel
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import com.geeksville.mesh.ModuleConfigProtos.ModuleConfig.StoreForwardConfig
|
||||
import com.geeksville.mesh.R
|
||||
import com.geeksville.mesh.copy
|
||||
import com.geeksville.mesh.moduleConfig
|
||||
import com.geeksville.mesh.ui.components.EditTextPreference
|
||||
|
|
@ -78,57 +80,68 @@ fun StoreForwardConfigItemList(
|
|||
item { PreferenceCategory(text = "Store & Forward Config") }
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "Store & Forward enabled",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.store_forward_enabled),
|
||||
checked = storeForwardInput.enabled,
|
||||
enabled = enabled,
|
||||
onCheckedChange = {
|
||||
storeForwardInput = storeForwardInput.copy { this.enabled = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "Heartbeat",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.heartbeat),
|
||||
checked = storeForwardInput.heartbeat,
|
||||
enabled = enabled,
|
||||
onCheckedChange = { storeForwardInput = storeForwardInput.copy { heartbeat = it } })
|
||||
onCheckedChange = { storeForwardInput = storeForwardInput.copy { heartbeat = it } }
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "Number of records",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.number_of_records),
|
||||
value = storeForwardInput.records,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = { storeForwardInput = storeForwardInput.copy { records = it } })
|
||||
onValueChanged = { storeForwardInput = storeForwardInput.copy { records = it } }
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "History return max",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.history_return_max),
|
||||
value = storeForwardInput.historyReturnMax,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = {
|
||||
storeForwardInput = storeForwardInput.copy { historyReturnMax = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "History return window",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.history_return_window),
|
||||
value = storeForwardInput.historyReturnWindow,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = {
|
||||
storeForwardInput = storeForwardInput.copy { historyReturnWindow = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
SwitchPreference(
|
||||
title = "Server",
|
||||
title = stringResource(R.string.server),
|
||||
checked = storeForwardInput.isServer,
|
||||
enabled = enabled,
|
||||
onCheckedChange = { storeForwardInput = storeForwardInput.copy { isServer = it } })
|
||||
onCheckedChange = { storeForwardInput = storeForwardInput.copy { isServer = it } }
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
|
|
|
|||
|
|
@ -28,10 +28,12 @@ import androidx.compose.runtime.saveable.rememberSaveable
|
|||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalFocusManager
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.hilt.navigation.compose.hiltViewModel
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import com.geeksville.mesh.ModuleConfigProtos.ModuleConfig.TelemetryConfig
|
||||
import com.geeksville.mesh.R
|
||||
import com.geeksville.mesh.copy
|
||||
import com.geeksville.mesh.moduleConfig
|
||||
import com.geeksville.mesh.ui.components.EditTextPreference
|
||||
|
|
@ -75,105 +77,125 @@ fun TelemetryConfigItemList(
|
|||
LazyColumn(
|
||||
modifier = Modifier.fillMaxSize()
|
||||
) {
|
||||
item { PreferenceCategory(text = "Telemetry Config") }
|
||||
item { PreferenceCategory(text = stringResource(R.string.telemetry_config)) }
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "Device metrics update interval (seconds)",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.device_metrics_update_interval_seconds),
|
||||
value = telemetryInput.deviceUpdateInterval,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = {
|
||||
telemetryInput = telemetryInput.copy { deviceUpdateInterval = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "Environment metrics update interval (seconds)",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.environment_metrics_update_interval_seconds),
|
||||
value = telemetryInput.environmentUpdateInterval,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = {
|
||||
telemetryInput = telemetryInput.copy { environmentUpdateInterval = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "Environment metrics module enabled",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.environment_metrics_module_enabled),
|
||||
checked = telemetryInput.environmentMeasurementEnabled,
|
||||
enabled = enabled,
|
||||
onCheckedChange = {
|
||||
telemetryInput = telemetryInput.copy { environmentMeasurementEnabled = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "Environment metrics on-screen enabled",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.environment_metrics_on_screen_enabled),
|
||||
checked = telemetryInput.environmentScreenEnabled,
|
||||
enabled = enabled,
|
||||
onCheckedChange = {
|
||||
telemetryInput = telemetryInput.copy { environmentScreenEnabled = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "Environment metrics use Fahrenheit",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.environment_metrics_use_fahrenheit),
|
||||
checked = telemetryInput.environmentDisplayFahrenheit,
|
||||
enabled = enabled,
|
||||
onCheckedChange = {
|
||||
telemetryInput = telemetryInput.copy { environmentDisplayFahrenheit = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "Air quality metrics module enabled",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.air_quality_metrics_module_enabled),
|
||||
checked = telemetryInput.airQualityEnabled,
|
||||
enabled = enabled,
|
||||
onCheckedChange = {
|
||||
telemetryInput = telemetryInput.copy { airQualityEnabled = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "Air quality metrics update interval (seconds)",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.air_quality_metrics_update_interval_seconds),
|
||||
value = telemetryInput.airQualityInterval,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = {
|
||||
telemetryInput = telemetryInput.copy { airQualityInterval = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "Power metrics module enabled",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.power_metrics_module_enabled),
|
||||
checked = telemetryInput.powerMeasurementEnabled,
|
||||
enabled = enabled,
|
||||
onCheckedChange = {
|
||||
telemetryInput = telemetryInput.copy { powerMeasurementEnabled = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "Power metrics update interval (seconds)",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.power_metrics_update_interval_seconds),
|
||||
value = telemetryInput.powerUpdateInterval,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = {
|
||||
telemetryInput = telemetryInput.copy { powerUpdateInterval = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "Power metrics on-screen enabled",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.power_metrics_on_screen_enabled),
|
||||
checked = telemetryInput.powerScreenEnabled,
|
||||
enabled = enabled,
|
||||
onCheckedChange = {
|
||||
telemetryInput = telemetryInput.copy { powerScreenEnabled = it }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
|
|
|
|||
|
|
@ -29,12 +29,14 @@ import androidx.compose.runtime.saveable.rememberSaveable
|
|||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalFocusManager
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.input.ImeAction
|
||||
import androidx.compose.ui.text.input.KeyboardType
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.hilt.navigation.compose.hiltViewModel
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import com.geeksville.mesh.MeshProtos
|
||||
import com.geeksville.mesh.R
|
||||
import com.geeksville.mesh.copy
|
||||
import com.geeksville.mesh.model.getInitials
|
||||
import com.geeksville.mesh.ui.components.EditTextPreference
|
||||
|
|
@ -77,17 +79,20 @@ fun UserConfigItemList(
|
|||
LazyColumn(
|
||||
modifier = Modifier.fillMaxSize()
|
||||
) {
|
||||
item { PreferenceCategory(text = "User Config") }
|
||||
item { PreferenceCategory(text = stringResource(R.string.user_config)) }
|
||||
|
||||
item {
|
||||
RegularPreference(title = "Node ID",
|
||||
RegularPreference(
|
||||
title = stringResource(R.string.node_id),
|
||||
subtitle = userInput.id,
|
||||
onClick = {})
|
||||
onClick = {}
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "Long name",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.long_name),
|
||||
value = userInput.longName,
|
||||
maxSize = 39, // long_name max_size:40
|
||||
enabled = enabled,
|
||||
|
|
@ -101,11 +106,13 @@ fun UserConfigItemList(
|
|||
if (getInitials(it).toByteArray().size <= 4) { // short_name max_size:5
|
||||
userInput = userInput.copy { shortName = getInitials(it) }
|
||||
}
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
EditTextPreference(title = "Short name",
|
||||
EditTextPreference(
|
||||
title = stringResource(R.string.short_name),
|
||||
value = userInput.shortName,
|
||||
maxSize = 4, // short_name max_size:5
|
||||
enabled = enabled,
|
||||
|
|
@ -114,21 +121,26 @@ fun UserConfigItemList(
|
|||
keyboardType = KeyboardType.Text, imeAction = ImeAction.Done
|
||||
),
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = { userInput = userInput.copy { shortName = it } })
|
||||
onValueChanged = { userInput = userInput.copy { shortName = it } }
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
RegularPreference(title = "Hardware model",
|
||||
RegularPreference(
|
||||
title = stringResource(R.string.hardware_model),
|
||||
subtitle = userInput.hwModel.name,
|
||||
onClick = {})
|
||||
onClick = {}
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
item {
|
||||
SwitchPreference(title = "Licensed amateur radio",
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.licensed_amateur_radio),
|
||||
checked = userInput.isLicensed,
|
||||
enabled = enabled,
|
||||
onCheckedChange = { userInput = userInput.copy { isLicensed = it } })
|
||||
onCheckedChange = { userInput = userInput.copy { isLicensed = it } }
|
||||
)
|
||||
}
|
||||
item { Divider() }
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue