Clear fragments properly when search term is erased.

Specifically, in the scenario in the bug the dialpad was not shown
but we actually wanted to clear the speed dial fragment, not the
regular search fragment. Change this to affect the visible fragment,
rather than whether or not the dialpad is shown.

This onClick pathway is no longer used too, so deleting.

Bug: 15516704
Change-Id: Icd4419e0746ce0e2bcb9c9437dbac77d64bb8c98
diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java
index 19af4ef..f5a2d3e 100644
--- a/src/com/android/dialer/DialtactsActivity.java
+++ b/src/com/android/dialer/DialtactsActivity.java
@@ -310,9 +310,9 @@
                 }
             }
 
-            if (mIsDialpadShown && mSmartDialSearchFragment != null) {
+            if (mSmartDialSearchFragment != null && mSmartDialSearchFragment.isVisible()) {
                 mSmartDialSearchFragment.setQueryString(mSearchQuery, false /* delaySelection */);
-            } else if (mRegularSearchFragment != null) {
+            } else if (mRegularSearchFragment != null && mRegularSearchFragment.isVisible()) {
                 mRegularSearchFragment.setQueryString(mSearchQuery, false /* delaySelection */);
             }
         }
@@ -550,13 +550,6 @@
                     mDialpadFragment.dialButtonPressed();
                 }
                 break;
-            case R.id.search_close_button:
-                // Clear the search field
-                if (!TextUtils.isEmpty(mSearchView.getText())) {
-                    mDialpadFragment.clearDialpad();
-                    mSearchView.setText(null);
-                }
-                break;
             case R.id.voice_search_button:
                 try {
                     startActivityForResult(new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH),