diff --git a/app/src/main/java/com/geeksville/mesh/ui/components/config/AmbientLightingConfigItemList.kt b/app/src/main/java/com/geeksville/mesh/ui/components/config/AmbientLightingConfigItemList.kt index a787cf90b..b1de4c500 100644 --- a/app/src/main/java/com/geeksville/mesh/ui/components/config/AmbientLightingConfigItemList.kt +++ b/app/src/main/java/com/geeksville/mesh/ui/components/config/AmbientLightingConfigItemList.kt @@ -106,7 +106,7 @@ fun AmbientLightingConfigItemList( item { PreferenceFooter( - enabled = ambientLightingInput != ambientLightingConfig, + enabled = enabled && ambientLightingInput != ambientLightingConfig, onCancelClicked = { focusManager.clearFocus() ambientLightingInput = ambientLightingConfig diff --git a/app/src/main/java/com/geeksville/mesh/ui/components/config/AudioConfigItemList.kt b/app/src/main/java/com/geeksville/mesh/ui/components/config/AudioConfigItemList.kt index cd3667bb4..1b10c1ddd 100644 --- a/app/src/main/java/com/geeksville/mesh/ui/components/config/AudioConfigItemList.kt +++ b/app/src/main/java/com/geeksville/mesh/ui/components/config/AudioConfigItemList.kt @@ -122,7 +122,7 @@ fun AudioConfigItemList( item { PreferenceFooter( - enabled = audioInput != audioConfig, + enabled = enabled && audioInput != audioConfig, onCancelClicked = { focusManager.clearFocus() audioInput = audioConfig diff --git a/app/src/main/java/com/geeksville/mesh/ui/components/config/BluetoothConfigItemList.kt b/app/src/main/java/com/geeksville/mesh/ui/components/config/BluetoothConfigItemList.kt index 9c38cefcd..e5eb987d1 100644 --- a/app/src/main/java/com/geeksville/mesh/ui/components/config/BluetoothConfigItemList.kt +++ b/app/src/main/java/com/geeksville/mesh/ui/components/config/BluetoothConfigItemList.kt @@ -94,7 +94,7 @@ fun BluetoothConfigItemList( item { PreferenceFooter( - enabled = bluetoothInput != bluetoothConfig, + enabled = enabled && bluetoothInput != bluetoothConfig, onCancelClicked = { focusManager.clearFocus() bluetoothInput = bluetoothConfig diff --git a/app/src/main/java/com/geeksville/mesh/ui/components/config/CannedMessageConfigItemList.kt b/app/src/main/java/com/geeksville/mesh/ui/components/config/CannedMessageConfigItemList.kt index f962c5e98..57bded7e9 100644 --- a/app/src/main/java/com/geeksville/mesh/ui/components/config/CannedMessageConfigItemList.kt +++ b/app/src/main/java/com/geeksville/mesh/ui/components/config/CannedMessageConfigItemList.kt @@ -212,7 +212,7 @@ fun CannedMessageConfigItemList( item { PreferenceFooter( - enabled = cannedMessageInput != cannedMessageConfig || messagesInput != messages, + enabled = enabled && cannedMessageInput != cannedMessageConfig || messagesInput != messages, onCancelClicked = { focusManager.clearFocus() messagesInput = messages diff --git a/app/src/main/java/com/geeksville/mesh/ui/components/config/ChannelSettingsItemList.kt b/app/src/main/java/com/geeksville/mesh/ui/components/config/ChannelSettingsItemList.kt index c130d8558..80fc14422 100644 --- a/app/src/main/java/com/geeksville/mesh/ui/components/config/ChannelSettingsItemList.kt +++ b/app/src/main/java/com/geeksville/mesh/ui/components/config/ChannelSettingsItemList.kt @@ -251,7 +251,7 @@ fun ChannelSettingsItemList( item { PreferenceFooter( - enabled = isEditing, + enabled = enabled && isEditing, negativeText = R.string.cancel, onNegativeClicked = { focusManager.clearFocus() diff --git a/app/src/main/java/com/geeksville/mesh/ui/components/config/DetectionSensorConfigItemList.kt b/app/src/main/java/com/geeksville/mesh/ui/components/config/DetectionSensorConfigItemList.kt index 4cb887a13..1e950e5a5 100644 --- a/app/src/main/java/com/geeksville/mesh/ui/components/config/DetectionSensorConfigItemList.kt +++ b/app/src/main/java/com/geeksville/mesh/ui/components/config/DetectionSensorConfigItemList.kt @@ -157,7 +157,7 @@ fun DetectionSensorConfigItemList( item { PreferenceFooter( - enabled = detectionSensorInput != detectionSensorConfig, + enabled = enabled && detectionSensorInput != detectionSensorConfig, onCancelClicked = { focusManager.clearFocus() detectionSensorInput = detectionSensorConfig diff --git a/app/src/main/java/com/geeksville/mesh/ui/components/config/DisplayConfigItemList.kt b/app/src/main/java/com/geeksville/mesh/ui/components/config/DisplayConfigItemList.kt index 4d53018d5..26f99c1ad 100644 --- a/app/src/main/java/com/geeksville/mesh/ui/components/config/DisplayConfigItemList.kt +++ b/app/src/main/java/com/geeksville/mesh/ui/components/config/DisplayConfigItemList.kt @@ -168,7 +168,7 @@ fun DisplayConfigItemList( item { PreferenceFooter( - enabled = displayInput != displayConfig, + enabled = enabled && displayInput != displayConfig, onCancelClicked = { focusManager.clearFocus() displayInput = displayConfig diff --git a/app/src/main/java/com/geeksville/mesh/ui/components/config/ExternalNotificationConfigItemList.kt b/app/src/main/java/com/geeksville/mesh/ui/components/config/ExternalNotificationConfigItemList.kt index fdddcc864..37eb3d934 100644 --- a/app/src/main/java/com/geeksville/mesh/ui/components/config/ExternalNotificationConfigItemList.kt +++ b/app/src/main/java/com/geeksville/mesh/ui/components/config/ExternalNotificationConfigItemList.kt @@ -244,7 +244,7 @@ fun ExternalNotificationConfigItemList( item { PreferenceFooter( - enabled = externalNotificationInput != extNotificationConfig || ringtoneInput != ringtone, + enabled = enabled && externalNotificationInput != extNotificationConfig || ringtoneInput != ringtone, onCancelClicked = { focusManager.clearFocus() ringtoneInput = ringtone diff --git a/app/src/main/java/com/geeksville/mesh/ui/components/config/LoRaConfigItemList.kt b/app/src/main/java/com/geeksville/mesh/ui/components/config/LoRaConfigItemList.kt index 3b64c0252..0cc606ef6 100644 --- a/app/src/main/java/com/geeksville/mesh/ui/components/config/LoRaConfigItemList.kt +++ b/app/src/main/java/com/geeksville/mesh/ui/components/config/LoRaConfigItemList.kt @@ -244,7 +244,7 @@ fun LoRaConfigItemList( item { PreferenceFooter( - enabled = loraInput != loraConfig, + enabled = enabled && loraInput != loraConfig, onCancelClicked = { focusManager.clearFocus() loraInput = loraConfig diff --git a/app/src/main/java/com/geeksville/mesh/ui/components/config/MQTTConfigItemList.kt b/app/src/main/java/com/geeksville/mesh/ui/components/config/MQTTConfigItemList.kt index d20903f9f..81c866e94 100644 --- a/app/src/main/java/com/geeksville/mesh/ui/components/config/MQTTConfigItemList.kt +++ b/app/src/main/java/com/geeksville/mesh/ui/components/config/MQTTConfigItemList.kt @@ -186,7 +186,7 @@ fun MQTTConfigItemList( item { PreferenceFooter( - enabled = mqttInput != mqttConfig, + enabled = enabled && mqttInput != mqttConfig, onCancelClicked = { focusManager.clearFocus() mqttInput = mqttConfig diff --git a/app/src/main/java/com/geeksville/mesh/ui/components/config/NeighborInfoConfigItemList.kt b/app/src/main/java/com/geeksville/mesh/ui/components/config/NeighborInfoConfigItemList.kt index 102672e0a..e50492122 100644 --- a/app/src/main/java/com/geeksville/mesh/ui/components/config/NeighborInfoConfigItemList.kt +++ b/app/src/main/java/com/geeksville/mesh/ui/components/config/NeighborInfoConfigItemList.kt @@ -82,7 +82,7 @@ fun NeighborInfoConfigItemList( item { PreferenceFooter( - enabled = neighborInfoInput != neighborInfoConfig, + enabled = enabled && neighborInfoInput != neighborInfoConfig, onCancelClicked = { focusManager.clearFocus() neighborInfoInput = neighborInfoConfig diff --git a/app/src/main/java/com/geeksville/mesh/ui/components/config/NetworkConfigItemList.kt b/app/src/main/java/com/geeksville/mesh/ui/components/config/NetworkConfigItemList.kt index 5e965b839..ec2d9b817 100644 --- a/app/src/main/java/com/geeksville/mesh/ui/components/config/NetworkConfigItemList.kt +++ b/app/src/main/java/com/geeksville/mesh/ui/components/config/NetworkConfigItemList.kt @@ -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 diff --git a/app/src/main/java/com/geeksville/mesh/ui/components/config/PaxcounterConfigItemList.kt b/app/src/main/java/com/geeksville/mesh/ui/components/config/PaxcounterConfigItemList.kt index bb4a158fd..dd57e6727 100644 --- a/app/src/main/java/com/geeksville/mesh/ui/components/config/PaxcounterConfigItemList.kt +++ b/app/src/main/java/com/geeksville/mesh/ui/components/config/PaxcounterConfigItemList.kt @@ -102,7 +102,7 @@ fun PaxcounterConfigItemList( item { PreferenceFooter( - enabled = paxcounterInput != paxcounterConfig, + enabled = enabled && paxcounterInput != paxcounterConfig, onCancelClicked = { focusManager.clearFocus() paxcounterInput = paxcounterConfig diff --git a/app/src/main/java/com/geeksville/mesh/ui/components/config/PositionConfigItemList.kt b/app/src/main/java/com/geeksville/mesh/ui/components/config/PositionConfigItemList.kt index 846fbab85..08f7efc2e 100644 --- a/app/src/main/java/com/geeksville/mesh/ui/components/config/PositionConfigItemList.kt +++ b/app/src/main/java/com/geeksville/mesh/ui/components/config/PositionConfigItemList.kt @@ -227,7 +227,7 @@ fun PositionConfigItemList( item { PreferenceFooter( - enabled = positionInput != positionConfig || locationInput != location, + enabled = enabled && positionInput != positionConfig || locationInput != location, onCancelClicked = { focusManager.clearFocus() locationInput = location diff --git a/app/src/main/java/com/geeksville/mesh/ui/components/config/PowerConfigItemList.kt b/app/src/main/java/com/geeksville/mesh/ui/components/config/PowerConfigItemList.kt index d289833d7..f8d5abb48 100644 --- a/app/src/main/java/com/geeksville/mesh/ui/components/config/PowerConfigItemList.kt +++ b/app/src/main/java/com/geeksville/mesh/ui/components/config/PowerConfigItemList.kt @@ -128,7 +128,7 @@ fun PowerConfigItemList( item { PreferenceFooter( - enabled = powerInput != powerConfig, + enabled = enabled && powerInput != powerConfig, onCancelClicked = { focusManager.clearFocus() powerInput = powerConfig diff --git a/app/src/main/java/com/geeksville/mesh/ui/components/config/RangeTestConfigItemList.kt b/app/src/main/java/com/geeksville/mesh/ui/components/config/RangeTestConfigItemList.kt index 2d76f49f3..ae333cd0d 100644 --- a/app/src/main/java/com/geeksville/mesh/ui/components/config/RangeTestConfigItemList.kt +++ b/app/src/main/java/com/geeksville/mesh/ui/components/config/RangeTestConfigItemList.kt @@ -86,7 +86,7 @@ fun RangeTestConfigItemList( item { PreferenceFooter( - enabled = rangeTestInput != rangeTestConfig, + enabled = enabled && rangeTestInput != rangeTestConfig, onCancelClicked = { focusManager.clearFocus() rangeTestInput = rangeTestConfig diff --git a/app/src/main/java/com/geeksville/mesh/ui/components/config/RemoteHardwareConfigItemList.kt b/app/src/main/java/com/geeksville/mesh/ui/components/config/RemoteHardwareConfigItemList.kt index 5ba1a71d7..377f6ec47 100644 --- a/app/src/main/java/com/geeksville/mesh/ui/components/config/RemoteHardwareConfigItemList.kt +++ b/app/src/main/java/com/geeksville/mesh/ui/components/config/RemoteHardwareConfigItemList.kt @@ -96,7 +96,7 @@ fun RemoteHardwareConfigItemList( item { PreferenceFooter( - enabled = remoteHardwareInput != remoteHardwareConfig, + enabled = enabled && remoteHardwareInput != remoteHardwareConfig, onCancelClicked = { focusManager.clearFocus() remoteHardwareInput = remoteHardwareConfig diff --git a/app/src/main/java/com/geeksville/mesh/ui/components/config/SecurityConfigItemList.kt b/app/src/main/java/com/geeksville/mesh/ui/components/config/SecurityConfigItemList.kt index ee38c5aab..305613964 100644 --- a/app/src/main/java/com/geeksville/mesh/ui/components/config/SecurityConfigItemList.kt +++ b/app/src/main/java/com/geeksville/mesh/ui/components/config/SecurityConfigItemList.kt @@ -146,7 +146,7 @@ fun SecurityConfigItemList( item { PreferenceFooter( - enabled = securityInput != securityConfig, + enabled = enabled && securityInput != securityConfig, onCancelClicked = { focusManager.clearFocus() securityInput = securityConfig diff --git a/app/src/main/java/com/geeksville/mesh/ui/components/config/SerialConfigItemList.kt b/app/src/main/java/com/geeksville/mesh/ui/components/config/SerialConfigItemList.kt index a999c6816..e3dda34d6 100644 --- a/app/src/main/java/com/geeksville/mesh/ui/components/config/SerialConfigItemList.kt +++ b/app/src/main/java/com/geeksville/mesh/ui/components/config/SerialConfigItemList.kt @@ -135,7 +135,7 @@ fun SerialConfigItemList( item { PreferenceFooter( - enabled = serialInput != serialConfig, + enabled = enabled && serialInput != serialConfig, onCancelClicked = { focusManager.clearFocus() serialInput = serialConfig diff --git a/app/src/main/java/com/geeksville/mesh/ui/components/config/StoreForwardConfigItemList.kt b/app/src/main/java/com/geeksville/mesh/ui/components/config/StoreForwardConfigItemList.kt index 141281b3c..2c578e615 100644 --- a/app/src/main/java/com/geeksville/mesh/ui/components/config/StoreForwardConfigItemList.kt +++ b/app/src/main/java/com/geeksville/mesh/ui/components/config/StoreForwardConfigItemList.kt @@ -117,7 +117,7 @@ fun StoreForwardConfigItemList( item { PreferenceFooter( - enabled = storeForwardInput != storeForwardConfig, + enabled = enabled && storeForwardInput != storeForwardConfig, onCancelClicked = { focusManager.clearFocus() storeForwardInput = storeForwardConfig diff --git a/app/src/main/java/com/geeksville/mesh/ui/components/config/TelemetryConfigItemList.kt b/app/src/main/java/com/geeksville/mesh/ui/components/config/TelemetryConfigItemList.kt index e4734b7ec..19ac0fd38 100644 --- a/app/src/main/java/com/geeksville/mesh/ui/components/config/TelemetryConfigItemList.kt +++ b/app/src/main/java/com/geeksville/mesh/ui/components/config/TelemetryConfigItemList.kt @@ -162,7 +162,7 @@ fun TelemetryConfigItemList( item { PreferenceFooter( - enabled = telemetryInput != telemetryConfig, + enabled = enabled && telemetryInput != telemetryConfig, onCancelClicked = { focusManager.clearFocus() telemetryInput = telemetryConfig diff --git a/app/src/main/java/com/geeksville/mesh/ui/components/config/UserConfigItemList.kt b/app/src/main/java/com/geeksville/mesh/ui/components/config/UserConfigItemList.kt index 8e23bd519..cb51224fa 100644 --- a/app/src/main/java/com/geeksville/mesh/ui/components/config/UserConfigItemList.kt +++ b/app/src/main/java/com/geeksville/mesh/ui/components/config/UserConfigItemList.kt @@ -117,7 +117,7 @@ fun UserConfigItemList( item { PreferenceFooter( - enabled = userInput != userConfig, + enabled = enabled && userInput != userConfig, onCancelClicked = { focusManager.clearFocus() userInput = userConfig