diff options
author | calderwoodra <calderwoodra@google.com> | 2018-04-06 12:29:17 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-04-06 16:34:44 -0700 |
commit | 23ef36ff6dfd2fdb47f6ec8bb6928e4e40e11fa5 (patch) | |
tree | e2282cf5fadeaf528ed65a4f7cdf91c4276b6fd5 /java/com/android/dialer/main/impl/toolbar/SearchBarView.java | |
parent | 1ab138ae73314be6a54ee8d3aed18548f80be05e (diff) |
Only request focus on search edit text when it's slide down.
Bug: 77586391
Test: manual
PiperOrigin-RevId: 191924178
Change-Id: I792a6f0308f0dde9b4ae82227aa6a8327208a192
Diffstat (limited to 'java/com/android/dialer/main/impl/toolbar/SearchBarView.java')
-rw-r--r-- | java/com/android/dialer/main/impl/toolbar/SearchBarView.java | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/java/com/android/dialer/main/impl/toolbar/SearchBarView.java b/java/com/android/dialer/main/impl/toolbar/SearchBarView.java index 0cc76598c..8ea94299e 100644 --- a/java/com/android/dialer/main/impl/toolbar/SearchBarView.java +++ b/java/com/android/dialer/main/impl/toolbar/SearchBarView.java @@ -101,13 +101,17 @@ final class SearchBarView extends FrameLayout { listener.onVoiceButtonClicked( result -> { if (!TextUtils.isEmpty(result)) { - expand(true, Optional.of(result)); + expand(/* animate */ true, Optional.of(result), /* requestFocus */ true); } }); } - /** Expand the search bar and populate it with text if any exists. */ - /* package-private */ void expand(boolean animate, Optional<String> text) { + /** + * Expand the search bar and populate it with text if any exists. + * + * @param requestFocus should be false if showing the dialpad + */ + /* package-private */ void expand(boolean animate, Optional<String> text, boolean requestFocus) { if (isExpanded) { return; } @@ -133,7 +137,11 @@ final class SearchBarView extends FrameLayout { if (text.isPresent()) { searchBox.setText(text.get()); } - searchBox.requestFocus(); + // Don't request focus unless we're actually showing the search box, otherwise + // physical/bluetooth keyboards will type into this box when the dialpad is open. + if (requestFocus) { + searchBox.requestFocus(); + } setBackgroundResource(R.drawable.search_bar_background); } }); |