Bug 1023303 - Restart IME when intercepting deleteSurroundingText call; r=wesj
authorJim Chen <nchen@mozilla.com>
Mon, 30 Jun 2014 13:24:05 -0400
changeset 191554 2b89f72bc855d709fcfc6509966a52e3e16bdace
parent 191553 34762d090431fa7082f69b3a42f3984c7780e9e8
child 191555 78517fe424721a392e0d7f78cdcfb315036a55a4
push id45618
push userkwierso@gmail.com
push dateTue, 01 Jul 2014 01:47:43 +0000
treeherdermozilla-inbound@d0787b1eebc1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswesj
bugs1023303
milestone33.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 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);