diff options
author | 2010-09-12 19:08:41 +0900 | |
---|---|---|
committer | 2010-09-12 19:17:08 +0900 | |
commit | aed0122734a6257e17068539950e78957266f35b (patch) | |
tree | 04ef811f4314321c835fdff9802d80f422d6d20a /java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java | |
parent | f62166c13bdf7fe99092565dd0425d8693a5cec8 (diff) | |
download | latinime-aed0122734a6257e17068539950e78957266f35b.tar.gz latinime-aed0122734a6257e17068539950e78957266f35b.tar.xz latinime-aed0122734a6257e17068539950e78957266f35b.zip |
Fix a bug in y-axis offset for sliding finger key detection for mini popup keyboard.
Also, tentatively added key detection allowance for below of the keys in mini popup keyboard.
bug: 2979407
Change-Id: I84794969facd929c84df23e0120d46dff71c6efb
Diffstat (limited to 'java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java index 5732cf703..610d95423 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java @@ -200,6 +200,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx private int mMiniKeyboardOriginY; private long mMiniKeyboardPopupTime; private int[] mWindowOffset; + private float mMiniKeyboardSlideAllowance; /** Listener for {@link OnKeyboardActionListener}. */ private OnKeyboardActionListener mKeyboardActionListener; @@ -388,6 +389,9 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx case R.styleable.LatinKeyboardBaseView_verticalCorrection: mVerticalCorrection = a.getDimensionPixelOffset(attr, 0); break; + case R.styleable.LatinKeyboardBaseView_miniKeyboardSlideAllowance: + mMiniKeyboardSlideAllowance = a.getDimensionPixelOffset(attr, 0); + break; case R.styleable.LatinKeyboardBaseView_keyPreviewLayout: previewLayout = a.getResourceId(attr, 0); break; @@ -1091,8 +1095,8 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx } else if (x > (getMeasuredWidth() - container.getMeasuredWidth())) { adjustedX = getMeasuredWidth() - container.getMeasuredWidth(); } - mMiniKeyboardOriginX = adjustedX + container.getPaddingLeft(); - mMiniKeyboardOriginY = y + container.getPaddingTop(); + mMiniKeyboardOriginX = adjustedX + container.getPaddingLeft() - mWindowOffset[0]; + mMiniKeyboardOriginY = y + container.getPaddingTop() - mWindowOffset[1]; mMiniKeyboard.setPopupOffset(adjustedX, y); mMiniKeyboard.setShifted(isShifted()); // Mini keyboard needs no pop-up key preview displayed. @@ -1116,7 +1120,12 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx private MotionEvent generateMiniKeyboardMotionEvent(int action, int x, int y, long eventTime) { return MotionEvent.obtain(mMiniKeyboardPopupTime, eventTime, action, - x - mMiniKeyboardOriginX, y - mMiniKeyboardOriginY, 0); + x - mMiniKeyboardOriginX, + // TODO: Currently just taking care of "below" of the keys in a mini popup keyboard + // for key detection by sliding finger. Need to take care of left, right, and + // upper of "edge" keys. + y - mMiniKeyboardOriginY - (int)mMiniKeyboardSlideAllowance, + 0); } private PointerTracker getPointerTracker(final int id) { |