author | lianghu.su <lianghu.su@amlogic.com> | 2013-10-17 08:30:35 (GMT) |
---|---|---|
committer | tao.dong <tao.dong@amlogic.com> | 2013-11-26 07:42:36 (GMT) |
commit | 501d1ccb6ce66eadc099b170f938d51ab61c9a72 (patch) | |
tree | 0d683846de8cb4d30f4fcc0d055201a5d9b0f1e4 | |
parent | 40915276ef044e0301436a59609ec8edec8cf787 (diff) | |
download | RemoteIME-501d1ccb6ce66eadc099b170f938d51ab61c9a72.zip RemoteIME-501d1ccb6ce66eadc099b170f938d51ab61c9a72.tar.gz RemoteIME-501d1ccb6ce66eadc099b170f938d51ab61c9a72.tar.bz2 |
pd [#80905]: make RemoteIME convinent to move from one side to the other.
-rwxr-xr-x | src/com/amlogic/inputmethod/remote/SkbContainer.java | 21 | ||||
-rwxr-xr-x | src/com/amlogic/inputmethod/remote/SoftKeyboard.java | 13 |
2 files changed, 28 insertions, 6 deletions
diff --git a/src/com/amlogic/inputmethod/remote/SkbContainer.java b/src/com/amlogic/inputmethod/remote/SkbContainer.java index b1a57da..f0a8adf 100755 --- a/src/com/amlogic/inputmethod/remote/SkbContainer.java +++ b/src/com/amlogic/inputmethod/remote/SkbContainer.java @@ -707,9 +707,13 @@ public class SkbContainer extends RelativeLayout implements OnTouchListener { mSoftKeyFocus=skb.getKey(0,0); else { - int x = mSoftKeyFocus.mLeft-skb.getKeyXMargin()-10; - int y = mSoftKeyFocus.mTop+mSoftKeyFocus.height()/2; - mSoftKeyFocus = skb.mapToKey(x,y); + if (mSoftKeyFocus.mLocation > 0) { + int x = mSoftKeyFocus.mLeft-skb.getKeyXMargin()-10; + int y = mSoftKeyFocus.mTop+mSoftKeyFocus.height()/2; + mSoftKeyFocus = skb.mapToKey(x,y); + } else { + mSoftKeyFocus = skb.getKey(mSoftKeyFocus.mRow, -1); + } } } else if (keyCode == KeyEvent.KEYCODE_DPAD_RIGHT) { @@ -737,9 +741,14 @@ public class SkbContainer extends RelativeLayout implements OnTouchListener { mSoftKeyFocus=skb.getKey(0,0); else { - int x = mSoftKeyFocus.mRight+skb.getKeyXMargin(); - int y = mSoftKeyFocus.mTop+mSoftKeyFocus.height()/2; - mSoftKeyFocus = skb.mapToKey(x,y); + int keyNum = skb.getLocNum(mSoftKeyFocus.mRow); + if (mSoftKeyFocus.mLocation < keyNum - 1) { + int x = mSoftKeyFocus.mRight+skb.getKeyXMargin(); + int y = mSoftKeyFocus.mTop+mSoftKeyFocus.height()/2; + mSoftKeyFocus = skb.mapToKey(x,y); + } else { + mSoftKeyFocus = skb.getKey(mSoftKeyFocus.mRow, 0); + } } } diff --git a/src/com/amlogic/inputmethod/remote/SoftKeyboard.java b/src/com/amlogic/inputmethod/remote/SoftKeyboard.java index 6c893b2..d00c365 100755 --- a/src/com/amlogic/inputmethod/remote/SoftKeyboard.java +++ b/src/com/amlogic/inputmethod/remote/SoftKeyboard.java @@ -277,6 +277,19 @@ public class SoftKeyboard { return 0; } + public int getLocNum(int row) { + if (null == mKeyRows) + return 0; + + if (mKeyRows.size() <= row) + row = mKeyRows.size() - 1; + else if (row < 0) + row = 0; + + List<SoftKey> softKeys = mKeyRows.get(row).mSoftKeys; + return softKeys.size(); + } + public KeyRow getKeyRowForDisplay(int row) { if (null != mKeyRows && mKeyRows.size() > row) { KeyRow keyRow = mKeyRows.get(row); |