Bug 702688 - Search key on awesomebar screen should dismiss it (r=mfinkle)
authorLucas Rocha <lucasr@mozilla.com>
Wed, 16 Nov 2011 15:03:52 +0000
changeset 83497 8f2c51a1f14820bc2f4d3e7097fc7ec6fdc9f001
parent 83496 644b8a0b7f9d80ba29b88b2186483490d9b4132c
child 83498 564b52d970dbd75cd9988010e3b5eda8d15fa1c5
push id519
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 00:38:35 +0000
treeherdermozilla-beta@788ea1ef610b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs702688
milestone11.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 702688 - Search key on awesomebar screen should dismiss it (r=mfinkle)
embedding/android/AwesomeBar.java
--- a/embedding/android/AwesomeBar.java
+++ b/embedding/android/AwesomeBar.java
@@ -134,30 +134,40 @@ public class AwesomeBar extends Activity
         });
     }
 
     @Override
     public void onConfigurationChanged(Configuration newConfiguration) {
         super.onConfigurationChanged(newConfiguration);
     }
 
+    @Override
+    public boolean onSearchRequested() {
+        setResult(Activity.RESULT_CANCELED);
+        finish();
+
+        return true;
+    }
+
     private void openUrlAndFinish(String url) {
         Intent resultIntent = new Intent();
         resultIntent.putExtra(URL_KEY, url);
         resultIntent.putExtra(TYPE_KEY, mType);
 
         setResult(Activity.RESULT_OK, resultIntent);
         finish();
     }
 
     @Override
     public boolean onKeyDown(int keyCode, KeyEvent event) {
         // This method is called only if the key event was not handled
         // by any of the views, which usually means the edit box lost focus
         if (keyCode == KeyEvent.KEYCODE_BACK ||
+            keyCode == KeyEvent.KEYCODE_MENU ||
+            keyCode == KeyEvent.KEYCODE_SEARCH ||
             keyCode == KeyEvent.KEYCODE_DPAD_UP ||
             keyCode == KeyEvent.KEYCODE_DPAD_DOWN ||
             keyCode == KeyEvent.KEYCODE_DPAD_LEFT ||
             keyCode == KeyEvent.KEYCODE_DPAD_RIGHT ||
             keyCode == KeyEvent.KEYCODE_DPAD_CENTER) {
             return super.onKeyDown(keyCode, event);
         } else {
             // Return focus to the edit box, and dispatch the event to it