Loading core/java/android/app/SearchDialog.java +8 −7 Original line number Diff line number Diff line Loading @@ -313,7 +313,6 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS mLaunchComponent = null; mAppSearchData = null; mSearchable = null; mActivityContext = null; mUserQuery = null; } Loading Loading @@ -411,7 +410,7 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS updateSearchAppIcon(); updateSearchBadge(); updateQueryHint(); updateVoiceButton(); updateVoiceButton(TextUtils.isEmpty(mUserQuery)); // In order to properly configure the input method (if one is being used), we // need to let it know if we'll be providing suggestions. Although it would be Loading Loading @@ -560,10 +559,13 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS /** * Update the visibility of the voice button. There are actually two voice search modes, * either of which will activate the button. * @param empty whether the search query text field is empty. If it is, then the other * criteria apply to make the voice button visible. Otherwise the voice button will not * be visible - i.e., if the user has typed a query, remove the voice button. */ private void updateVoiceButton() { private void updateVoiceButton(boolean empty) { int visibility = View.GONE; if (mSearchable.getVoiceSearchEnabled()) { if (mSearchable.getVoiceSearchEnabled() && empty) { Intent testIntent = null; if (mSearchable.getVoiceSearchLaunchWebSearch()) { testIntent = mVoiceWebSearchIntent; Loading Loading @@ -666,6 +668,7 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS // The user changed the query, remember it. mUserQuery = s == null ? "" : s.toString(); } updateVoiceButton(TextUtils.isEmpty(s)); } public void afterTextChanged(Editable s) { Loading Loading @@ -746,9 +749,6 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS return; } SearchableInfo searchable = mSearchable; // First stop the existing search before starting voice search, or else we'll end // up showing the search dialog again once we return to the app. cancel(); try { if (searchable.getVoiceSearchLaunchWebSearch()) { getContext().startActivity(mVoiceWebSearchIntent); Loading @@ -762,6 +762,7 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS // voice search before showing the button. But just in case... Log.w(LOG_TAG, "Could not find voice search activity"); } dismiss(); } }; Loading Loading
core/java/android/app/SearchDialog.java +8 −7 Original line number Diff line number Diff line Loading @@ -313,7 +313,6 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS mLaunchComponent = null; mAppSearchData = null; mSearchable = null; mActivityContext = null; mUserQuery = null; } Loading Loading @@ -411,7 +410,7 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS updateSearchAppIcon(); updateSearchBadge(); updateQueryHint(); updateVoiceButton(); updateVoiceButton(TextUtils.isEmpty(mUserQuery)); // In order to properly configure the input method (if one is being used), we // need to let it know if we'll be providing suggestions. Although it would be Loading Loading @@ -560,10 +559,13 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS /** * Update the visibility of the voice button. There are actually two voice search modes, * either of which will activate the button. * @param empty whether the search query text field is empty. If it is, then the other * criteria apply to make the voice button visible. Otherwise the voice button will not * be visible - i.e., if the user has typed a query, remove the voice button. */ private void updateVoiceButton() { private void updateVoiceButton(boolean empty) { int visibility = View.GONE; if (mSearchable.getVoiceSearchEnabled()) { if (mSearchable.getVoiceSearchEnabled() && empty) { Intent testIntent = null; if (mSearchable.getVoiceSearchLaunchWebSearch()) { testIntent = mVoiceWebSearchIntent; Loading Loading @@ -666,6 +668,7 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS // The user changed the query, remember it. mUserQuery = s == null ? "" : s.toString(); } updateVoiceButton(TextUtils.isEmpty(s)); } public void afterTextChanged(Editable s) { Loading Loading @@ -746,9 +749,6 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS return; } SearchableInfo searchable = mSearchable; // First stop the existing search before starting voice search, or else we'll end // up showing the search dialog again once we return to the app. cancel(); try { if (searchable.getVoiceSearchLaunchWebSearch()) { getContext().startActivity(mVoiceWebSearchIntent); Loading @@ -762,6 +762,7 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS // voice search before showing the button. But just in case... Log.w(LOG_TAG, "Could not find voice search activity"); } dismiss(); } }; Loading