Bug 1023303 - Restart IME when intercepting deleteSurroundingText call; r=wesj
authorJim Chen <nchen@mozilla.com>
Mon, 30 Jun 2014 13:24:05 -0400
changeset 191462 2b89f72bc855d709fcfc6509966a52e3e16bdace
parent 191461 34762d090431fa7082f69b3a42f3984c7780e9e8
child 191463 78517fe424721a392e0d7f78cdcfb315036a55a4
push id7520
push usernchen@mozilla.com
push dateMon, 30 Jun 2014 17:24:34 +0000
treeherderfx-team@78517fe42472 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswesj
bugs1023303
milestone33.0a1
Bug 1023303 - Restart IME when intercepting deleteSurroundingText call; r=wesj
mobile/android/base/toolbar/ToolbarEditText.java
--- a/mobile/android/base/toolbar/ToolbarEditText.java
+++ b/mobile/android/base/toolbar/ToolbarEditText.java
@@ -363,16 +363,22 @@ public class ToolbarEditText extends Cus
 
         return new InputConnectionWrapper(ic, false) {
             @Override
             public boolean deleteSurroundingText(final int beforeLength, final int afterLength) {
                 if (removeAutocomplete(getText())) {
                     // If we have autocomplete text, the cursor is at the boundary between
                     // regular and autocomplete text. So regardless of which direction we
                     // are deleting, we should delete the autocomplete text first.
+                    // Make the IME aware that we interrupted the deleteSurroundingText call,
+                    // by restarting the IME.
+                    final InputMethodManager imm = InputMethods.getInputMethodManager(mContext);
+                    if (imm != null) {
+                        imm.restartInput(ToolbarEditText.this);
+                    }
                     return false;
                 }
                 return super.deleteSurroundingText(beforeLength, afterLength);
             }
 
             private boolean removeAutocompleteOnComposing(final CharSequence text) {
                 final Editable editable = getText();
                 final int composingStart = BaseInputConnection.getComposingSpanStart(editable);