Skip to content

Comments

Fix: Added robust keyboard visibility detection using WindowInsetsCompat.#17917

Merged
Arthur-Milchior merged 1 commit intoankidroid:mainfrom
Scapesfear:cardBrowser4
May 5, 2025
Merged

Fix: Added robust keyboard visibility detection using WindowInsetsCompat.#17917
Arthur-Milchior merged 1 commit intoankidroid:mainfrom
Scapesfear:cardBrowser4

Conversation

@Scapesfear
Copy link
Contributor

@Scapesfear Scapesfear commented Feb 4, 2025

Purpose / Description

Ensures that when the keyboard is open, pressing back first closes the keyboard instead of collapsing the search view, using robust keyboard visibility detection with WindowInsetsCompat

Fixes

Approach

Implemented WindowInsetsCompat to accurately detect keyboard visibility. On back press, if the keyboard is open, it is hidden first instead of collapsing the search view..

How Has This Been Tested?

Samsun Galaxy F23 5G
https://github.com/user-attachments/assets/cc33384c-768f-4bf3-b82b-935c2019f68c

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

Copy link

@MrTheMech MrTheMech left a comment

Choose a reason for hiding this comment

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

Hey @Scapesfear ,

I tested the implementation, and it works perfectly! 🚀 The fix effectively prevents the keyboard from popping up when returning to searched cards.

One small improvement: Instead of naming the variable isCardBrowserReloaded, we can replace it with shouldClearSearchFocus for better readability and clarity.

I've attached a video of my test:
https://github.com/user-attachments/assets/5d2f647d-0b79-4b02-a3ae-65e789acff98

@Scapesfear
Copy link
Contributor Author

One small improvement: Instead of naming the variable isCardBrowserReloaded, we can replace it with shouldClearSearchFocus for better readability and clarity.

Hi @MrTheMech, thanks for suggestion, actually i named the variable so, because when we come back from any activity to the caller, the caller gets reloaded and thus I named it isCardBrowserReloaded.

@Scapesfear Scapesfear changed the title Fix: Prevents keyboard popup when returning from Note Editor to searched cards Fix: Added robust keyboard visibility detection using WindowInsetsCompat. Feb 9, 2025
Copy link
Member

@mikehardy mikehardy left a comment

Choose a reason for hiding this comment

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

Seems like it should work - one curiosity (that may result in no change...) about choice of method to close the soft keyboard

@mikehardy mikehardy added Needs Author Reply Waiting for a reply from the original author Needs Review labels Feb 16, 2025
@Scapesfear Scapesfear requested a review from mikehardy February 18, 2025 01:35
@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2025

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

@github-actions github-actions bot added the Stale label Mar 4, 2025
@BrayanDSO BrayanDSO removed Needs Author Reply Waiting for a reply from the original author Stale labels Mar 7, 2025
Copy link
Member

@mikehardy mikehardy left a comment

Choose a reason for hiding this comment

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

LGTM

@mikehardy mikehardy added the Needs Second Approval Has one approval, one more approval to merge label Apr 5, 2025
@Arthur-Milchior Arthur-Milchior added this pull request to the merge queue May 5, 2025
Merged via the queue into ankidroid:main with commit ada636b May 5, 2025
9 checks passed
@github-actions github-actions bot removed Needs Review Needs Second Approval Has one approval, one more approval to merge labels May 5, 2025
@github-actions github-actions bot added this to the 2.21 release milestone May 5, 2025
@david-allison
Copy link
Member

Hi there @Scapesfear! This is the OpenCollective Notice for PRs merged from 2025-05-01 through 2025-05-31

If you are interested in compensation for this work, the process with details is here: https://github.com/ankidroid/Anki-Android/wiki/OpenCollective-Payment-Process#how-to-get-paid

We only post one comment per person per month to avoid spamming you, regardless of the number of PRs merged, but this note applies to all PRs merged for this month

Please understand that our monthly budget is never guaranteed to cover all claims - the cap on payments-per-person may be lower, but we try to make our process as fair and transparent as possible, we just need your understanding.

Thanks!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pressing back to dismiss keyboard closes search

6 participants