---
.../keyboard/MainKeyboardView.java | 30 +++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java
index 209a50d..815b25d 100644
--- a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java
@@ -823,6 +823,8 @@ public final class MainKeyboardView extends KeyboardView implements DrawingProxy
Key tmp = sortedKeys.get(i);
if (k.getY() >= tmp.getY())
continue;
+ if (tmp.getCode() == Constants.CODE_UNSPECIFIED)
+ continue;
if (checkFacing(k, tmp)) {
ret = tmp;
lastFocusIndex = i;
@@ -859,6 +861,8 @@ public final class MainKeyboardView extends KeyboardView implements DrawingProxy
Key tmp = sortedKeys.get(i);
if (k.getY() <= tmp.getY())
continue;
+ if (tmp.getCode() == Constants.CODE_UNSPECIFIED)
+ continue;
if (checkFacing(k, tmp)) {
ret = tmp;
lastFocusIndex = i;
@@ -905,6 +909,18 @@ public final class MainKeyboardView extends KeyboardView implements DrawingProxy
if (lastFocusIndex > 0 && lastFocusIndex < sz) {
lastFocusIndex--;
ret = sortedKeys.get(lastFocusIndex);
+ while (ret.getCode() == Constants.CODE_UNSPECIFIED) {
+ lastFocusIndex--;
+ if (lastFocusIndex < 0) {
+ while (ret.getCode() == Constants.CODE_UNSPECIFIED) {
+ lastFocusIndex++;
+ ret = sortedKeys.get(lastFocusIndex);
+ }
+
+ } else {
+ ret = sortedKeys.get(lastFocusIndex);
+ }
+ }
changeFocusState(lastFocusKey, ret);
KeyEventProcessedFlag = true;
LatinIME.mIsFocusInKeyboard = true;
@@ -924,6 +940,20 @@ public final class MainKeyboardView extends KeyboardView implements DrawingProxy
if (lastFocusIndex >= 0 && lastFocusIndex < sz -1) {
lastFocusIndex++;
ret = sortedKeys.get(lastFocusIndex);
+ //we do not move to undefined keys
+ while (ret.getCode() == Constants.CODE_UNSPECIFIED) {
+ lastFocusIndex++;
+ // 最后一位或连续多位为无效按键
+ if (lastFocusIndex >= sz) {
+ while (ret.getCode() == Constants.CODE_UNSPECIFIED) {
+ lastFocusIndex--;
+ ret = sortedKeys.get(lastFocusIndex);
+ }
+
+ } else {
+ ret = sortedKeys.get(lastFocusIndex);
+ }
+ }
changeFocusState(lastFocusKey, ret);
}
if (ret != null && DEBUG) {
--
2.17.1
Amlogic Android N LatinIME 数字键盘移动到无效键导致输入法崩溃
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
推荐阅读更多精彩内容
- 1.求s=a+aa+aaa+aa...a的值,其中a是一个数字,n表示a的位数,例如:2+22+222+2222+...
- 一、基本信息 姓名、性别、编号、日期、起止时间、主试、常用输入法 二、测试对象 1、系统输入法竖屏9键&26键(版...
- 一、效果图: 二、Code: /** * 1、获取main在窗体的可视区域 * 2、获取main在窗体的不可视区域...