Skip to content

feat: make possible to hide the whiteboard toolbar#20274

Merged
lukstbit merged 2 commits intoankidroid:mainfrom
BrayanDSO:feat/whiteboard-hide5
Feb 6, 2026
Merged

feat: make possible to hide the whiteboard toolbar#20274
lukstbit merged 2 commits intoankidroid:mainfrom
BrayanDSO:feat/whiteboard-hide5

Conversation

@BrayanDSO
Copy link
Member

Purpose / Description

The biggest complaint about the new whiteboard was the screen space that it consumed.

So, I'm adding a way to hide it by dragging it outside the screen.

Fixes

Approach

  1. Add a menu option to make it more discoverable
  2. Add an invisible touch area around the toolbar so it's easier to drag it
  3. Deal with all the logic of hiding/showing the toolbar by dragging it

How Has This Been Tested?

Galaxy Tab S9, Android 16

Screen_Recording_20260131_171704_AnkiDroid.mp4

Learning (optional, can help others)

Despite the branch name, it's probably the 7th thing I tried. I don't like much to deal with moving and animating stuff in Android

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-hide5 branch from 32230d8 to e74a5c5 Compare January 31, 2026 20:30
@BrayanDSO BrayanDSO marked this pull request as draft January 31, 2026 20:34
@BrayanDSO BrayanDSO force-pushed the feat/whiteboard-hide5 branch from e74a5c5 to bd1395d Compare January 31, 2026 20:45
@BrayanDSO BrayanDSO marked this pull request as ready for review January 31, 2026 20:46
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.

Looks FANTASTIC. Wow.

Comment on lines 207 to 209
if (!isShown) {
hideToolbar()
}
Copy link
Member

Choose a reason for hiding this comment

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

Is it possible to sync the UI state here on both show & hide?

binding.innerControlsLayout.orientation = if (isVertical) LinearLayout.VERTICAL else LinearLayout.HORIZONTAL
currentAlignment = alignment

val isVertical = alignment == ToolbarAlignment.LEFT || alignment == ToolbarAlignment.RIGHT
Copy link
Member

Choose a reason for hiding this comment

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

nit: this is unintuitive, comment, naming change or adding a property to ToolbarAlignment

Copy link
Member Author

Choose a reason for hiding this comment

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

went with:

        // Check if the toolbar is docked to a side edge (Left/Right).
        val isSideDocked = alignment == ToolbarAlignment.LEFT || alignment == ToolbarAlignment.RIGHT

not sure if it is good enough

Comment on lines +206 to +219
val dx = event.rawX - dragStartX
val dy = event.rawY - dragStartY
Copy link
Member

Choose a reason for hiding this comment

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

nit: I don't think it's worth it, but a Point class would allow:

val (dx, dy) = event.toPoint() - dragStart

@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 Feb 1, 2026
the rest of the implementation will be in the next commit.

Split to ease the review process.
@BrayanDSO BrayanDSO force-pushed the feat/whiteboard-hide5 branch from bd1395d to fc4dfc5 Compare February 5, 2026 20:05
@BrayanDSO BrayanDSO force-pushed the feat/whiteboard-hide5 branch from fc4dfc5 to 4743a13 Compare February 5, 2026 20:29
@BrayanDSO BrayanDSO removed Needs Author Reply Waiting for a reply from the original author Has Conflicts labels Feb 5, 2026
Copy link
Member

@lukstbit lukstbit left a comment

Choose a reason for hiding this comment

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

Not going to use this myself but the functionality is nice.

The side positioning makes it a bit harder to hide/show as it's in the path of the predictive gesture but it's not that important.

@lukstbit lukstbit added Pending Merge Things with approval that are waiting future merge (e.g. targets a future release, CI wait, etc) and removed Needs Second Approval Has one approval, one more approval to merge labels Feb 6, 2026
@lukstbit lukstbit added this pull request to the merge queue Feb 6, 2026
Merged via the queue into ankidroid:main with commit 2877c2f Feb 6, 2026
15 checks passed
@github-actions github-actions bot added this to the 2.24 release milestone Feb 6, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

Maintainers: Please Sync Translations to produce a commit with only the automated changes from this PR.

Read more about updating strings on the wiki,

@github-actions github-actions bot removed the Pending Merge Things with approval that are waiting future merge (e.g. targets a future release, CI wait, etc) label Feb 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

New study screen: make possible to hide the Whiteboard toolbar

3 participants