Skip to content

feat(whiteboard): support gestures/keybinds#20268

Open
BrayanDSO wants to merge 5 commits intoankidroid:mainfrom
BrayanDSO:feat/whiteboard-multi-finger
Open

feat(whiteboard): support gestures/keybinds#20268
BrayanDSO wants to merge 5 commits intoankidroid:mainfrom
BrayanDSO:feat/whiteboard-multi-finger

Conversation

@BrayanDSO
Copy link
Member

@BrayanDSO BrayanDSO commented Jan 30, 2026

Fixes

Approach

  1. Start listening to multi-finger taps in WhiteboardView
  2. Setup the controls and bindings
  3. Setup a ControlPreference and a gesture picker specific to whiteboard gestures
    • Only Question and Answer gestures are accepted
    • Only multi-finger and shake gestures are accepted

How Has This Been Tested?

Galaxy Tab S9, Android 16

Screen_Recording_20260130_162646_AnkiDroid.mp4

Learning (optional, can help others)

Working on architecture is paying off. This was way easier than I expected by extending stuff instead of reorganizing everything.

Checklist

Please, go through these checks before submitting the PR.

  • You have a descriptive commit message with a short title (first line, max 50 chars).
  • You have commented your code, particularly in hard-to-understand areas
  • You have performed a self-review of your own code
  • 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

@github-actions
Copy link
Contributor

Important

Maintainers: This PR contains Strings changes

  1. Sync Translations before merging this PR and wait for the action to complete
  2. Review and merge the auto-generated PR in order to sync all user-submitted translations
  3. Sync Translations again and merge the PR so the huge automated string changes caused by merging this PR are by themselves and easy to review

@BrayanDSO BrayanDSO force-pushed the feat/whiteboard-multi-finger branch from 6fb0f6f to cb2d474 Compare January 30, 2026 20:30
@BrayanDSO BrayanDSO force-pushed the feat/whiteboard-multi-finger branch from cb2d474 to e8014a6 Compare January 30, 2026 20:46
@criticalAY criticalAY added the Blocked by dependency Currently blocked by some other dependent / related change label Feb 5, 2026
@BrayanDSO BrayanDSO force-pushed the feat/whiteboard-multi-finger branch from 9e468e3 to f0239f8 Compare February 6, 2026 00:33
@BrayanDSO BrayanDSO removed Blocked by dependency Currently blocked by some other dependent / related change Has Conflicts labels Feb 6, 2026
@BrayanDSO BrayanDSO force-pushed the feat/whiteboard-multi-finger branch from f0239f8 to 032c8f2 Compare February 6, 2026 00:35
@BrayanDSO BrayanDSO force-pushed the feat/whiteboard-multi-finger branch from 032c8f2 to 7a96ffa Compare February 20, 2026 14:31
Copy link
Member

@david-allison david-allison left a comment

Choose a reason for hiding this comment

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

Really solid! One request regarding the enum name property being tested/constant - had too many issues with this in my career.

REDO,
;

override val preferenceKey: String get() = "binding_whiteboard_$name"
Copy link
Member

@david-allison david-allison Mar 4, 2026

Choose a reason for hiding this comment

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

⚠️ Add a test + note about the test here. name is subject to accidental refactor and we need to guard against this.


val dx = abs(startX - currentX)
val dy = abs(startY - currentY)
if (dx >= touchSlop || dy >= touchSlop) {
Copy link
Member

Choose a reason for hiding this comment

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

Could you make a comment on the math here, this doesn't need to be 'fixed', but a future implementor should be aware:

I suspect this doesn't matter as the refresh rate on most devices will be massive, so the position deltas will be small

If a large MotionEvent occurs, this code will pick the midway point from the start and the end. If the extremity is used, it may be outside the tap tolerance.

Copy link
Member Author

Choose a reason for hiding this comment

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

should be more correct now

@david-allison david-allison added Needs Author Reply Waiting for a reply from the original author Needs Second Approval Has one approval, one more approval to merge and removed Needs Review labels Mar 4, 2026
the actions are restricted to 'both' sides of the card to simplify my life coding it. Also, that makes the UX simpler

the only gestures available are the multi-finger taps and shake.

Swipes and single taps can't be used because they conflict with the screen functionality
this way, the user can have gestures do different depending whether the whiteboard is enabled
@BrayanDSO BrayanDSO force-pushed the feat/whiteboard-multi-finger branch from 7a96ffa to 35c09cc Compare March 12, 2026 08:42
@BrayanDSO BrayanDSO removed the Needs Author Reply Waiting for a reply from the original author label Mar 12, 2026
@david-allison
Copy link
Member

@BrayanDSO merge at your discretion.

I'd mildly prefer a second look on this one, but don't want it to be blocking

@BrayanDSO
Copy link
Member Author

I'd like this in 2.24. If someone doesn't merge it before that, I (or someone else) should do it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Second Approval Has one approval, one more approval to merge Strings

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[New study screen] add keybinds/motion controllers support to whiteboard actions

3 participants