- if (shouldShowVoiceSearch(queryEmpty)
- && getVoiceSearch().shouldShowVoiceSearch()) {
+ if (isVoiceShow() && shouldShowVoiceSearch(queryEmpty)
+ && getVoiceSearch().shouldShowVoiceSearch
+ ()) {
mVoiceSearchButton.setVisibility(View.VISIBLE);
mQueryTextView.setPrivateImeOptions(IME_OPTION_NO_MICROPHONE);
} else {
@@ -285,6 +298,16 @@ public abstract class SearchActivityView extends RelativeLayout {
}
}
+ public boolean isVoiceShow() {
+ PackageManager packageManager = getContext().getPackageManager();
+ List<ResolveInfo> activities = packageManager.queryIntentActivities(new Intent(
+ RecognizerIntent.ACTION_WEB_SEARCH), 0);
+ if (activities.size() != 0) return true;
+ return false;
+ }
- && getVoiceSearch().shouldShowVoiceSearch()) {
+ if (isVoiceShow() && shouldShowVoiceSearch(queryEmpty)
+ && getVoiceSearch().shouldShowVoiceSearch
+ ()) {
mVoiceSearchButton.setVisibility(View.VISIBLE);
mQueryTextView.setPrivateImeOptions(IME_OPTION_NO_MICROPHONE);
} else {
@@ -285,6 +298,16 @@ public abstract class SearchActivityView extends RelativeLayout {
}
}
+ public boolean isVoiceShow() {
+ PackageManager packageManager = getContext().getPackageManager();
+ List<ResolveInfo> activities = packageManager.queryIntentActivities(new Intent(
+ RecognizerIntent.ACTION_WEB_SEARCH), 0);
+ if (activities.size() != 0) return true;
+ return false;
+ }