diff options
author | Luca Zanolin <zano@google.com> | 2011-10-06 13:36:15 +0100 |
---|---|---|
committer | Luca Zanolin <zano@google.com> | 2011-10-06 13:36:15 +0100 |
commit | 535698c57dbbd0d0eef79223293526748a07dfec (patch) | |
tree | e093a5cf9b65e9321c4440fabbe26f9c53638ce2 | |
parent | ca35bc5acc80ad1380a9631770f13448677d0d34 (diff) | |
download | frameworks_base-535698c57dbbd0d0eef79223293526748a07dfec.zip frameworks_base-535698c57dbbd0d0eef79223293526748a07dfec.tar.gz frameworks_base-535698c57dbbd0d0eef79223293526748a07dfec.tar.bz2 |
Remove the mic from the keyboard in SearchView
Bug: 5357750
Change-Id: I20c87a25e95222772c6b5154d09dd681b966fd9a
-rw-r--r-- | core/java/android/widget/SearchView.java | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/core/java/android/widget/SearchView.java b/core/java/android/widget/SearchView.java index adf2b7b..6df80e4 100644 --- a/core/java/android/widget/SearchView.java +++ b/core/java/android/widget/SearchView.java @@ -92,6 +92,11 @@ public class SearchView extends LinearLayout implements CollapsibleActionView { private static final boolean DBG = false; private static final String LOG_TAG = "SearchView"; + /** + * Private constant for removing the microphone in the keyboard. + */ + private static final String IME_OPTION_NO_MICROPHONE = "nm"; + private OnQueryTextListener mOnQueryChangeListener; private OnCloseListener mOnCloseListener; private OnFocusChangeListener mOnQueryTextFocusChangeListener; @@ -256,7 +261,7 @@ public class SearchView extends LinearLayout implements CollapsibleActionView { mQueryTextView.setOnItemClickListener(mOnItemClickListener); mQueryTextView.setOnItemSelectedListener(mOnItemSelectedListener); mQueryTextView.setOnKeyListener(mTextKeyListener); - // Inform any listener of focus changes + // Inform any listener of focus changes mQueryTextView.setOnFocusChangeListener(new OnFocusChangeListener() { public void onFocusChange(View v, boolean hasFocus) { @@ -335,6 +340,12 @@ public class SearchView extends LinearLayout implements CollapsibleActionView { } // Cache the voice search capability mVoiceButtonEnabled = hasVoiceSearch(); + + if (mVoiceButtonEnabled) { + // Disable the microphone on the keyboard, as a mic is displayed near the text box + // TODO: use imeOptions to disable voice input when the new API will be available + mQueryTextView.setPrivateImeOptions(IME_OPTION_NO_MICROPHONE); + } updateViewsVisibility(isIconified()); } |