diff options
Diffstat (limited to 'java/com/android/dialer/main/impl/toolbar')
-rw-r--r-- | java/com/android/dialer/main/impl/toolbar/MainToolbar.java | 6 | ||||
-rw-r--r-- | java/com/android/dialer/main/impl/toolbar/SearchBarView.java | 16 |
2 files changed, 15 insertions, 7 deletions
diff --git a/java/com/android/dialer/main/impl/toolbar/MainToolbar.java b/java/com/android/dialer/main/impl/toolbar/MainToolbar.java index 68876dde5..5e5db2c8c 100644 --- a/java/com/android/dialer/main/impl/toolbar/MainToolbar.java +++ b/java/com/android/dialer/main/impl/toolbar/MainToolbar.java @@ -113,9 +113,9 @@ public final class MainToolbar extends Toolbar implements PopupMenu.OnMenuItemCl searchBar.collapse(animate); } - /** @see SearchBarView#collapse(boolean) */ - public void expand(boolean animate, Optional<String> text) { - searchBar.expand(animate, text); + /** @see SearchBarView#expand(boolean, Optional, boolean) */ + public void expand(boolean animate, Optional<String> text, boolean requestFocus) { + searchBar.expand(animate, text, requestFocus); } public boolean isSlideUp() { 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); } }); |