Bug 856657 - Change Go button at the same time as resetting input; r=cpeterson
authorJim Chen <nchen@mozilla.com>
Thu, 11 Apr 2013 10:54:13 -0400
changeset 128442 5820dbc75b5a7179bb6de8e95eca49f2ad843cb2
parent 128441 b16ed870d536c54d712865bd5676c180ca4b4e13
child 128443 78bdaf0577cd7e3536f496befde8772b558999f1
push id26313
push usernchen@mozilla.com
push dateThu, 11 Apr 2013 14:54:48 +0000
treeherdermozilla-inbound@78bdaf0577cd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpeterson
bugs856657
milestone23.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 856657 - Change Go button at the same time as resetting input; r=cpeterson
mobile/android/base/AwesomeBar.java
--- a/mobile/android/base/AwesomeBar.java
+++ b/mobile/android/base/AwesomeBar.java
@@ -326,38 +326,42 @@ public class AwesomeBar extends GeckoAct
         int imeAction = EditorInfo.IME_ACTION_GO;
 
         int actionBits = mText.getImeOptions() & EditorInfo.IME_MASK_ACTION;
         if (StringUtils.isSearchQuery(text, actionBits == EditorInfo.IME_ACTION_SEARCH)) {
             imageResource = R.drawable.ic_awesomebar_search;
             contentDescription = getString(R.string.search);
             imeAction = EditorInfo.IME_ACTION_SEARCH;
         }
-        mGoButton.setImageResource(imageResource);
-        mGoButton.setContentDescription(contentDescription);
 
         InputMethodManager imm = InputMethods.getInputMethodManager(mText.getContext());
         if (imm == null) {
             return;
         }
+        boolean restartInput = false;
         if (actionBits != imeAction) {
             int optionBits = mText.getImeOptions() & ~EditorInfo.IME_MASK_ACTION;
             mText.setImeOptions(optionBits | imeAction);
 
             mDelayRestartInput = (imeAction == EditorInfo.IME_ACTION_GO) &&
                                  (InputMethods.shouldDelayAwesomebarUpdate(mText.getContext()));
             if (!mDelayRestartInput) {
-                imm.restartInput(mText);
+                restartInput = true;
             }
         } else if (mDelayRestartInput) {
             // Only call delayed restartInput when actionBits == imeAction
             // so if there are two restarts in a row, the first restarts will
             // be discarded and the second restart will be properly delayed
             mDelayRestartInput = false;
+            restartInput = true;
+        }
+        if (restartInput) {
             imm.restartInput(mText);
+            mGoButton.setImageResource(imageResource);
+            mGoButton.setContentDescription(contentDescription);
         }
     }
 
     private void cancelAndFinish() {
         setResult(Activity.RESULT_CANCELED);
         finish();
         overridePendingTransition(R.anim.awesomebar_hold_still, R.anim.awesomebar_fade_out);
     }