android 输入法软键盘屏蔽掉中文切换
2016-11-08 16:32
399 查看
android4.4.2屏蔽掉输入法的中文情节,
直接上路子:
diff --git a/packages/inputmethods/PinyinIME/res/xml/skb_sym2.xml b/packages/inputmethods/Pinyi
nIME/res/xml/skb_sym2.xml
index a55f91e..e0bdefd 100644
--- a/packages/inputmethods/PinyinIME/res/xml/skb_sym2.xml
+++ b/packages/inputmethods/PinyinIME/res/xml/skb_sym2.xml
@@ -55,7 +55,8 @@
<row width="14.696%p" key_type="1">
<key code="-2" label="中 符" width="20%p" repeat="true">
- <toggle_state state_id="@string/toggle_en_sym2" label="英 符" code="-2"/>
+ <!--toggle_state state_id="@string/toggle_en_sym2" label="英 符" code="-2"-->
+ <toggle_state state_id="@string/toggle_en_sym2" label="En" code="-2"/>
</key>
<key code="-3" key_type="3" label="\?123"/>
<key code="62" key_type="5" width="30.608%p"/>
diff --git a/packages/inputmethods/PinyinIME/src/com/android/inputmethod/pinyin/SoftKeyboard.ja
va b/packages/inputmethods/PinyinIME/src/com/android/inputmethod/pinyin/SoftKeyboard.java
index b8cc504..21c2fa0 100644
--- a/packages/inputmethods/PinyinIME/src/com/android/inputmethod/pinyin/SoftKeyboard.java
+++ b/packages/inputmethods/PinyinIME/src/com/android/inputmethod/pinyin/SoftKeyboard.java
@@ -86,6 +86,10 @@ public class SoftKeyboard {
*/
private List<KeyRow> mKeyRows;
+ //vinci add for ignore switching btn
+ private int switchRow = 2;
+ private int switchNum = 0;
+
/**
* Background of the soft keyboard. If it is null, the one in the soft
* keyboard template will be used.
@@ -316,7 +320,10 @@ public class SoftKeyboard {
SoftKey sKey = softKeys.get(i);
if (sKey.mLeft <= x && sKey.mTop <= y && sKey.mRight > x
&& sKey.mBottom > y) {
- return sKey;
+ if (switchRow < row && switchNum == i)
+ return null;
+ else
+ return sKey;
}
}
}
@@ -341,6 +348,8 @@ public class SoftKeyboard {
if (dis < nearestDis) {
nearestDis = dis;
nearestKey = sKey;
+ if (switchRow < row && switchNum == i)
+ return null;
}
}
}
--- a/packages/inputmethods/PinyinIME/src/com/android/inputmethod/pinyin/InputModeSwitcher.java
+++ b/packages/inputmethods/PinyinIME/src/com/android/inputmethod/pinyin/InputModeSwitcher.java
@@ -139,17 +139,17 @@ public class InputModeSwitcher {
/**
* Mode for inputing Chinese with soft keyboard.
*/
- public static final int MODE_SKB_CHINESE = (MASK_SKB_LAYOUT_QWERTY | MASK_LANGUAGE_CN);
+ public static final int MODE_SKB_CHINESE = (MASK_SKB_LAYOUT_QWERTY | MASK_LANGUAGE_EN);
/**
* Mode for inputing basic symbols for Chinese mode with soft keyboard.
*/
- public static final int MODE_SKB_SYMBOL1_CN = (MASK_SKB_LAYOUT_SYMBOL1 | MASK_LANGUAGE_CN)
;
+ public static final int MODE_SKB_SYMBOL1_CN = (MASK_SKB_LAYOUT_SYMBOL1 | MASK_LANGUAGE_EN)
;
/**
* Mode for inputing more symbols for Chinese mode with soft keyboard.
*/
- public static final int MODE_SKB_SYMBOL2_CN = (MASK_SKB_LAYOUT_SYMBOL2 | MASK_LANGUAGE_CN);
+ public static final int MODE_SKB_SYMBOL2_CN = (MASK_SKB_LAYOUT_SYMBOL2 | MASK_LANGUAGE_EN);
/**
* Mode for inputing English lower characters with soft keyboard.
@@ -191,7 +191,7 @@ public class InputModeSwitcher {
/**
* Mode for inputing Chinese with a hardware keyboard.
*/
- public static final int MODE_HKB_CHINESE = (MASK_LANGUAGE_CN);
+ public static final int MODE_HKB_CHINESE = (MASK_LANGUAGE_EN);
/**
* Mode for inputing English with a hardware keyboard
具体实现原理就是屏蔽掉左下角切换button,不再赘述。
直接上路子:
diff --git a/packages/inputmethods/PinyinIME/res/xml/skb_sym2.xml b/packages/inputmethods/Pinyi
nIME/res/xml/skb_sym2.xml
index a55f91e..e0bdefd 100644
--- a/packages/inputmethods/PinyinIME/res/xml/skb_sym2.xml
+++ b/packages/inputmethods/PinyinIME/res/xml/skb_sym2.xml
@@ -55,7 +55,8 @@
<row width="14.696%p" key_type="1">
<key code="-2" label="中 符" width="20%p" repeat="true">
- <toggle_state state_id="@string/toggle_en_sym2" label="英 符" code="-2"/>
+ <!--toggle_state state_id="@string/toggle_en_sym2" label="英 符" code="-2"-->
+ <toggle_state state_id="@string/toggle_en_sym2" label="En" code="-2"/>
</key>
<key code="-3" key_type="3" label="\?123"/>
<key code="62" key_type="5" width="30.608%p"/>
diff --git a/packages/inputmethods/PinyinIME/src/com/android/inputmethod/pinyin/SoftKeyboard.ja
va b/packages/inputmethods/PinyinIME/src/com/android/inputmethod/pinyin/SoftKeyboard.java
index b8cc504..21c2fa0 100644
--- a/packages/inputmethods/PinyinIME/src/com/android/inputmethod/pinyin/SoftKeyboard.java
+++ b/packages/inputmethods/PinyinIME/src/com/android/inputmethod/pinyin/SoftKeyboard.java
@@ -86,6 +86,10 @@ public class SoftKeyboard {
*/
private List<KeyRow> mKeyRows;
+ //vinci add for ignore switching btn
+ private int switchRow = 2;
+ private int switchNum = 0;
+
/**
* Background of the soft keyboard. If it is null, the one in the soft
* keyboard template will be used.
@@ -316,7 +320,10 @@ public class SoftKeyboard {
SoftKey sKey = softKeys.get(i);
if (sKey.mLeft <= x && sKey.mTop <= y && sKey.mRight > x
&& sKey.mBottom > y) {
- return sKey;
+ if (switchRow < row && switchNum == i)
+ return null;
+ else
+ return sKey;
}
}
}
@@ -341,6 +348,8 @@ public class SoftKeyboard {
if (dis < nearestDis) {
nearestDis = dis;
nearestKey = sKey;
+ if (switchRow < row && switchNum == i)
+ return null;
}
}
}
--- a/packages/inputmethods/PinyinIME/src/com/android/inputmethod/pinyin/InputModeSwitcher.java
+++ b/packages/inputmethods/PinyinIME/src/com/android/inputmethod/pinyin/InputModeSwitcher.java
@@ -139,17 +139,17 @@ public class InputModeSwitcher {
/**
* Mode for inputing Chinese with soft keyboard.
*/
- public static final int MODE_SKB_CHINESE = (MASK_SKB_LAYOUT_QWERTY | MASK_LANGUAGE_CN);
+ public static final int MODE_SKB_CHINESE = (MASK_SKB_LAYOUT_QWERTY | MASK_LANGUAGE_EN);
/**
* Mode for inputing basic symbols for Chinese mode with soft keyboard.
*/
- public static final int MODE_SKB_SYMBOL1_CN = (MASK_SKB_LAYOUT_SYMBOL1 | MASK_LANGUAGE_CN)
;
+ public static final int MODE_SKB_SYMBOL1_CN = (MASK_SKB_LAYOUT_SYMBOL1 | MASK_LANGUAGE_EN)
;
/**
* Mode for inputing more symbols for Chinese mode with soft keyboard.
*/
- public static final int MODE_SKB_SYMBOL2_CN = (MASK_SKB_LAYOUT_SYMBOL2 | MASK_LANGUAGE_CN);
+ public static final int MODE_SKB_SYMBOL2_CN = (MASK_SKB_LAYOUT_SYMBOL2 | MASK_LANGUAGE_EN);
/**
* Mode for inputing English lower characters with soft keyboard.
@@ -191,7 +191,7 @@ public class InputModeSwitcher {
/**
* Mode for inputing Chinese with a hardware keyboard.
*/
- public static final int MODE_HKB_CHINESE = (MASK_LANGUAGE_CN);
+ public static final int MODE_HKB_CHINESE = (MASK_LANGUAGE_EN);
/**
* Mode for inputing English with a hardware keyboard
具体实现原理就是屏蔽掉左下角切换button,不再赘述。
相关文章推荐
- Android Edittext 输入法软键盘屏蔽,有光标
- android自定义软键盘-中文与英文大小切换
- android Edittext 输入法软键盘屏蔽,有光标
- android安卓屏蔽禁用系统输入法,自定义软键盘,解决EditText光标问题demo
- Android在横屏状态下,打开软键盘(输入法),中文模式没有候选栏的解决方案
- [Android]横竖屏切换的屏蔽、捕获,及防止Activity的销毁
- 在 WinForm中屏蔽中文输入法
- Android 3.0 r1中文API文档(103) —— InputMethodManager [输入法]
- Android 3.0 r1中文API文档(103) —— InputMethodManager [输入法]
- Android 中文api (81)——InputMethod [输入法]
- android中TextView点击或聚焦时屏蔽系统软键盘的弹出
- winform中不能一次性切换到中文输入法的解决方法
- Android 语系设置 中文输入法
- Android 2.2模拟器调出中文输入法
- Silverlight5 无法切换输入法,无法输入中文的原因及解决初探
- Android输入法之——在代码中强制切换和获得当前输入法
- Android应用开发-- 如何在页面切换的过程中屏蔽屏幕事件?
- Ubuntu XMODIFIERS设置问题(永中office、Oracle SQL Developer无法切换中文输入法)
- 在WinForm中屏蔽中文输入法
- sql server 2005 输入法 不能输入中文 自动切换全角