fix(new study screen): finish current stroke before changing pen color
https://github.com/user-attachments/assets/be9af5a2-d37d-4c83-b6fd-daeb9b82caa1
Purpose / Description
When drawing, if the user tapped with another finger to change the brush color, the stroke would continue instead of ending. This caused unexpected merging of strokes with the wrong color.
Fixes
- Fixes #19236
Approach
- Added handling for ACTION_POINTER_DOWN in onTouchEvent
- Now, whenever a second finger touches the screen while drawing, the current stroke is finalized (
drawFinish()),isCurrentlyDrawingis reset, and the brush change is applied cleanly. - This ensures multi-touch interactions stop the ongoing stroke before switching brush color.
How Has This Been Tested?
- Tested on Physical Device
- Drew with one finger, then tapped another finger to change color.
- Verified that the stroke ended before color switch.
- Confirmed new strokes started fresh with the new brush color.
Checklist
Please, go through these checks before submitting the PR.
- [x] You have a descriptive commit message with a short title (first line, max 50 chars).
- [x] You have commented your code, particularly in hard-to-understand areas
- [x] You have performed a self-review of your own code
- [x] UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
- [ ] UI Changes: You have tested your change using the Google Accessibility Scanner
not allowing to change tools if the user is drawing.
Currently, you can also press other buttons (like the answer buttons) while drawing. Consider whether to disallow that too.
Currently, you can also press other buttons (like the answer buttons) while drawing. Consider whether to disallow that too.
For now, disable only the whiteboard buttons. Disabling the others will be more complex, and I prefer to stabilize the screen first.
The commits got a bit messy Let me know if this will work or do I need to create a new pr with a new branch with single commit
Please don't create a new PR. Rebase it
e: file:///D:/a/Anki-Android/Anki-Android/AnkiDroid/src/main/java/com/ichi2/anki/ui/windows/reviewer/whiteboard/WhiteboardFragment.kt:86:24 Unresolved reference 'isDrawing'.
Test fails
@Amitesh-exp rebase it
https://github.com/user-attachments/assets/56b23ffb-ffa0-4564-aef0-139a45e38952
New Fix: Restricts the user from changing color while drawing
https://github.com/user-attachments/assets/42cf05e9-d7ae-45d6-ae0d-dd9e55c9140f
This type of feature where toolbar disappears is available in many apps where drawing screen is present. Doesn't look unusual too. @BrayanDSO @thedroiddiv
Hey, sorry for the long waiting, I was away the time. I think it's a totally subjective choice My comment was mostly was around how the the disabling was being handled earlier seemed a bit of place. Which looks good to me now.
Will let @BrayanDSO to tak the call here.
This could be something like
if(isDrawing) disableButtons() else enableButtons()
or
if(isDrawing)
showToolbar() else hideToolbar()
Still think that hiding the toolbar is distracting and unproductive
@BrayanDSO Take a look Simply disabled it while drawing
Hello 👋, this PR has had no activity for more than 2 weeks and needs a reply from the author. If you think this is a mistake please comment and ping a maintainer to get this merged ASAP! Thanks for contributing! You have 7 days until this gets closed automatically
@thedroiddiv @BrayanDSO Please take a look and let me know if any other changes needed
Hello 👋, this PR has had no activity for more than 2 weeks and needs a reply from the author. If you think this is a mistake please comment and ping a maintainer to get this merged ASAP! Thanks for contributing! You have 7 days until this gets closed automatically