summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/com/android/dialer/DialtactsActivity.java93
1 files changed, 46 insertions, 47 deletions
diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java
index daeaf2c6f..a3d7e5009 100644
--- a/src/com/android/dialer/DialtactsActivity.java
+++ b/src/com/android/dialer/DialtactsActivity.java
@@ -243,55 +243,51 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
* Listener used to send search queries to the phone search fragment.
*/
private final TextWatcher mPhoneSearchQueryTextListener = new TextWatcher() {
- @Override
- public void beforeTextChanged(CharSequence s, int start, int count, int after) {
- }
+ @Override
+ public void beforeTextChanged(CharSequence s, int start, int count, int after) {
+ }
- @Override
- public void onTextChanged(CharSequence s, int start, int before, int count) {
- final String newText = s.toString();
- if (newText.equals(mSearchQuery)) {
- // If the query hasn't changed (perhaps due to activity being destroyed
- // and restored, or user launching the same DIAL intent twice), then there is
- // no need to do anything here.
- return;
- }
- mSearchQuery = newText;
- if (DEBUG) {
- Log.d(TAG, "onTextChange for mSearchView called with new query: " + newText);
- }
- final boolean dialpadSearch = mIsDialpadShown;
-
- // Show search result with non-empty text. Show a bare list otherwise.
- if (TextUtils.isEmpty(newText) && getInSearchUi()) {
- exitSearchUi();
- mSearchViewCloseButton.setVisibility(View.GONE);
- mVoiceSearchButton.setVisibility(View.VISIBLE);
- return;
- } else if (!TextUtils.isEmpty(newText)) {
- final boolean sameSearchMode = (dialpadSearch && mInDialpadSearch) ||
- (!dialpadSearch && mInRegularSearch);
- if (!sameSearchMode) {
- // call enterSearchUi only if we are switching search modes, or entering
- // search ui for the first time
- enterSearchUi(dialpadSearch, newText);
- }
-
- if (dialpadSearch && mSmartDialSearchFragment != null) {
- mSmartDialSearchFragment.setQueryString(newText, false);
- } else if (mRegularSearchFragment != null) {
- mRegularSearchFragment.setQueryString(newText, false);
- }
- mSearchViewCloseButton.setVisibility(View.VISIBLE);
- mVoiceSearchButton.setVisibility(View.GONE);
- return;
- }
+ @Override
+ public void onTextChanged(CharSequence s, int start, int before, int count) {
+ final String newText = s.toString();
+ if (newText.equals(mSearchQuery)) {
+ // If the query hasn't changed (perhaps due to activity being destroyed
+ // and restored, or user launching the same DIAL intent twice), then there is
+ // no need to do anything here.
return;
}
+ mSearchQuery = newText;
+ if (DEBUG) {
+ Log.d(TAG, "onTextChange for mSearchView called with new query: " + newText);
+ }
- @Override
- public void afterTextChanged(Editable s) {
+ // Show search result with non-empty text. Show a bare list otherwise.
+ final boolean sameSearchMode = (mIsDialpadShown && mInDialpadSearch) ||
+ (!mIsDialpadShown && mInRegularSearch);
+ if (!sameSearchMode) {
+ // call enterSearchUi only if we are switching search modes, or entering
+ // search ui for the first time
+ enterSearchUi(mIsDialpadShown, newText);
}
+
+ if (mIsDialpadShown && mSmartDialSearchFragment != null) {
+ mSmartDialSearchFragment.setQueryString(newText, false /* delaySelection */);
+ } else if (mRegularSearchFragment != null) {
+ mRegularSearchFragment.setQueryString(newText, false /* delaySelection */);
+ }
+
+ if (TextUtils.isEmpty(newText)) {
+ mSearchViewCloseButton.setVisibility(View.GONE);
+ mVoiceSearchButton.setVisibility(View.VISIBLE);
+ } else {
+ mSearchViewCloseButton.setVisibility(View.VISIBLE);
+ mVoiceSearchButton.setVisibility(View.GONE);
+ }
+ }
+
+ @Override
+ public void afterTextChanged(Editable s) {
+ }
};
@Override
@@ -397,12 +393,14 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
} else if (fragment instanceof SmartDialSearchFragment) {
mSmartDialSearchFragment = (SmartDialSearchFragment) fragment;
mSmartDialSearchFragment.setOnPhoneNumberPickerActionListener(this);
+ mSmartDialSearchFragment.setShowEmptyListForNullQuery(true);
if (mFragmentsFrame != null) {
mFragmentsFrame.setAlpha(1.0f);
}
} else if (fragment instanceof SearchFragment) {
mRegularSearchFragment = (RegularSearchFragment) fragment;
mRegularSearchFragment.setOnPhoneNumberPickerActionListener(this);
+ mRegularSearchFragment.setShowEmptyListForNullQuery(true);
if (mFragmentsFrame != null) {
mFragmentsFrame.setAlpha(1.0f);
}
@@ -786,7 +784,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
fragment.setHasOptionsMenu(false);
transaction.replace(R.id.dialtacts_frame, fragment, tag);
transaction.addToBackStack(null);
- fragment.setQueryString(query, false);
+ fragment.setQueryString(query, false /* delaySelection */);
transaction.commit();
}
@@ -823,6 +821,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
} else if (getInSearchUi()) {
mSearchView.setText(null);
mDialpadFragment.clearDialpad();
+ exitSearchUi();
} else {
super.onBackPressed();
}
@@ -865,7 +864,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
@Override
public void onListFragmentScroll(int firstVisibleItem, int visibleItemCount,
- int totalItemCount) {
+ int totalItemCount) {
// TODO: No-op for now. This should eventually show/hide the actionBar based on
// interactions with the ListsFragments.
}
@@ -944,7 +943,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
// Specify call-origin so that users will see the previous tab instead of
// CallLog screen (search UI will be automatically exited).
PhoneNumberInteraction.startInteractionForPhoneCall(
- DialtactsActivity.this, dataUri, getCallOrigin());
+ DialtactsActivity.this, dataUri, getCallOrigin());
mClearSearchOnPause = true;
}