summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYorke Lee <yorkelee@google.com>2014-04-16 11:37:21 -0700
committerYorke Lee <yorkelee@google.com>2014-04-16 11:37:21 -0700
commit3c9e7cd12f28c7e79a4b2af442c32f2b519122f1 (patch)
treee39cbf59ab0a1f97562125e13a9f366ba53d894e /src
parente00c9fe163d19ee380b922e3fcbe736216d78ccc (diff)
Don't set search query immediately if searchview is null
The SearchView is assigned only in onCreateOptionsMenu, which can happen after the dialpad query changes if the dialer is launched via a DIAL intent. Make sure we assign the query to the SearchView only after it is created. Bug: 14111006 Change-Id: Ife504362684d8b5e2d3064bf971fabbebb878149
Diffstat (limited to 'src')
-rw-r--r--src/com/android/dialer/DialtactsActivity.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java
index 8b9b71ada..54041b087 100644
--- a/src/com/android/dialer/DialtactsActivity.java
+++ b/src/com/android/dialer/DialtactsActivity.java
@@ -173,6 +173,12 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
*/
private boolean mFirstLaunch;
+ /**
+ * Search query to be applied to the SearchView in the ActionBar once
+ * onCreateOptionsMenu has been called.
+ */
+ private String mPendingSearchViewQuery;
+
// This view points to the Framelayout that houses both the search view and remove view
// containers.
private View mSearchAndRemoveViewContainer;
@@ -648,6 +654,11 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
mSearchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
mSearchView.setOnQueryTextListener(mPhoneSearchQueryTextListener);
mSearchView.setIconifiedByDefault(false);
+
+ if (mPendingSearchViewQuery != null) {
+ mSearchView.setQuery(mPendingSearchViewQuery, false);
+ mPendingSearchViewQuery = null;
+ }
return super.onCreateOptionsMenu(menu);
}
@@ -826,6 +837,12 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
}
final String normalizedQuery = SmartDialNameMatcher.normalizeNumber(query,
SmartDialNameMatcher.LATIN_SMART_DIAL_MAP);
+ if (mSearchView == null) {
+ if (!TextUtils.isEmpty(normalizedQuery)) {
+ mPendingSearchViewQuery = normalizedQuery;
+ }
+ return;
+ }
if (!TextUtils.equals(mSearchView.getQuery(), normalizedQuery)) {
if (DEBUG) {
Log.d(TAG, "onDialpadQueryChanged - new query: " + query);