Skip to content
Snippets Groups Projects
Commit c47bc5ef authored by Tadashi G. Takaoka's avatar Tadashi G. Takaoka
Browse files

Key release event should be sent when finger sliding (DO NOT MERGE)

Bug: 3132881
Change-Id: I1a020e3df42a0868366bc251fa7238df757b2b5a
parent f9ac1272
No related branches found
No related tags found
No related merge requests found
...@@ -296,18 +296,23 @@ public class PointerTracker { ...@@ -296,18 +296,23 @@ public class PointerTracker {
if (mKeyAlreadyProcessed) if (mKeyAlreadyProcessed)
return; return;
KeyState keyState = mKeyState; KeyState keyState = mKeyState;
int keyIndex = keyState.onMoveKey(x, y); final int keyIndex = keyState.onMoveKey(x, y);
final Key oldKey = getKey(keyState.getKeyIndex());
if (isValidKeyIndex(keyIndex)) { if (isValidKeyIndex(keyIndex)) {
if (keyState.getKeyIndex() == NOT_A_KEY) { if (oldKey == null) {
keyState.onMoveToNewKey(keyIndex, x, y); keyState.onMoveToNewKey(keyIndex, x, y);
mHandler.startLongPressTimer(mLongPressKeyTimeout, keyIndex, this); mHandler.startLongPressTimer(mLongPressKeyTimeout, keyIndex, this);
} else if (!isMinorMoveBounce(x, y, keyIndex)) { } else if (!isMinorMoveBounce(x, y, keyIndex)) {
if (mListener != null)
mListener.onRelease(oldKey.codes[0]);
resetMultiTap(); resetMultiTap();
keyState.onMoveToNewKey(keyIndex, x, y); keyState.onMoveToNewKey(keyIndex, x, y);
mHandler.startLongPressTimer(mLongPressKeyTimeout, keyIndex, this); mHandler.startLongPressTimer(mLongPressKeyTimeout, keyIndex, this);
} }
} else { } else {
if (keyState.getKeyIndex() != NOT_A_KEY) { if (oldKey != null) {
if (mListener != null)
mListener.onRelease(oldKey.codes[0]);
keyState.onMoveToNewKey(keyIndex, x ,y); keyState.onMoveToNewKey(keyIndex, x ,y);
mHandler.cancelLongPressTimer(); mHandler.cancelLongPressTimer();
} else if (!isMinorMoveBounce(x, y, keyIndex)) { } else if (!isMinorMoveBounce(x, y, keyIndex)) {
...@@ -411,7 +416,7 @@ public class PointerTracker { ...@@ -411,7 +416,7 @@ public class PointerTracker {
private void showKeyPreviewAndUpdateKey(int keyIndex) { private void showKeyPreviewAndUpdateKey(int keyIndex) {
updateKey(keyIndex); updateKey(keyIndex);
// The modifier key, such as shift key, should not be shown as preview when multi-touch is // The modifier key, such as shift key, should not be shown as preview when multi-touch is
// supported. On thge other hand, if multi-touch is not supported, the modifier key should // supported. On the other hand, if multi-touch is not supported, the modifier key should
// be shown as preview. // be shown as preview.
if (mHasDistinctMultitouch && isModifier()) { if (mHasDistinctMultitouch && isModifier()) {
mProxy.showPreview(NOT_A_KEY, this); mProxy.showPreview(NOT_A_KEY, this);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment