Bug 1158906 - Catch hardware keyboard return. r=margaret
authorNathan Toone <nathan@toonetown.com>
Mon, 27 Apr 2015 14:15:13 -0600
changeset 272998 3f2af35fb884b1b50ca9d6d2a418a9f3e194f00e
parent 272997 9463c48c807d980043e84cb786c8c98450dbca5b
child 272999 e93eb477c5aa05405f43bac72566177440da2594
push id863
push userraliiev@mozilla.com
push dateMon, 03 Aug 2015 13:22:43 +0000
treeherdermozilla-release@f6321b14228d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmargaret
bugs1158906
milestone40.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 1158906 - Catch hardware keyboard return. r=margaret In addition to keying off of the IME_ACTION_SEARCH, we also key of of IME_ACTION_UNSPECIFIED which is what is sent by the android emulator hardware keyboard.
mobile/android/search/java/org/mozilla/search/autocomplete/SearchBar.java
--- a/mobile/android/search/java/org/mozilla/search/autocomplete/SearchBar.java
+++ b/mobile/android/search/java/org/mozilla/search/autocomplete/SearchBar.java
@@ -79,17 +79,18 @@ public class SearchBar extends FrameLayo
                 updateClearButtonVisibility();
             }
         });
 
         // Attach a listener for the "search" key on the keyboard.
         editText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
             @Override
             public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
-                if (listener != null && actionId == EditorInfo.IME_ACTION_SEARCH) {
+                if (listener != null &&
+                    (actionId == EditorInfo.IME_ACTION_UNSPECIFIED || actionId == EditorInfo.IME_ACTION_SEARCH)) {
                     // The user searched without using search engine suggestions.
                     Telemetry.sendUIEvent(TelemetryContract.Event.SEARCH, TelemetryContract.Method.ACTIONBAR, "text");
                     listener.onSubmit(v.getText().toString());
                     return true;
                 }
                 return false;
             }
         });