diff options
author | Michael Kolb <kolby@google.com> | 2010-12-14 10:36:11 -0800 |
---|---|---|
committer | Michael Kolb <kolby@google.com> | 2010-12-15 09:12:17 -0800 |
commit | cfa3af5c59abb38c895416a80ef16da0ec1b5287 (patch) | |
tree | 18afb4abaf1539d46c3eec57100cca1faa5877fb /src/com/android/browser/Controller.java | |
parent | 478b2442684004d6dfe192c0ae3dd04845b9f1b7 (diff) | |
download | packages_apps_browser-cfa3af5c59abb38c895416a80ef16da0ec1b5287.zip packages_apps_browser-cfa3af5c59abb38c895416a80ef16da0ec1b5287.tar.gz packages_apps_browser-cfa3af5c59abb38c895416a80ef16da0ec1b5287.tar.bz2 |
Enable voice search
http://b/issue?id=3039695
send voice search intent
implement voice search title bar
also fixes another Urlbar focus handling bug
Change-Id: Icdcbec9ffff586d445545cc7fe86ca045022f381
Diffstat (limited to 'src/com/android/browser/Controller.java')
-rw-r--r-- | src/com/android/browser/Controller.java | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/com/android/browser/Controller.java b/src/com/android/browser/Controller.java index e88a676..d49a778 100644 --- a/src/com/android/browser/Controller.java +++ b/src/com/android/browser/Controller.java @@ -36,7 +36,6 @@ import android.content.res.Configuration; import android.database.ContentObserver; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; -import android.database.sqlite.SQLiteException; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Picture; @@ -51,10 +50,10 @@ import android.os.PowerManager.WakeLock; import android.preference.PreferenceActivity; import android.provider.Browser; import android.provider.BrowserContract; -import android.provider.BrowserContract.History; import android.provider.BrowserContract.Images; import android.provider.ContactsContract; import android.provider.ContactsContract.Intents.Insert; +import android.speech.RecognizerIntent; import android.speech.RecognizerResultsIntent; import android.text.TextUtils; import android.util.Log; @@ -94,6 +93,9 @@ public class Controller implements WebViewController, UiController { private static final String LOGTAG = "Controller"; + private static final String SEND_APP_ID_EXTRA = + "android.speech.extras.SEND_APPLICATION_ID_EXTRA"; + // public message ids public final static int LOAD_URL = 1001; @@ -1009,6 +1011,16 @@ public class Controller null, false); } + public void startVoiceSearch() { + Intent intent = new Intent(RecognizerIntent.ACTION_WEB_SEARCH); + intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, + RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH); + intent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, + mActivity.getComponentName().flattenToString()); + intent.putExtra(SEND_APP_ID_EXTRA, false); + mActivity.startActivity(intent); + } + public void activateVoiceSearchMode(String title) { mUi.showVoiceTitleBar(title); } |