mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
parent
0b368ce0b1
commit
86905942de
3 changed files with 14 additions and 2 deletions
|
|
@ -85,6 +85,7 @@ fun EditTextPreference(
|
|||
title: String,
|
||||
value: Int,
|
||||
enabled: Boolean,
|
||||
isError: Boolean = false,
|
||||
keyboardActions: KeyboardActions,
|
||||
onValueChanged: (Int) -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
|
|
@ -97,7 +98,7 @@ fun EditTextPreference(
|
|||
title = title,
|
||||
value = valueState,
|
||||
enabled = enabled,
|
||||
isError = value.toUInt().toString() != valueState,
|
||||
isError = value.toUInt().toString() != valueState || isError,
|
||||
keyboardOptions = KeyboardOptions.Default.copy(
|
||||
keyboardType = KeyboardType.Number, imeAction = ImeAction.Done
|
||||
),
|
||||
|
|
|
|||
|
|
@ -233,6 +233,13 @@ fun MQTTConfigItemList(
|
|||
mapReportSettings = settings
|
||||
}
|
||||
},
|
||||
publishIntervalSecs = mqttInput.mapReportSettings.publishIntervalSecs,
|
||||
onPublishIntervalSecsChanged = {
|
||||
val settings = mqttInput.mapReportSettings.copy { publishIntervalSecs = it }
|
||||
mqttInput = mqttInput.copy {
|
||||
mapReportSettings = settings
|
||||
}
|
||||
},
|
||||
enabled = enabled,
|
||||
focusManager = focusManager
|
||||
)
|
||||
|
|
@ -241,7 +248,8 @@ fun MQTTConfigItemList(
|
|||
|
||||
item {
|
||||
val consentValid = if (mqttInput.mapReportingEnabled) {
|
||||
mqttInput.mapReportSettings.shouldReportLocation
|
||||
mqttInput.mapReportSettings.shouldReportLocation &&
|
||||
mqttConfig.mapReportSettings.publishIntervalSecs >= MinIntervalSecs
|
||||
} else {
|
||||
true
|
||||
}
|
||||
|
|
@ -260,6 +268,8 @@ fun MQTTConfigItemList(
|
|||
}
|
||||
}
|
||||
|
||||
private const val MinIntervalSecs = 3600
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
private fun MQTTConfigPreview() {
|
||||
|
|
|
|||
|
|
@ -138,6 +138,7 @@ fun MapReportingPreference(
|
|||
modifier = Modifier.Companion.padding(bottom = 16.dp),
|
||||
title = stringResource(R.string.map_reporting_interval_seconds),
|
||||
value = publishIntervalSecs,
|
||||
isError = publishIntervalSecs < 3600,
|
||||
enabled = enabled,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
onValueChanged = onPublishIntervalSecsChanged,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue