Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a9776efc authored by calderwoodra's avatar calderwoodra Committed by Copybara-Service
Browse files

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
parent a4377191
Loading
Loading
Loading
Loading
+4 −15
Original line number Diff line number Diff line
@@ -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.
    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();
  }