author | Jim Chen <nchen@mozilla.com> |
Thu, 18 Apr 2013 12:39:09 -0400 | |
changeset 129223 | a520eb3b34ae63cde7a4ad99c3d9ed66257a5ff2 |
parent 129222 | 9dd64ef21eff04910856d1d287b74700d8363369 |
child 129224 | cf3a2de4af838b094dc79cabf0d4cb090c21934a |
push id | 24562 |
push user | ryanvm@gmail.com |
push date | Fri, 19 Apr 2013 01:24:04 +0000 |
treeherder | mozilla-central@f8d27fe5d7c0 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | cpeterson |
bugs | 859452 |
milestone | 23.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
|
mobile/android/base/GeckoInputConnection.java | file | annotate | diff | comparison | revisions | |
mobile/android/base/InputMethods.java | file | annotate | diff | comparison | revisions |
--- a/mobile/android/base/GeckoInputConnection.java +++ b/mobile/android/base/GeckoInputConnection.java @@ -194,33 +194,33 @@ class GeckoInputConnection private final GeckoEditableClient mEditableClient; protected int mBatchEditCount; private ExtractedTextRequest mUpdateRequest; private final ExtractedText mUpdateExtract = new ExtractedText(); private boolean mBatchSelectionChanged; private boolean mBatchTextChanged; private long mLastRestartInputTime; - private final InputConnection mPluginInputConnection; + private final InputConnection mKeyInputConnection; public static GeckoEditableListener create(View targetView, GeckoEditableClient editable) { if (DEBUG) return DebugGeckoInputConnection.create(targetView, editable); else return new GeckoInputConnection(targetView, editable); } protected GeckoInputConnection(View targetView, GeckoEditableClient editable) { super(targetView, true); mEditableClient = editable; mIMEState = IME_STATE_DISABLED; - // InputConnection for plugins, which don't have full editors - mPluginInputConnection = new BaseInputConnection(targetView, false); + // InputConnection that sends keys for plugins, which don't have full editors + mKeyInputConnection = new BaseInputConnection(targetView, false); } @Override public synchronized boolean beginBatchEdit() { mBatchEditCount++; mEditableClient.setUpdateGecko(false); return true; } @@ -636,25 +636,35 @@ class GeckoInputConnection popup.onInputMethodChanged(mCurrentInputMethod); } } if (mIMEState == IME_STATE_PLUGIN) { // Since we are using a temporary string as the editable, the selection is at 0 outAttrs.initialSelStart = 0; outAttrs.initialSelEnd = 0; - return mPluginInputConnection; + return mKeyInputConnection; } Editable editable = getEditable(); outAttrs.initialSelStart = Selection.getSelectionStart(editable); outAttrs.initialSelEnd = Selection.getSelectionEnd(editable); return this; } @Override + public boolean commitText(CharSequence text, int newCursorPosition) { + if (InputMethods.shouldCommitCharAsKey(mCurrentInputMethod) && + text.length() == 1 && newCursorPosition > 0) { + // mKeyInputConnection is a BaseInputConnection that commits text as keys; + return mKeyInputConnection.commitText(text, newCursorPosition); + } + return super.commitText(text, newCursorPosition); + } + + @Override public boolean sendKeyEvent(KeyEvent event) { // BaseInputConnection.sendKeyEvent() dispatches the key event to the main thread. // In order to ensure events are processed in the proper order, we must block the // IC thread until the main thread finishes processing the key event super.sendKeyEvent(event); final View v = getView(); if (v == null) { return false;
--- a/mobile/android/base/InputMethods.java +++ b/mobile/android/base/InputMethods.java @@ -14,16 +14,17 @@ import android.view.inputmethod.InputMet import java.util.Collection; import java.util.Locale; final class InputMethods { public static final String METHOD_ANDROID_LATINIME = "com.android.inputmethod.latin/.LatinIME"; public static final String METHOD_ATOK = "com.justsystems.atokmobile.service/.AtokInputMethodService"; public static final String METHOD_GOOGLE_JAPANESE_INPUT = "com.google.android.inputmethod.japanese/.MozcService"; public static final String METHOD_GOOGLE_LATINIME = "com.google.android.inputmethod.latin/com.android.inputmethod.latin.LatinIME"; + public static final String METHOD_HTC_TOUCH_INPUT = "com.htc.android.htcime/.HTCIMEService"; public static final String METHOD_IWNN = "jp.co.omronsoft.iwnnime.ml/.standardcommon.IWnnLanguageSwitcher"; public static final String METHOD_OPENWNN_PLUS = "com.owplus.ime.openwnnplus/.OpenWnnJAJP"; public static final String METHOD_SAMSUNG = "com.sec.android.inputmethod/.SamsungKeypad"; public static final String METHOD_SIMEJI = "com.adamrocker.android.input.simeji/.OpenWnnSimeji"; public static final String METHOD_SWIFTKEY = "com.touchtype.swiftkey/com.touchtype.KeyboardService"; public static final String METHOD_SWYPE = "com.swype.android.inputmethod/.SwypeInputMethod"; public static final String METHOD_SWYPE_BETA = "com.nuance.swype.input/.IME"; public static final String METHOD_TOUCHPAL_KEYBOARD = "com.cootek.smartinputv5/com.cootek.smartinput5.TouchPalIME"; @@ -51,16 +52,20 @@ final class InputMethods { } public static boolean needsSoftResetWorkaround(String inputMethod) { // Stock latin IME on Android 4.2 and above return Build.VERSION.SDK_INT >= 17 && (METHOD_ANDROID_LATINIME.equals(inputMethod) || METHOD_GOOGLE_LATINIME.equals(inputMethod)); } + public static boolean shouldCommitCharAsKey(String inputMethod) { + return METHOD_HTC_TOUCH_INPUT.equals(inputMethod); + } + public static boolean shouldDelayAwesomebarUpdate(Context context) { String inputMethod = getCurrentInputMethod(context); return METHOD_SAMSUNG.equals(inputMethod) || METHOD_SWIFTKEY.equals(inputMethod); } public static boolean isGestureKeyboard(Context context) { // SwiftKey is a gesture keyboard, but it doesn't seem to need any special-casing