summaryrefslogtreecommitdiffstats
path: root/src/com/android/browser/TitleBar.java
diff options
context:
space:
mode:
authorMichael Kolb <kolby@google.com>2011-03-20 10:01:20 -0700
committerMichael Kolb <kolby@google.com>2011-03-20 10:01:20 -0700
commit736990cb9c57a346666d4424304947c21fb78ab7 (patch)
treef1c86713ac04fa19303f4bf79e429e89838d26b4 /src/com/android/browser/TitleBar.java
parent1421c40e43eb7c35a8c326a80981ba85c9d46273 (diff)
downloadpackages_apps_browser-736990cb9c57a346666d4424304947c21fb78ab7.zip
packages_apps_browser-736990cb9c57a346666d4424304947c21fb78ab7.tar.gz
packages_apps_browser-736990cb9c57a346666d4424304947c21fb78ab7.tar.bz2
unify voice search code
Change-Id: Icf1fc84405d08da8504ac91094e67c7d8d1c901d
Diffstat (limited to 'src/com/android/browser/TitleBar.java')
-rw-r--r--src/com/android/browser/TitleBar.java27
1 files changed, 3 insertions, 24 deletions
diff --git a/src/com/android/browser/TitleBar.java b/src/com/android/browser/TitleBar.java
index f1fcdc3..361e94c 100644
--- a/src/com/android/browser/TitleBar.java
+++ b/src/com/android/browser/TitleBar.java
@@ -17,12 +17,8 @@
package com.android.browser;
import android.app.Activity;
-import android.content.Intent;
-import android.content.pm.PackageManager;
-import android.content.pm.ResolveInfo;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
-import android.speech.RecognizerIntent;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.TextUtils;
@@ -50,7 +46,6 @@ public class TitleBar extends TitleBarBase implements OnFocusChangeListener,
private Drawable mBookmarkDrawable;
private Drawable mVoiceDrawable;
private boolean mInLoad;
- private Intent mVoiceSearchIntent;
private ImageSpan mArcsSpan;
private View mContainer;
@@ -78,25 +73,9 @@ public class TitleBar extends TitleBarBase implements OnFocusChangeListener,
mHorizontalProgress = (PageProgressView) findViewById(
R.id.progress_horizontal);
- mVoiceSearchIntent = new Intent(RecognizerIntent.ACTION_WEB_SEARCH);
- mVoiceSearchIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
- RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH);
- // This extra tells voice search not to send the application id in its
- // results intent - http://b/2546173
- //
- // TODO: Make a constant for this extra.
- mVoiceSearchIntent.putExtra("android.speech.extras.SEND_APPLICATION_ID_EXTRA",
- false);
- PackageManager pm = activity.getPackageManager();
- ResolveInfo ri = pm.resolveActivity(mVoiceSearchIntent,
- PackageManager.MATCH_DEFAULT_ONLY);
Resources resources = getResources();
- if (ri == null) {
- mVoiceSearchIntent = null;
- } else {
- mVoiceDrawable = resources.getDrawable(
- android.R.drawable.ic_btn_speak_now);
- }
+ mVoiceDrawable = resources.getDrawable(
+ android.R.drawable.ic_btn_speak_now);
mBookmarkDrawable = mBookmarkButton.getDrawable();
mArcsSpan = new ImageSpan(activity, R.drawable.arcs,
ImageSpan.ALIGN_BASELINE);
@@ -122,7 +101,7 @@ public class TitleBar extends TitleBarBase implements OnFocusChangeListener,
@Override
void setInVoiceMode(boolean inVoiceMode) {
if (mInVoiceMode == inVoiceMode) return;
- mInVoiceMode = inVoiceMode && mVoiceSearchIntent != null;
+ mInVoiceMode = inVoiceMode && mUiController.supportsVoiceSearch();
Drawable titleDrawable;
if (mInVoiceMode) {
mBookmarkButton.setImageDrawable(mVoiceDrawable);