Skip to content
Snippets Groups Projects
Unverified Commit 39da3050 authored by Tom Schwanke's avatar Tom Schwanke Committed by GitHub
Browse files

Make entire SettingsRow toggle the setting (closes #455) (#466)


* fixes #455 by referencing the entire SettingsSwitchRow instead of just the SettingsSwitchRowSwitch

* Fixed Switched having no OnClickListener anymore and therefore not working. Switches AND Rows now have an OnClickListener to change the setting.

* implemented requested changes from harambasicluka; (in onClickListener) checking if row is enabled before executing action

* fixed formatting that caused quickBuild to fail

* moved the isEnabled check to the row instead of switch

Co-authored-by: default avatarharambasicluka <64483219+harambasicluka@users.noreply.github.com>
parent 5f7e2935
No related branches found
No related tags found
No related merge requests found
...@@ -64,9 +64,15 @@ class SettingsNotificationFragment : Fragment() { ...@@ -64,9 +64,15 @@ class SettingsNotificationFragment : Fragment() {
// Notifications about risk status // Notifications about risk status
val updateRiskNotificationSwitch = val updateRiskNotificationSwitch =
binding.settingsSwitchRowNotificationsRisk.settingsSwitchRowSwitch binding.settingsSwitchRowNotificationsRisk.settingsSwitchRowSwitch
// Additional click target to toggle switch
val updateRiskNotificationRow =
binding.settingsSwitchRowNotificationsRisk.settingsSwitchRow
// Notifications about test status // Notifications about test status
val updateTestNotificationSwitch = val updateTestNotificationSwitch =
binding.settingsSwitchRowNotificationsTest.settingsSwitchRowSwitch binding.settingsSwitchRowNotificationsTest.settingsSwitchRowSwitch
// Additional click target to toggle switch
val updateTestNotificationRow =
binding.settingsSwitchRowNotificationsTest.settingsSwitchRow
// Settings // Settings
val settingsRow = binding.settingsNotificationsCard.tracingStatusCardButton val settingsRow = binding.settingsNotificationsCard.tracingStatusCardButton
val goBack = val goBack =
...@@ -75,10 +81,18 @@ class SettingsNotificationFragment : Fragment() { ...@@ -75,10 +81,18 @@ class SettingsNotificationFragment : Fragment() {
updateRiskNotificationSwitch.setOnClickListener { updateRiskNotificationSwitch.setOnClickListener {
settingsViewModel.toggleNotificationsRiskEnabled() settingsViewModel.toggleNotificationsRiskEnabled()
} }
// Additional click target to toggle switch
updateRiskNotificationRow.setOnClickListener {
if (updateRiskNotificationRow.isEnabled) settingsViewModel.toggleNotificationsRiskEnabled()
}
// Update Test // Update Test
updateTestNotificationSwitch.setOnClickListener { updateTestNotificationSwitch.setOnClickListener {
settingsViewModel.toggleNotificationsTestEnabled() settingsViewModel.toggleNotificationsTestEnabled()
} }
// Additional click target to toggle switch
updateTestNotificationRow.setOnClickListener {
if (updateTestNotificationRow.isEnabled) settingsViewModel.toggleNotificationsTestEnabled()
}
goBack.setOnClickListener { goBack.setOnClickListener {
(activity as MainActivity).goBack() (activity as MainActivity).goBack()
} }
......
...@@ -92,6 +92,7 @@ class SettingsTracingFragment : Fragment(), ...@@ -92,6 +92,7 @@ class SettingsTracingFragment : Fragment(),
} }
private fun setButtonOnClickListener() { private fun setButtonOnClickListener() {
val row = binding.settingsTracingSwitchRow.settingsSwitchRow
val switch = binding.settingsTracingSwitchRow.settingsSwitchRowSwitch val switch = binding.settingsTracingSwitchRow.settingsSwitchRowSwitch
val back = binding.settingsTracingHeader.headerButtonBack.buttonIcon val back = binding.settingsTracingHeader.headerButtonBack.buttonIcon
val bluetooth = binding.settingsTracingStatusBluetooth.tracingStatusCardButton val bluetooth = binding.settingsTracingStatusBluetooth.tracingStatusCardButton
...@@ -101,6 +102,10 @@ class SettingsTracingFragment : Fragment(), ...@@ -101,6 +102,10 @@ class SettingsTracingFragment : Fragment(),
switch.setOnClickListener { switch.setOnClickListener {
startStopTracing() startStopTracing()
} }
// Additional click target to toggle switch
row.setOnClickListener {
if (row.isEnabled) startStopTracing()
}
back.setOnClickListener { back.setOnClickListener {
(activity as MainActivity).goBack() (activity as MainActivity).goBack()
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment