diff options
author | calderwoodra <calderwoodra@google.com> | 2018-02-15 12:47:04 -0800 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-02-22 01:26:00 -0800 |
commit | a9776efc28f13671fe01c7a2ca5513d462e00b3c (patch) | |
tree | 7146a3f81ae20729260191d294e4baca01e8e3ce /java | |
parent | a4377191c9a8201d983f66979b56b26b6221967b (diff) |
Do no preload dialpad fragment when opening search through search bar.
If the dialpad is preloaded it steals focus from the search bar. Aside
from this, I believe this change also caused other regressions and makes
the code harder to understand.
Test: tap
PiperOrigin-RevId: 185883795
Change-Id: Idbaca1df50ed02a698eb454cbb9de26a11e35f05
Diffstat (limited to 'java')
-rw-r--r-- | java/com/android/dialer/main/impl/MainSearchController.java | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/java/com/android/dialer/main/impl/MainSearchController.java b/java/com/android/dialer/main/impl/MainSearchController.java index e0d42abe6..9b734f40c 100644 --- a/java/com/android/dialer/main/impl/MainSearchController.java +++ b/java/com/android/dialer/main/impl/MainSearchController.java @@ -269,15 +269,12 @@ public class MainSearchController implements SearchBarListener { mainActivity.getFragmentManager().beginTransaction().remove(getSearchFragment()).commit(); // Clear the dialpad so the phone number isn't persisted between search sessions. - getDialpadFragment().clearDialpad(); + if (getDialpadFragment() != null) { + getDialpadFragment().clearDialpad(); + } } - /** - * Returns {@link DialpadFragment}. - * - * <p>Unless this method is being called for the first time in {@link #openSearch(Optional)} or - * {@link #showDialpad(boolean)}, it should never return null. - */ + @Nullable protected DialpadFragment getDialpadFragment() { return (DialpadFragment) mainActivity.getFragmentManager().findFragmentByTag(DIALPAD_FRAGMENT_TAG); @@ -334,14 +331,6 @@ public class MainSearchController implements SearchBarListener { transaction.show(getSearchFragment()); } - // Add the dialpad fragment but keep it hidden - if (getDialpadFragment() == null) { - DialpadFragment dialpadFragment = new DialpadFragment(); - transaction - .add(R.id.dialpad_fragment_container, dialpadFragment, DIALPAD_FRAGMENT_TAG) - .hide(dialpadFragment); - } - transaction.commit(); } |