kopia lustrzana https://github.com/meshtastic/Meshtastic-Android
feat: add maxSize field to module configs
rodzic
804d4f0e27
commit
f6bb86ada2
|
@ -63,46 +63,40 @@ fun ModuleSettingsItemList(viewModel: UIViewModel = viewModel()) {
|
||||||
item {
|
item {
|
||||||
EditTextPreference(title = "Address",
|
EditTextPreference(title = "Address",
|
||||||
value = mqttInput.address,
|
value = mqttInput.address,
|
||||||
|
maxSize = 63, // address max_size:64
|
||||||
enabled = connected,
|
enabled = connected,
|
||||||
isError = false,
|
isError = false,
|
||||||
keyboardOptions = KeyboardOptions.Default.copy(
|
keyboardOptions = KeyboardOptions.Default.copy(
|
||||||
keyboardType = KeyboardType.Text, imeAction = ImeAction.Done
|
keyboardType = KeyboardType.Text, imeAction = ImeAction.Done
|
||||||
),
|
),
|
||||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||||
onValueChanged = { value ->
|
onValueChanged = { mqttInput = mqttInput.copy { address = it } })
|
||||||
if (value.toByteArray().size <= 63) // address max_size:64
|
|
||||||
mqttInput = mqttInput.copy { address = value }
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
item {
|
item {
|
||||||
EditTextPreference(title = "Username",
|
EditTextPreference(title = "Username",
|
||||||
value = mqttInput.username,
|
value = mqttInput.username,
|
||||||
|
maxSize = 63, // username max_size:64
|
||||||
enabled = connected,
|
enabled = connected,
|
||||||
isError = false,
|
isError = false,
|
||||||
keyboardOptions = KeyboardOptions.Default.copy(
|
keyboardOptions = KeyboardOptions.Default.copy(
|
||||||
keyboardType = KeyboardType.Text, imeAction = ImeAction.Done
|
keyboardType = KeyboardType.Text, imeAction = ImeAction.Done
|
||||||
),
|
),
|
||||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||||
onValueChanged = { value ->
|
onValueChanged = { mqttInput = mqttInput.copy { username = it } })
|
||||||
if (value.toByteArray().size <= 63) // username max_size:64
|
|
||||||
mqttInput = mqttInput.copy { username = value }
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
item {
|
item {
|
||||||
EditTextPreference(title = "Password",
|
EditTextPreference(title = "Password",
|
||||||
value = mqttInput.password,
|
value = mqttInput.password,
|
||||||
|
maxSize = 63, // password max_size:64
|
||||||
enabled = connected,
|
enabled = connected,
|
||||||
isError = false,
|
isError = false,
|
||||||
keyboardOptions = KeyboardOptions.Default.copy(
|
keyboardOptions = KeyboardOptions.Default.copy(
|
||||||
keyboardType = KeyboardType.Text, imeAction = ImeAction.Done
|
keyboardType = KeyboardType.Text, imeAction = ImeAction.Done
|
||||||
),
|
),
|
||||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||||
onValueChanged = { value ->
|
onValueChanged = { mqttInput = mqttInput.copy { password = it } })
|
||||||
if (value.toByteArray().size <= 63) // password max_size:64
|
|
||||||
mqttInput = mqttInput.copy { password = value }
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
item {
|
item {
|
||||||
|
@ -645,15 +639,15 @@ fun ModuleSettingsItemList(viewModel: UIViewModel = viewModel()) {
|
||||||
item {
|
item {
|
||||||
EditTextPreference(title = "Allow input source",
|
EditTextPreference(title = "Allow input source",
|
||||||
value = cannedMessageInput.allowInputSource,
|
value = cannedMessageInput.allowInputSource,
|
||||||
|
maxSize = 63, // allow_input_source max_size:16
|
||||||
enabled = connected,
|
enabled = connected,
|
||||||
isError = false,
|
isError = false,
|
||||||
keyboardOptions = KeyboardOptions.Default.copy(
|
keyboardOptions = KeyboardOptions.Default.copy(
|
||||||
keyboardType = KeyboardType.Text, imeAction = ImeAction.Done
|
keyboardType = KeyboardType.Text, imeAction = ImeAction.Done
|
||||||
),
|
),
|
||||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||||
onValueChanged = { value ->
|
onValueChanged = {
|
||||||
if (value.toByteArray().size <= 15) // allow_input_source max_size:16
|
cannedMessageInput = cannedMessageInput.copy { allowInputSource = it }
|
||||||
cannedMessageInput = cannedMessageInput.copy { allowInputSource = value }
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue