diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2018-04-07 01:26:59 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2018-04-07 01:26:59 +0000 |
commit | ce62c87e280ff90ef602b438bf9a5daec2a8b16d (patch) | |
tree | d610853faa402cbd3d6f0ce514ea0ed8b794c513 /java/com/android/dialer/main/impl/toolbar/SearchBarView.java | |
parent | 1ab138ae73314be6a54ee8d3aed18548f80be05e (diff) | |
parent | 7c4d9bb81e738698ff5fd2392c62b547190fc7d9 (diff) |
Merge changes I5e4a4ada,I792a6f03
* changes:
Convert new speed dial to support fragment and add it to new peer.
Only request focus on search edit text when it's slide down.
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); } }); |