summaryrefslogtreecommitdiff
path: root/java/com/android/dialer/main
diff options
context:
space:
mode:
authorcalderwoodra <calderwoodra@google.com>2018-03-29 13:58:54 -0700
committerCopybara-Service <copybara-piper@google.com>2018-03-29 14:39:05 -0700
commit2517706323daa685779d37c56b4883334a2cb34d (patch)
treebe6dde42cb20f92c2e122f997406599449b32a89 /java/com/android/dialer/main
parent47429adac43fe3e73cffc216ce2f2948afec8830 (diff)
Fixed a few issues in search with new nav.
- back arrow in search now flips in RTL mode http://screen/1eccBLDqPp0 - search text no longer overlaps icons http://screen/Mq0omQEuZez - keyboard now always closes on pause - location permission is no longer visible in dialpad search Bug: 73088433,74784637,76117373,76440832,76441216 Test: keyboard and rtl tested manually, added test for location permission PiperOrigin-RevId: 190981686 Change-Id: Ia121d410c158df0de9cd731ab280a6d8e9b300d9
Diffstat (limited to 'java/com/android/dialer/main')
-rw-r--r--java/com/android/dialer/main/impl/MainSearchController.java27
1 files changed, 18 insertions, 9 deletions
diff --git a/java/com/android/dialer/main/impl/MainSearchController.java b/java/com/android/dialer/main/impl/MainSearchController.java
index c2ff0512a..7b4bc3569 100644
--- a/java/com/android/dialer/main/impl/MainSearchController.java
+++ b/java/com/android/dialer/main/impl/MainSearchController.java
@@ -149,25 +149,24 @@ public class MainSearchController implements SearchBarListener {
// Show Search
if (searchFragment == null) {
- // TODO(a bug): zero suggest results aren't actually shown but this enabled the nearby
- // places promo to be shown.
- searchFragment = NewSearchFragment.newInstance(/* showZeroSuggest=*/ true);
+ searchFragment = NewSearchFragment.newInstance();
transaction.add(R.id.search_fragment_container, searchFragment, SEARCH_FRAGMENT_TAG);
transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
} else if (!isSearchVisible()) {
transaction.show(searchFragment);
}
- searchFragment.setQuery("", CallInitiationType.Type.DIALPAD);
// Show Dialpad
if (getDialpadFragment() == null) {
DialpadFragment dialpadFragment = new DialpadFragment();
dialpadFragment.setStartedFromNewIntent(fromNewIntent);
transaction.add(R.id.dialpad_fragment_container, dialpadFragment, DIALPAD_FRAGMENT_TAG);
+ searchFragment.setQuery("", CallInitiationType.Type.DIALPAD);
} else {
DialpadFragment dialpadFragment = getDialpadFragment();
dialpadFragment.setStartedFromNewIntent(fromNewIntent);
transaction.show(dialpadFragment);
+ searchFragment.setQuery(dialpadFragment.getQuery(), CallInitiationType.Type.DIALPAD);
}
transaction.commit();
@@ -258,7 +257,7 @@ public class MainSearchController implements SearchBarListener {
} else {
Logger.get(activity)
.logImpression(DialerImpression.Type.MAIN_TOUCH_SEARCH_LIST_TO_HIDE_KEYBOARD);
- toolbar.hideKeyboard();
+ closeKeyboard();
}
}
}
@@ -348,6 +347,14 @@ public class MainSearchController implements SearchBarListener {
return isSearchVisible();
}
+ /** Closes the keyboard if necessary. */
+ private void closeKeyboard() {
+ NewSearchFragment fragment = getSearchFragment();
+ if (fragment != null && fragment.isAdded()) {
+ toolbar.hideKeyboard();
+ }
+ }
+
/**
* Opens search in regular/search bar search mode.
*
@@ -376,9 +383,7 @@ public class MainSearchController implements SearchBarListener {
// Show Search
if (searchFragment == null) {
- // TODO(a bug): zero suggest results aren't actually shown but this enabled the nearby
- // places promo to be shown.
- searchFragment = NewSearchFragment.newInstance(true);
+ searchFragment = NewSearchFragment.newInstance();
transaction.add(R.id.search_fragment_container, searchFragment, SEARCH_FRAGMENT_TAG);
transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
} else if (!isSearchVisible()) {
@@ -446,6 +451,9 @@ public class MainSearchController implements SearchBarListener {
@Override
public void onActivityPause() {
+ LogUtil.enterBlock("MainSearchController.onActivityPause");
+ closeKeyboard();
+
if (closeSearchOnPause) {
closeSearchOnPause = false;
if (isInSearch()) {
@@ -462,7 +470,7 @@ public class MainSearchController implements SearchBarListener {
closeSearchOnPause = !requestingPermission;
// Always hide the keyboard when the user leaves dialer (including permission requests)
- toolbar.hideKeyboard();
+ closeKeyboard();
}
}
@@ -473,6 +481,7 @@ public class MainSearchController implements SearchBarListener {
@Override
public void requestingPermission() {
+ LogUtil.enterBlock("MainSearchController.requestingPermission");
requestingPermission = true;
}