diff options
author | 2011-09-08 17:47:56 +0900 | |
---|---|---|
committer | 2011-09-09 14:21:43 +0900 | |
commit | 4a9be115f26aff8cfdfcc4f0c24e54ffd8086695 (patch) | |
tree | d7eacfb5ad33d7ffe928bdb3835d6e109912e9a0 /java/src | |
parent | a08a7e99b4133eb6647ddc27ac60d8ee4c9eddba (diff) | |
download | latinime-4a9be115f26aff8cfdfcc4f0c24e54ffd8086695.tar.gz latinime-4a9be115f26aff8cfdfcc4f0c24e54ffd8086695.tar.xz latinime-4a9be115f26aff8cfdfcc4f0c24e54ffd8086695.zip |
Cancel more suggestions when its outside is touched
Bug: 5241105
Change-Id: Ic28afaf998dabd3c5529286a3e60400d733d3d82
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/com/android/inputmethod/latin/MoreSuggestionsView.java | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/java/src/com/android/inputmethod/latin/MoreSuggestionsView.java b/java/src/com/android/inputmethod/latin/MoreSuggestionsView.java index f595510a3..f54a48509 100644 --- a/java/src/com/android/inputmethod/latin/MoreSuggestionsView.java +++ b/java/src/com/android/inputmethod/latin/MoreSuggestionsView.java @@ -142,6 +142,13 @@ public class MoreSuggestionsView extends KeyboardView implements MoreKeysPanel { // Nothing to do with. } + private final View.OnTouchListener mMotionEventDelegate = new View.OnTouchListener() { + @Override + public boolean onTouch(View view, MotionEvent me) { + return MoreSuggestionsView.this.dispatchTouchEvent(me); + } + }; + @Override public void showMoreKeysPanel(View parentView, Controller controller, int pointX, int pointY, PopupWindow window, KeyboardActionListener listener) { @@ -160,6 +167,10 @@ public class MoreSuggestionsView extends KeyboardView implements MoreKeysPanel { - (container.getMeasuredHeight() - container.getPaddingBottom()) + parentView.getPaddingTop() + mCoordinates[1]; + container.setOnTouchListener(mMotionEventDelegate); + window.setInputMethodMode(PopupWindow.INPUT_METHOD_NOT_NEEDED); + window.setFocusable(true); + window.setOutsideTouchable(true); window.setContentView(container); window.setWidth(container.getMeasuredWidth()); window.setHeight(container.getMeasuredHeight()); @@ -215,6 +226,19 @@ public class MoreSuggestionsView extends KeyboardView implements MoreKeysPanel { }; @Override + public boolean dispatchTouchEvent(MotionEvent me) { + final int x = (int)me.getX(); + final int y = (int)me.getY(); + final boolean inside = (x >= 0 && x < getWidth() && y >= 0 && y < getHeight()); + if (inside) { + return super.dispatchTouchEvent(me); + } else { + dismissMoreKeysPanel(); + return true; + } + } + + @Override public boolean onTouchEvent(MotionEvent me) { final int action = me.getAction(); final long eventTime = me.getEventTime(); |