Bug 1023303 - Restart IME when intercepting deleteSurroundingText call. r=wesj, a=lmandel
authorJim Chen <nchen@mozilla.com>
Mon, 30 Jun 2014 13:24:05 -0400
changeset 207588 46cace22c39dcf84cd2ca662d7034fd093ee1fd7
parent 207587 2861d0942a3422d6b77008e18659f047aa6970b4
child 207589 d98a35628d3c5ed0015f8eb5d22b879d20c89509
push id3741
push userasasaki@mozilla.com
push dateMon, 21 Jul 2014 20:25:18 +0000
treeherdermozilla-beta@4d6f46f5af68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswesj, lmandel
bugs1023303
milestone32.0a2
Bug 1023303 - Restart IME when intercepting deleteSurroundingText call. r=wesj, a=lmandel
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);