Bug 859452 - Send characters as keys when using HTC Touch Input. r=cpeterson

This commit is contained in:
Jim Chen 2013-04-18 12:39:09 -04:00
parent 25926ae20a
commit f3ea57250b
2 changed files with 19 additions and 4 deletions

View File

@ -199,7 +199,7 @@ class GeckoInputConnection
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) {
@ -214,8 +214,8 @@ class GeckoInputConnection
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
@ -641,7 +641,7 @@ class GeckoInputConnection
// 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);
@ -649,6 +649,16 @@ class GeckoInputConnection
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.

View File

@ -19,6 +19,7 @@ final class InputMethods {
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";
@ -56,6 +57,10 @@ final class InputMethods {
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) ||