diff options
author | Andrew Lee <anwlee@google.com> | 2014-05-16 15:01:09 -0700 |
---|---|---|
committer | Andrew Lee <anwlee@google.com> | 2014-05-16 15:01:16 -0700 |
commit | 90374a77ce339f30a04fbb5d3c5faa0c84901c71 (patch) | |
tree | ee2b07b5f60be4b7e16180f7f012df4a57ce549a /src | |
parent | 7a67eab3a6e5e323934f12819eba9a72a604916f (diff) |
Only show search fragment if text is set to non-empty.
Bug: 14900155
Change-Id: I4beea8818b333d7bec2aa3fb17d9e2413e5f1965
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/dialer/DialtactsActivity.java | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java index d888de6fe..fe29d2c18 100644 --- a/src/com/android/dialer/DialtactsActivity.java +++ b/src/com/android/dialer/DialtactsActivity.java @@ -167,7 +167,6 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O private boolean mInRegularSearch; private boolean mClearSearchOnPause; private boolean mIsDialpadShown; - private boolean mIsExitingSearch; /** * The position of the currently selected tab in the attached {@link ListsFragment}. @@ -261,13 +260,15 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O Log.d(TAG, "onTextChange for mSearchView called with new query: " + newText); } - // 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, mSearchQuery); + // Show search fragment only when the query string is changed to non-empty text. + if (!TextUtils.isEmpty(newText)) { + // Call enterSearchUi only if we are switching search modes, or showing a search + // fragment for the first time. + final boolean sameSearchMode = (mIsDialpadShown && mInDialpadSearch) || + (!mIsDialpadShown && mInRegularSearch); + if (!sameSearchMode) { + enterSearchUi(mIsDialpadShown, mSearchQuery); + } } if (mIsDialpadShown && mSmartDialSearchFragment != null) { @@ -762,7 +763,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O * Shows the search fragment */ private void enterSearchUi(boolean smartDialSearch, String query) { - if (getFragmentManager().isDestroyed() || mIsExitingSearch) { + if (getFragmentManager().isDestroyed()) { // Weird race condition where fragment is doing work after the activity is destroyed // due to talkback being on (b/10209937). Just return since we can't do any // constructive here. @@ -820,8 +821,6 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O return; } - mIsExitingSearch = true; - mSearchView.setText(null); mDialpadFragment.clearDialpad(); setNotInSearchUi(); @@ -838,8 +837,6 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O transaction.commit(); mListsFragment.getView().animate().alpha(1).withLayer(); - - mIsExitingSearch = false; } /** Returns an Intent to launch Call Settings screen */ |