Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

keep keyboard open upon pressing Clear icon in URL bar (fixes issue #742) #830

Merged
merged 1 commit into from
Nov 26, 2018

Conversation

cvan
Copy link
Contributor

@cvan cvan commented Nov 26, 2018

so I can better understand how my fix fixes the bug, can you share the context of PR #609?

specifically, in the mMicrophoneListener method, what does the view.requestFocusFromTouch() call do?

the reason I ask: on master, I was able to reproduce the same bug randomly twice (but I still cannot find reliable STR): I pressed the Voice Search icon in the URL bar, my Voice Search was processed and completed, but then the keyboard opened (even though I was not previously interacting with the keyboard, and the keyboard was closed). ideas? if it was a bug/oversight from PR #609, I can address this in this PR. otherwise, I'll be filing an issue.

@cvan cvan requested a review from keianhzo November 26, 2018 08:41
@cvan cvan added this to the v1.1 milestone Nov 26, 2018
@keianhzo
Copy link
Contributor

@cvan By default android only triggers focus change events for some widgets that consume user input, like EditText for example. In our context we need to handle focus change events in other cases like:

  1. User opens the settings dialog
  2. User clicks on the URL bar back button

By default Android won't deliver focus change events in that case but we need to get them so we know the settings widget should be closed. So that's what we do with requestFocusFromTouch: trigger focus change events for those widgets that don't trigger them by default.

All the focus change events are handled at

mWidgetContainer.getViewTreeObserver().addOnGlobalFocusChangeListener((oldFocus, newFocus) -> {

And sent to all the widget that are subscribed to the focus change events.

@keianhzo keianhzo merged commit 348c3c1 into master Nov 26, 2018
@cvan cvan deleted the keep-keyboard-open-upon-url-clear branch November 26, 2018 19:00
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants