Commit 6d7a0cac authored by Changwan Ryu's avatar Changwan Ryu Committed by Commit Bot

Hide keyboard when omnibox loses focus

This extends what we did for ChromeHome at
https://chromium-review.googlesource.com/520712: when moving focus from
an EditText to non-editable placeholder does not automatically hide
keyboard, but restart input with TYPE_NULL, which results in a visual
glitch such as flickering of number panel on keyboard app. This can be
prevented by hiding soft input ourselves.

BUG=708259

Change-Id: I05d3714202381e42af04b3fa4ed1bf4452908beb
Reviewed-on: https://chromium-review.googlesource.com/728389Reviewed-by: default avatarTed Choc <tedchoc@chromium.org>
Commit-Queue: Changwan Ryu <changwan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#510134}
parent 65d50038
......@@ -1040,13 +1040,13 @@ public class LocationBarLayout extends FrameLayout
}
// Moving focus away from UrlBar(EditText) to a non-editable focus holder, such as
// ToolbarPhone, won't automatically hide keyboard app, but restart it with TYPE_NULL,
// which will result in a visual glitch. We apply this logic only to ChromeHome
// cautiously since hiding keyboard may lower FPS of other animation effects.
if (mBottomSheet != null) {
InputMethodManager imm = (InputMethodManager) getContext().getSystemService(
Context.INPUT_METHOD_SERVICE);
if (imm.isActive(mUrlBar)) imm.hideSoftInputFromWindow(getWindowToken(), 0, null);
}
// which will result in a visual glitch. Also, currently, we do not allow moving focus
// directly from omnibox to web content's form field. Therefore, we hide keyboard on
// focus blur indiscriminately here. Note that hiding keyboard may lower FPS of other
// animation effects, but we found it tolerable in an experiment.
InputMethodManager imm = (InputMethodManager) getContext().getSystemService(
Context.INPUT_METHOD_SERVICE);
if (imm.isActive(mUrlBar)) imm.hideSoftInputFromWindow(getWindowToken(), 0, null);
}
if (mToolbarDataProvider.isUsingBrandColor()) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment