Add an option to hide the Voice Search icon.

Some search engines do not support voice search, so provide a flag
to disable showing the icon in the SearchDialog.

Change-Id: I7ef4ad5d382edb86c08014260defa4af6d5eca0a
This commit is contained in:
Leon Scroggins III
2010-09-14 10:56:25 -04:00
parent 51c18989cf
commit 4a02800946
2 changed files with 11 additions and 1 deletions

View File

@@ -588,7 +588,9 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS
*/
private void updateVoiceButton(boolean empty) {
int visibility = View.GONE;
if (mSearchable.getVoiceSearchEnabled() && empty) {
if ((mAppSearchData == null || !mAppSearchData.getBoolean(
SearchManager.DISABLE_VOICE_SEARCH, false))
&& mSearchable.getVoiceSearchEnabled() && empty) {
Intent testIntent = null;
if (mSearchable.getVoiceSearchLaunchWebSearch()) {
testIntent = mVoiceWebSearchIntent;

View File

@@ -394,6 +394,14 @@ public class SearchManager
*/
public final static String CONTEXT_IS_VOICE = "android.search.CONTEXT_IS_VOICE";
/**
* This means that the voice icon should not be shown at all, because the
* current search engine does not support voice search.
* @hide
*/
public final static String DISABLE_VOICE_SEARCH
= "android.search.DISABLE_VOICE_SEARCH";
/**
* Reference to the shared system search service.
*/