Key release event should be sent when finger sliding
This change is cherry-pick I1a020e3d from Gingerbread-MR Bug: 3132881 Change-Id: I885eab7744369dfb841f9b34d210b6c2aef8f19amain
parent
c205237314
commit
c0b5c9c43e
|
@ -301,19 +301,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);
|
||||||
Key key = getKey(keyIndex);
|
final Key oldKey = getKey(keyState.getKeyIndex());
|
||||||
if (key != null) {
|
if (isValidKeyIndex(keyIndex)) {
|
||||||
if (keyState.getKeyIndex() == NOT_A_KEY) {
|
if (oldKey == null) {
|
||||||
keyState.onMoveToNewKey(keyIndex, x, y);
|
keyState.onMoveToNewKey(keyIndex, x, y);
|
||||||
startLongPressTimer(keyIndex);
|
startLongPressTimer(keyIndex);
|
||||||
} 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);
|
||||||
startLongPressTimer(keyIndex);
|
startLongPressTimer(keyIndex);
|
||||||
}
|
}
|
||||||
} 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.cancelLongPressTimers();
|
mHandler.cancelLongPressTimers();
|
||||||
} else if (!isMinorMoveBounce(x, y, keyIndex)) {
|
} else if (!isMinorMoveBounce(x, y, keyIndex)) {
|
||||||
|
@ -405,7 +409,7 @@ public class PointerTracker {
|
||||||
private void showKeyPreviewAndUpdateKeyGraphics(int keyIndex) {
|
private void showKeyPreviewAndUpdateKeyGraphics(int keyIndex) {
|
||||||
updateKeyGraphics(keyIndex);
|
updateKeyGraphics(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);
|
||||||
|
|
Loading…
Reference in New Issue