mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
fix(config): respect enabled parameter for Send button
This commit is contained in:
parent
683b354dd4
commit
5480174ec9
22 changed files with 26 additions and 27 deletions
|
|
@ -106,7 +106,7 @@ fun AmbientLightingConfigItemList(
|
|||
|
||||
item {
|
||||
PreferenceFooter(
|
||||
enabled = ambientLightingInput != ambientLightingConfig,
|
||||
enabled = enabled && ambientLightingInput != ambientLightingConfig,
|
||||
onCancelClicked = {
|
||||
focusManager.clearFocus()
|
||||
ambientLightingInput = ambientLightingConfig
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ fun AudioConfigItemList(
|
|||
|
||||
item {
|
||||
PreferenceFooter(
|
||||
enabled = audioInput != audioConfig,
|
||||
enabled = enabled && audioInput != audioConfig,
|
||||
onCancelClicked = {
|
||||
focusManager.clearFocus()
|
||||
audioInput = audioConfig
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ fun BluetoothConfigItemList(
|
|||
|
||||
item {
|
||||
PreferenceFooter(
|
||||
enabled = bluetoothInput != bluetoothConfig,
|
||||
enabled = enabled && bluetoothInput != bluetoothConfig,
|
||||
onCancelClicked = {
|
||||
focusManager.clearFocus()
|
||||
bluetoothInput = bluetoothConfig
|
||||
|
|
|
|||
|
|
@ -212,7 +212,7 @@ fun CannedMessageConfigItemList(
|
|||
|
||||
item {
|
||||
PreferenceFooter(
|
||||
enabled = cannedMessageInput != cannedMessageConfig || messagesInput != messages,
|
||||
enabled = enabled && cannedMessageInput != cannedMessageConfig || messagesInput != messages,
|
||||
onCancelClicked = {
|
||||
focusManager.clearFocus()
|
||||
messagesInput = messages
|
||||
|
|
|
|||
|
|
@ -251,7 +251,7 @@ fun ChannelSettingsItemList(
|
|||
|
||||
item {
|
||||
PreferenceFooter(
|
||||
enabled = isEditing,
|
||||
enabled = enabled && isEditing,
|
||||
negativeText = R.string.cancel,
|
||||
onNegativeClicked = {
|
||||
focusManager.clearFocus()
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ fun DetectionSensorConfigItemList(
|
|||
|
||||
item {
|
||||
PreferenceFooter(
|
||||
enabled = detectionSensorInput != detectionSensorConfig,
|
||||
enabled = enabled && detectionSensorInput != detectionSensorConfig,
|
||||
onCancelClicked = {
|
||||
focusManager.clearFocus()
|
||||
detectionSensorInput = detectionSensorConfig
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ fun DisplayConfigItemList(
|
|||
|
||||
item {
|
||||
PreferenceFooter(
|
||||
enabled = displayInput != displayConfig,
|
||||
enabled = enabled && displayInput != displayConfig,
|
||||
onCancelClicked = {
|
||||
focusManager.clearFocus()
|
||||
displayInput = displayConfig
|
||||
|
|
|
|||
|
|
@ -244,7 +244,7 @@ fun ExternalNotificationConfigItemList(
|
|||
|
||||
item {
|
||||
PreferenceFooter(
|
||||
enabled = externalNotificationInput != extNotificationConfig || ringtoneInput != ringtone,
|
||||
enabled = enabled && externalNotificationInput != extNotificationConfig || ringtoneInput != ringtone,
|
||||
onCancelClicked = {
|
||||
focusManager.clearFocus()
|
||||
ringtoneInput = ringtone
|
||||
|
|
|
|||
|
|
@ -244,7 +244,7 @@ fun LoRaConfigItemList(
|
|||
|
||||
item {
|
||||
PreferenceFooter(
|
||||
enabled = loraInput != loraConfig,
|
||||
enabled = enabled && loraInput != loraConfig,
|
||||
onCancelClicked = {
|
||||
focusManager.clearFocus()
|
||||
loraInput = loraConfig
|
||||
|
|
|
|||
|
|
@ -186,7 +186,7 @@ fun MQTTConfigItemList(
|
|||
|
||||
item {
|
||||
PreferenceFooter(
|
||||
enabled = mqttInput != mqttConfig,
|
||||
enabled = enabled && mqttInput != mqttConfig,
|
||||
onCancelClicked = {
|
||||
focusManager.clearFocus()
|
||||
mqttInput = mqttConfig
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ fun NeighborInfoConfigItemList(
|
|||
|
||||
item {
|
||||
PreferenceFooter(
|
||||
enabled = neighborInfoInput != neighborInfoConfig,
|
||||
enabled = enabled && neighborInfoInput != neighborInfoConfig,
|
||||
onCancelClicked = {
|
||||
focusManager.clearFocus()
|
||||
neighborInfoInput = neighborInfoConfig
|
||||
|
|
|
|||
|
|
@ -73,6 +73,10 @@ fun NetworkConfigScreen(
|
|||
)
|
||||
}
|
||||
|
||||
private fun extractWifiCredentials(qrCode: String) = Regex("""WIFI:S:(.*?);.*?P:(.*?);""")
|
||||
.find(qrCode)?.destructured
|
||||
?.let { (ssid, password) -> ssid to password } ?: (null to null)
|
||||
|
||||
@Composable
|
||||
fun NetworkConfigItemList(
|
||||
networkConfig: NetworkConfig,
|
||||
|
|
@ -87,11 +91,6 @@ fun NetworkConfigItemList(
|
|||
ScanErrorDialog { showScanErrorDialog = false }
|
||||
}
|
||||
|
||||
fun extractWifiCredentials(qrCode: String) = Regex("""WIFI:S:(.*?);.*?P:(.*?);""")
|
||||
.find(qrCode)?.destructured
|
||||
?.let { (ssid, password) -> ssid to password }
|
||||
?: (null to null)
|
||||
|
||||
val barcodeLauncher = rememberLauncherForActivityResult(ScanContract()) { result ->
|
||||
if (result.contents != null) {
|
||||
val (ssid, psk) = extractWifiCredentials(result.contents)
|
||||
|
|
@ -258,7 +257,7 @@ fun NetworkConfigItemList(
|
|||
|
||||
item {
|
||||
PreferenceFooter(
|
||||
enabled = networkInput != networkConfig,
|
||||
enabled = enabled && networkInput != networkConfig,
|
||||
onCancelClicked = {
|
||||
focusManager.clearFocus()
|
||||
networkInput = networkConfig
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ fun PaxcounterConfigItemList(
|
|||
|
||||
item {
|
||||
PreferenceFooter(
|
||||
enabled = paxcounterInput != paxcounterConfig,
|
||||
enabled = enabled && paxcounterInput != paxcounterConfig,
|
||||
onCancelClicked = {
|
||||
focusManager.clearFocus()
|
||||
paxcounterInput = paxcounterConfig
|
||||
|
|
|
|||
|
|
@ -227,7 +227,7 @@ fun PositionConfigItemList(
|
|||
|
||||
item {
|
||||
PreferenceFooter(
|
||||
enabled = positionInput != positionConfig || locationInput != location,
|
||||
enabled = enabled && positionInput != positionConfig || locationInput != location,
|
||||
onCancelClicked = {
|
||||
focusManager.clearFocus()
|
||||
locationInput = location
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ fun PowerConfigItemList(
|
|||
|
||||
item {
|
||||
PreferenceFooter(
|
||||
enabled = powerInput != powerConfig,
|
||||
enabled = enabled && powerInput != powerConfig,
|
||||
onCancelClicked = {
|
||||
focusManager.clearFocus()
|
||||
powerInput = powerConfig
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ fun RangeTestConfigItemList(
|
|||
|
||||
item {
|
||||
PreferenceFooter(
|
||||
enabled = rangeTestInput != rangeTestConfig,
|
||||
enabled = enabled && rangeTestInput != rangeTestConfig,
|
||||
onCancelClicked = {
|
||||
focusManager.clearFocus()
|
||||
rangeTestInput = rangeTestConfig
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ fun RemoteHardwareConfigItemList(
|
|||
|
||||
item {
|
||||
PreferenceFooter(
|
||||
enabled = remoteHardwareInput != remoteHardwareConfig,
|
||||
enabled = enabled && remoteHardwareInput != remoteHardwareConfig,
|
||||
onCancelClicked = {
|
||||
focusManager.clearFocus()
|
||||
remoteHardwareInput = remoteHardwareConfig
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ fun SecurityConfigItemList(
|
|||
|
||||
item {
|
||||
PreferenceFooter(
|
||||
enabled = securityInput != securityConfig,
|
||||
enabled = enabled && securityInput != securityConfig,
|
||||
onCancelClicked = {
|
||||
focusManager.clearFocus()
|
||||
securityInput = securityConfig
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ fun SerialConfigItemList(
|
|||
|
||||
item {
|
||||
PreferenceFooter(
|
||||
enabled = serialInput != serialConfig,
|
||||
enabled = enabled && serialInput != serialConfig,
|
||||
onCancelClicked = {
|
||||
focusManager.clearFocus()
|
||||
serialInput = serialConfig
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ fun StoreForwardConfigItemList(
|
|||
|
||||
item {
|
||||
PreferenceFooter(
|
||||
enabled = storeForwardInput != storeForwardConfig,
|
||||
enabled = enabled && storeForwardInput != storeForwardConfig,
|
||||
onCancelClicked = {
|
||||
focusManager.clearFocus()
|
||||
storeForwardInput = storeForwardConfig
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ fun TelemetryConfigItemList(
|
|||
|
||||
item {
|
||||
PreferenceFooter(
|
||||
enabled = telemetryInput != telemetryConfig,
|
||||
enabled = enabled && telemetryInput != telemetryConfig,
|
||||
onCancelClicked = {
|
||||
focusManager.clearFocus()
|
||||
telemetryInput = telemetryConfig
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ fun UserConfigItemList(
|
|||
|
||||
item {
|
||||
PreferenceFooter(
|
||||
enabled = userInput != userConfig,
|
||||
enabled = enabled && userInput != userConfig,
|
||||
onCancelClicked = {
|
||||
focusManager.clearFocus()
|
||||
userInput = userConfig
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue