diff options
| author | Leon Scroggins <scroggo@google.com> | 2010-02-01 16:14:11 -0500 |
|---|---|---|
| committer | Leon Scroggins <scroggo@google.com> | 2010-02-01 16:53:47 -0500 |
| commit | a1cc3fdce19a336c251297c61cd83ac6cf767cd1 (patch) | |
| tree | 943da2e0836557314fecd1a0a6ca5590b21a118b /src | |
| parent | 0a1d838ccd16ac08300bb8ac89b61ee0c956a49b (diff) | |
| download | packages_apps_Browser-a1cc3fdce19a336c251297c61cd83ac6cf767cd1.tar.gz packages_apps_Browser-a1cc3fdce19a336c251297c61cd83ac6cf767cd1.tar.bz2 packages_apps_Browser-a1cc3fdce19a336c251297c61cd83ac6cf767cd1.zip | |
Use the constants defined in RecognizerResultsIntent for voice search.
Diffstat (limited to 'src')
| -rw-r--r-- | src/com/android/browser/BrowserActivity.java | 15 | ||||
| -rw-r--r-- | src/com/android/browser/BrowserProvider.java | 3 | ||||
| -rw-r--r-- | src/com/android/browser/Tab.java | 12 |
3 files changed, 14 insertions, 16 deletions
diff --git a/src/com/android/browser/BrowserActivity.java b/src/com/android/browser/BrowserActivity.java index 3f7c9e985..6167b9a7f 100644 --- a/src/com/android/browser/BrowserActivity.java +++ b/src/com/android/browser/BrowserActivity.java @@ -67,6 +67,7 @@ import android.provider.ContactsContract; import android.provider.ContactsContract.Intents.Insert; import android.provider.Downloads; import android.provider.MediaStore; +import android.speech.RecognizerResultsIntent; import android.text.IClipboard; import android.text.TextUtils; import android.text.format.DateFormat; @@ -387,7 +388,8 @@ public class BrowserActivity extends Activity final Tab t = mTabControl.createNewTab( (Intent.ACTION_VIEW.equals(action) && intent.getData() != null) - || Tab.VoiceSearchData.VOICE_SEARCH_RESULTS.equals(action), + || RecognizerResultsIntent.ACTION_VOICE_SEARCH_RESULTS + .equals(action), intent.getStringExtra(Browser.EXTRA_APPLICATION_ID), urlData.mUrl); mTabControl.setCurrentTab(t); attachTabToContentView(t); @@ -470,8 +472,8 @@ public class BrowserActivity extends Activity // just resume the browser return; } - boolean activateVoiceSearch = Tab.VoiceSearchData.VOICE_SEARCH_RESULTS - .equals(action); + boolean activateVoiceSearch = RecognizerResultsIntent + .ACTION_VOICE_SEARCH_RESULTS.equals(action); if (Intent.ACTION_VIEW.equals(action) || Intent.ACTION_SEARCH.equals(action) || MediaStore.INTENT_ACTION_MEDIA_SEARCH.equals(action) @@ -596,7 +598,8 @@ public class BrowserActivity extends Activity String url = null; final String action = intent.getAction(); - if (Tab.VoiceSearchData.VOICE_SEARCH_RESULTS.equals(action)) { + if (RecognizerResultsIntent.ACTION_VOICE_SEARCH_RESULTS.equals( + action)) { return false; } if (Intent.ACTION_VIEW.equals(action)) { @@ -3950,8 +3953,8 @@ public class BrowserActivity extends Activity UrlData(String url, Map<String, String> headers, Intent intent) { this.mUrl = url; this.mHeaders = headers; - if (Tab.VoiceSearchData.VOICE_SEARCH_RESULTS.equals( - intent.getAction())) { + if (RecognizerResultsIntent.ACTION_VOICE_SEARCH_RESULTS + .equals(intent.getAction())) { this.mVoiceIntent = intent; } else { this.mVoiceIntent = null; diff --git a/src/com/android/browser/BrowserProvider.java b/src/com/android/browser/BrowserProvider.java index bd6a723c1..33396a0c2 100644 --- a/src/com/android/browser/BrowserProvider.java +++ b/src/com/android/browser/BrowserProvider.java @@ -43,6 +43,7 @@ import android.preference.PreferenceManager; import android.provider.Browser; import android.provider.Settings; import android.provider.Browser.BookmarkColumns; +import android.speech.RecognizerResultsIntent; import android.text.TextUtils; import android.util.Log; import android.util.TypedValue; @@ -748,7 +749,7 @@ public class BrowserProvider extends ContentProvider { public String getString(int column) { switch (column) { case RESULT_ACTION_ID: - return Tab.VoiceSearchData.VOICE_SEARCH_RESULTS; + return RecognizerResultsIntent.ACTION_VOICE_SEARCH_RESULTS; case RESULT_TEXT_ID: // The data is used when the phone is in landscape mode. We // still want to show the result string. diff --git a/src/com/android/browser/Tab.java b/src/com/android/browser/Tab.java index 0a54eeef3..5db4848b1 100644 --- a/src/com/android/browser/Tab.java +++ b/src/com/android/browser/Tab.java @@ -38,6 +38,7 @@ import android.os.AsyncTask; import android.os.Bundle; import android.os.Message; import android.provider.Browser; +import android.speech.RecognizerResultsIntent; import android.util.Log; import android.view.KeyEvent; import android.view.LayoutInflater; @@ -170,9 +171,9 @@ class Tab { */ /* package */ void activateVoiceSearchMode(Intent intent) { ArrayList<String> results = intent.getStringArrayListExtra( - "result_strings"); + RecognizerResultsIntent.EXTRA_VOICE_SEARCH_RESULT_STRINGS); ArrayList<String> urls = intent.getStringArrayListExtra( - "result_urls"); + RecognizerResultsIntent.EXTRA_VOICE_SEARCH_RESULT_URLS); if (results != null) { // This tab is now entering voice search mode for the first time, or // a new voice search was done. @@ -205,13 +206,6 @@ class Tab { mMainView.loadUrl(mVoiceSearchData.mLastVoiceSearchUrl); } /* package */ static class VoiceSearchData { - /** - * Intent action for a voice search. Will be replaced with a global - * variable. - */ - public static final String VOICE_SEARCH_RESULTS - = "android.speech.action.VOICE_SEARCH_RESULTS"; - public VoiceSearchData(ArrayList<String> results, ArrayList<String> urls) { mVoiceSearchResults = results; |
