diff options
| author | Michael Kolb <kolby@google.com> | 2012-06-04 16:31:58 -0700 |
|---|---|---|
| committer | Michael Kolb <kolby@google.com> | 2012-06-04 16:36:41 -0700 |
| commit | 0b12912da64ff5b2917d4f50eb91df2e76457d08 (patch) | |
| tree | 8b7400e74a8c9f59e6f5db0c62761e03ba5193c9 /src/com/android/browser/NavigationBarBase.java | |
| parent | 9d64d9a8016cc862296b20c4db545018373bdea5 (diff) | |
Enable voice search in omnibox
Bug: 6601348
Bring back voice search. Also fixes focus bug for fixed titlebar.
Change-Id: I83c8ad96957b62c23ad0bbb35685712687d11213
Diffstat (limited to 'src/com/android/browser/NavigationBarBase.java')
| -rw-r--r-- | src/com/android/browser/NavigationBarBase.java | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/com/android/browser/NavigationBarBase.java b/src/com/android/browser/NavigationBarBase.java index 37b11c84..7f100ff6 100644 --- a/src/com/android/browser/NavigationBarBase.java +++ b/src/com/android/browser/NavigationBarBase.java @@ -21,7 +21,6 @@ import android.content.Intent; import android.graphics.Bitmap; import android.graphics.drawable.Drawable; import android.os.Bundle; -import android.speech.RecognizerResultsIntent; import android.text.Editable; import android.text.TextWatcher; import android.util.AttributeSet; @@ -35,8 +34,6 @@ import android.widget.LinearLayout; import com.android.browser.UrlInputView.UrlInputListener; -import java.util.List; - public class NavigationBarBase extends LinearLayout implements OnClickListener, UrlInputListener, OnFocusChangeListener, TextWatcher { @@ -129,7 +126,10 @@ public class NavigationBarBase extends LinearLayout implements } void stopEditingUrl() { - mUrlInput.clearFocus(); + WebView currentTopWebView = mUiController.getCurrentTopWebView(); + if (currentTopWebView != null) { + currentTopWebView.requestFocus(); + } } void setDisplayTitle(String title) { @@ -156,10 +156,7 @@ public class NavigationBarBase extends LinearLayout implements */ @Override public void onAction(String text, String extra, String source) { - WebView currentTopWebView = mUiController.getCurrentTopWebView(); - if (currentTopWebView != null) { - currentTopWebView.requestFocus(); - } + stopEditingUrl(); if (UrlInputView.TYPED.equals(source)) { String url = UrlUtils.smartUrlFilter(text, false); Tab t = mBaseUi.getActiveTab(); @@ -220,7 +217,7 @@ public class NavigationBarBase extends LinearLayout implements public boolean dispatchKeyEventPreIme(KeyEvent evt) { if (evt.getKeyCode() == KeyEvent.KEYCODE_BACK) { // catch back key in order to do slightly more cleanup than usual - mUrlInput.clearFocus(); + stopEditingUrl(); return true; } return super.dispatchKeyEventPreIme(evt); @@ -260,6 +257,11 @@ public class NavigationBarBase extends LinearLayout implements public void onTabDataChanged(Tab tab) { } + public void onVoiceResult(String s) { + startEditingUrl(true, true); + onCopySuggestion(s); + } + @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @@ -268,4 +270,5 @@ public class NavigationBarBase extends LinearLayout implements @Override public void afterTextChanged(Editable s) { } + } |
