author | lyra.lee <lyra.lee@amlogic.com> | 2011-08-12 09:28:27 (GMT) |
---|---|---|
committer | lyra.lee <lyra.lee@amlogic.com> | 2011-08-12 09:28:27 (GMT) |
commit | 4f02d5dd29d4596cb9ffb87480b24f4cde3cbd48 (patch) | |
tree | 1489d7fc494c8063886ecb76c4889dedc6d60e9b | |
parent | e01a93a72e815feec3a86ce513c43afd7d1e67bb (diff) | |
download | RemoteIME-4f02d5dd29d4596cb9ffb87480b24f4cde3cbd48.zip RemoteIME-4f02d5dd29d4596cb9ffb87480b24f4cde3cbd48.tar.gz RemoteIME-4f02d5dd29d4596cb9ffb87480b24f4cde3cbd48.tar.bz2 |
enable KEYCODE_ENTER
-rwxr-xr-x | res/values-zh/bools.xml | 2 | ||||
-rwxr-xr-x | res/values/config.xml | 5 | ||||
-rwxr-xr-x | src/com/amlogic/inputmethod/remote/EnglishInputProcessor.java | 4 | ||||
-rwxr-xr-x | src/com/amlogic/inputmethod/remote/RemoteIME.java | 37 |
4 files changed, 27 insertions, 21 deletions
diff --git a/res/values-zh/bools.xml b/res/values-zh/bools.xml index c3291be..3bb0599 100755 --- a/res/values-zh/bools.xml +++ b/res/values-zh/bools.xml @@ -15,4 +15,6 @@ --> <resources> <bool name="im_is_default">true</bool> + <!-- The default to true for most of board --> + <bool name="is_enableEnter">true</bool> </resources> diff --git a/res/values/config.xml b/res/values/config.xml new file mode 100755 index 0000000..5498562 --- a/dev/null +++ b/res/values/config.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<resources>
+ <!-- The default to true for most of board -->
+ <bool name="is_enableEnter">true</bool>
+</resources>
\ No newline at end of file diff --git a/src/com/amlogic/inputmethod/remote/EnglishInputProcessor.java b/src/com/amlogic/inputmethod/remote/EnglishInputProcessor.java index bcb7c36..642fc32 100755 --- a/src/com/amlogic/inputmethod/remote/EnglishInputProcessor.java +++ b/src/com/amlogic/inputmethod/remote/EnglishInputProcessor.java @@ -63,8 +63,8 @@ public class EnglishInputProcessor { if (realAction) { inputContext.deleteSurroundingText(1, 0); } - /* } else if (KeyEvent.KEYCODE_ENTER == keyCode) { - insert = "\n";*/ + } else if (KeyEvent.KEYCODE_ENTER == keyCode) { + insert = "\n"; } else if (KeyEvent.KEYCODE_SPACE == keyCode) { insert = " "; } else { diff --git a/src/com/amlogic/inputmethod/remote/RemoteIME.java b/src/com/amlogic/inputmethod/remote/RemoteIME.java index b58a362..17a640f 100755 --- a/src/com/amlogic/inputmethod/remote/RemoteIME.java +++ b/src/com/amlogic/inputmethod/remote/RemoteIME.java @@ -170,6 +170,8 @@ public class RemoteIME extends InputMethodService { * For English input. */ private EnglishInputProcessor mImEn; + + private Boolean mEnterEnabled; // receive ringer mode changes private BroadcastReceiver mReceiver = new BroadcastReceiver() { @@ -186,6 +188,8 @@ public class RemoteIME extends InputMethodService { Log.d(TAG, "onCreate."); } super.onCreate(); + + mEnterEnabled = getBaseContext().getResources().getBoolean(R.bool.is_enableEnter); startPinyinDecoderService(); mImEn = new EnglishInputProcessor(); @@ -339,14 +343,13 @@ public class RemoteIME extends InputMethodService { private boolean processChooseSoftKeys(int keyCode, boolean realAction) { Log.d(TAG, "ChooseSoftKeys: " + keyCode); - if (keyCode == KeyEvent.KEYCODE_DPAD_CENTER - || keyCode == KeyEvent.KEYCODE_ENTER) { + if (keyCode == KeyEvent.KEYCODE_DPAD_CENTER) { if (!realAction) return true; SoftKey key = mSkbContainer.processFunctionKey(keyCode); if (key != null) { - if(key.getKeyCode()==KeyEvent.KEYCODE_ENTER) - return false; + // if(key.getKeyCode()==KeyEvent.KEYCODE_ENTER) + // return false; responseSoftKeyEvent(key); return true; } @@ -466,11 +469,11 @@ public class RemoteIME extends InputMethodService { } return true; } - /* if (keyCode == KeyEvent.KEYCODE_ENTER) { + if (keyCode == KeyEvent.KEYCODE_ENTER) { if (!realAction) return true; sendKeyChar('\n'); return true; - }*/ + } if (keyCode == KeyEvent.KEYCODE_SPACE) { if (!realAction) return true; sendKeyChar(' '); @@ -498,10 +501,10 @@ public class RemoteIME extends InputMethodService { getCurrentInputConnection().deleteSurroundingText(1, 0); } return true; - /* } else if (keyCode == KeyEvent.KEYCODE_ENTER) { + } else if (keyCode == KeyEvent.KEYCODE_ENTER) { if (!realAction) return true; sendKeyChar('\n'); - return true;*/ + return true; } else if (keyCode == KeyEvent.KEYCODE_ALT_LEFT || keyCode == KeyEvent.KEYCODE_ALT_RIGHT || keyCode == KeyEvent.KEYCODE_SHIFT_LEFT @@ -608,7 +611,7 @@ public class RemoteIME extends InputMethodService { } } return true; - /* } else if (keyCode == KeyEvent.KEYCODE_ENTER) { + } else if (keyCode == KeyEvent.KEYCODE_ENTER) { if (!realAction) return true; if (mInputModeSwitcher.isEnterNoramlState()) { commitResultText(mDecInfo.getOrigianlSplStr().toString()); @@ -620,10 +623,9 @@ public class RemoteIME extends InputMethodService { sendKeyChar('\n'); resetToIdleState(false); } - return true;*/ + return true; } else if (keyCode == KeyEvent.KEYCODE_DPAD_CENTER - || keyCode == KeyEvent.KEYCODE_SPACE - || keyCode == KeyEvent.KEYCODE_ENTER) { + || keyCode == KeyEvent.KEYCODE_SPACE) { if (!realAction) return true; chooseCandidate(-1); return true; @@ -693,12 +695,11 @@ public class RemoteIME extends InputMethodService { chooseAndUpdate(activePos); } } - /* } else if (keyCode == KeyEvent.KEYCODE_ENTER) { + } else if (keyCode == KeyEvent.KEYCODE_ENTER) { sendKeyChar('\n'); - resetToIdleState(false);*/ + resetToIdleState(false); } else if (keyCode == KeyEvent.KEYCODE_DPAD_CENTER - || keyCode == KeyEvent.KEYCODE_SPACE - || keyCode == KeyEvent.KEYCODE_ENTER) { + || keyCode == KeyEvent.KEYCODE_SPACE) { chooseCandidate(-1); } @@ -742,9 +743,7 @@ public class RemoteIME extends InputMethodService { } else if (keyCode == KeyEvent.KEYCODE_DPAD_LEFT || keyCode == KeyEvent.KEYCODE_DPAD_RIGHT) { mComposingView.moveCursor(keyCode); - } else if ((keyCode == KeyEvent.KEYCODE_ENTER && mInputModeSwitcher - .isEnterNoramlState()) - || keyCode == KeyEvent.KEYCODE_DPAD_CENTER + } else if (keyCode == KeyEvent.KEYCODE_DPAD_CENTER || keyCode == KeyEvent.KEYCODE_SPACE) { if (ComposingView.ComposingStatus.SHOW_STRING_LOWERCASE == cmpsvStatus) { String str = mDecInfo.getOrigianlSplStr().toString(); |