Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

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

Merged
merged 10 commits into from
Jun 25, 2020
Merged

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

merged 10 commits into from
Jun 25, 2020

Conversation

tomjschwanke
Copy link
Contributor

(put this in a new PR to not merge from master into dev)

fixes #455

Checklist

  • Test your changes as thoroughly as possible before you commit them. Preferably, automate your test by unit/integration tests.
  • If this PR comes from a fork, please Allow edits from maintainers
  • Set a speaking title. Format: {task_name} (closes #{issue_number}). For example: Use logger (closes # 41)
  • Link your Pull Request to an issue (if applicable)
  • Create Work In Progress [WIP] pull requests only if you need clarification or an explicit review before you can continue your work item.
  • Make sure that your PR is not introducing unnecessary reformatting (e.g., introduced by on-save hooks in your IDE)
  • Make sure that your PR does not contain changes in strings.xml (see issue [HELP WANTED][README] Text / Translations  #332)
  • Make sure that your PR does not contain compiled sources (already set by the default .gitignore) and / or binary files

Description

#455 mentioned the settings being only toggleable by hitting the switch. This PR makes the entire SettingsRow toggle the switch, making it behave like stock Android settings.

@tomjschwanke tomjschwanke requested a review from a team June 15, 2020 12:40
@tomjschwanke
Copy link
Contributor Author

(copy from the other PR, but still relevant)
This would need to be remembered for all settings added in the future

Todo: maybe fix the animation, stock Android has a little animation, filling the box from where you tapped. In the current implementation, it lights up the entire box immediately

@tomjschwanke tomjschwanke changed the title fixes #455 by referencing the entire SettingsSwitchRow instead of jus… Make entire SettingsRow toggle the setting (closes #455) Jun 15, 2020
@harambasicluka harambasicluka self-assigned this Jun 17, 2020
@harambasicluka
Copy link
Contributor

harambasicluka commented Jun 17, 2020

Hi @tomjschwanke ,

thanks for your contribution! But it isn't as easy as it's in your PR, at least for the settings tracing switch. We already had your proposal implemented but removed it because we had to introduce more complexity to the switch and the row. And to be consistent we also removed it for the simpler notification switch rows.

So with the clickable row states like this can occur - the text says Stopped but the switch is On.

image

Reproduce:

  • Start with Active Exposure Logging
  • Disable Bluetooth
  • Click on the row
  • Tracing is Stopped and the switch is Off
  • Click on the switch (not the row)
    Result: The text says Stopped but the switch is On

That's only one wrong state maybe there are others. If you can fix this I'm happy to include your PR, but you would have to provide a list of manual tests. After this I'll verify that everything is working like expected and also that accessibility isn't broken with this new click target.
I also included the logic for the switch, images and text states, can be found here.

The following table explains the different stati which can appear in the ui.
This follows this prioritization: Tracing, Bluetooth, Connection will only be relevant in one exact case, Bluetooth is relevant in two different cases, but independently from the Connection status. And in every other case Tracing will be shown.

Tracing Bluetooth Connection Result
OFF OFF ON TRACING*
OFF ON OFF TRACING*
OFF ON ON TRACING*
OFF OFF OFF TRACING*
ON ON ON TRACING
ON OFF ON BLUETOOTH
ON OFF OFF BLUETOOTH
ON ON OFF CONNECTION

*circle has to be disabled via another formatter

If you aren't willing to do this please close this PR.

Cheers,
Luka

PS: To avoid misunderstandings: we would like to have this in, but only if it works as expected :)

@harambasicluka harambasicluka added the ui Issue related to UI aspects label Jun 17, 2020
@tomjschwanke
Copy link
Contributor Author

tomjschwanke commented Jun 17, 2020

Ahh I get it. Hitting the switch doesnt work now, as the switch doesn't have an OnClickListener anymore (thats on the Row now). This affects all switches.

We'd just need to set an OnClickListener on both and update the other accordingly, I will look into this.

I can't follow your steps, as I am unable to sign the app with the correct key (and therefore can't enable tracing), so once I come up with a potential fix, you'd need to test it.

…rking. Switches AND Rows now have an OnClickListener to change the setting.
@tomjschwanke
Copy link
Contributor Author

tomjschwanke commented Jun 17, 2020

I have changed it back to the way it was before, but added additional OnClickListeners for the Rows. Notification settings now toggle when clicking either on the Row or on the Switch. The tracing switch should behave the same. Before, I was able to change the Switch but it had no effect (as there was no OnClickListener bound to it) but now when I hit the switch, it gives me the Error message (because it's not signed).

The only issue I still have right now is, when the user slides the switch instead of clicking on it, the setting (+text) doesn't change, this issue exists in the production version too, however. I'll look into this.
This is being tracked in #607

@tomjschwanke
Copy link
Contributor Author

tomjschwanke commented Jun 18, 2020

grafik

Scanned with Accessibility scanner by Google

As you can see, it does not interfere with touch-targets, the switches remain the only ones (which should maybe actually be changed, the apps suggestion is to make the touch targets bigger).
I actually don't know if it shows all touch targets or only the ones that have suggestions.

I have already merged the switch sliding fix into this locally to test it, and everything is working.
Tapping on the row --> Option toggled
Tapping on the switch --> Option toggled
Sliding the switch --> Option toggled if position changed

@tomjschwanke
Copy link
Contributor Author

tomjschwanke commented Jun 18, 2020

When using talkback, tapping on the settings row says "on" / "off" depending on the switch position. It only reads the corresponding text on the second tap and every tap afterwards (until going back and going into the settings again). This also happens in the production version, so this PR doesn't change that.

@@ -101,6 +102,10 @@ class SettingsTracingFragment : Fragment(),
switch.setOnClickListener {
startStopTracing()
}
// Additional click target to toggle switch
row.setOnClickListener {
startStopTracing()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

implemented in commit 0dc17a1

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the check has to be added here

@harambasicluka
Copy link
Contributor

It seems to work fine with Talkback :)

Tom Jason Schwanke and others added 2 commits June 22, 2020 18:05
@tomjschwanke
Copy link
Contributor Author

tomjschwanke commented Jun 22, 2020

I have no idea why it fails the check, it's up to date with dev and quickbuild on dev passes, while on here it complains about deprecated features being used
It was a missing space

@harambasicluka
Copy link
Contributor

Thank's for the fast implementation, the builds due to a missing space.

Click on Details on Circle CI in this PR

image

Than you can open this Report: https://2305-268027139-gh.circle-artifacts.com/0/reports/ktlint/ktlintMainSourceSetCheck.txt

image

To reproduce this locally run gradle quickBuild. Your error should be fixed by running gradle ktlintFormat.

@tomjschwanke
Copy link
Contributor Author

Thanks, I'm not used to CircleCI and style enforcement yet.
I have fixed it now and it runs quickBuild successfully

@@ -101,6 +102,10 @@ class SettingsTracingFragment : Fragment(),
switch.setOnClickListener {
startStopTracing()
}
// Additional click target to toggle switch
row.setOnClickListener {
startStopTracing()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the check has to be added here

Copy link
Contributor

@harambasicluka harambasicluka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 💯

@harambasicluka harambasicluka merged commit 39da305 into corona-warn-app:dev Jun 25, 2020
@pwoessner pwoessner mentioned this pull request Jul 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
ui Issue related to UI aspects
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[UX] Increase touch target for switches
2 participants