Input delete onUpKey

to avoid deletion when the user starts gesture from the delete key

Bug: 7303982
Change-Id: If4b3e6287ceee1cf9f72a1d92f2a6789065da454
main
Satoshi Kataoka 2013-09-25 17:39:40 +09:00
parent 1e69f3e637
commit a456e3f659
1 changed files with 8 additions and 3 deletions

View File

@ -346,6 +346,8 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
// true if this pointer is in a sliding key input from a modifier key, // true if this pointer is in a sliding key input from a modifier key,
// so that further modifier keys should be ignored. // so that further modifier keys should be ignored.
boolean mIsInSlidingKeyInputFromModifier; boolean mIsInSlidingKeyInputFromModifier;
// if not a NOT_A_CODE, the key of this code is repeating
private int mCurrentRepeatingKeyCode = Constants.NOT_A_CODE;
// true if a sliding key input is allowed. // true if a sliding key input is allowed.
private boolean mIsAllowedSlidingKeyInput; private boolean mIsAllowedSlidingKeyInput;
@ -1248,6 +1250,8 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
mIsDetectingGesture = false; mIsDetectingGesture = false;
final Key currentKey = mCurrentKey; final Key currentKey = mCurrentKey;
mCurrentKey = null; mCurrentKey = null;
final int currentRepeatingKeyCode = mCurrentRepeatingKeyCode;
mCurrentRepeatingKeyCode = Constants.NOT_A_CODE;
// Release the last pressed key. // Release the last pressed key.
setReleasedKeyGraphics(currentKey); setReleasedKeyGraphics(currentKey);
@ -1273,8 +1277,8 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
if (mIsTrackingForActionDisabled) { if (mIsTrackingForActionDisabled) {
return; return;
} }
if (currentKey != null && currentKey.isRepeatable() && !isInSlidingKeyInput) { if (currentKey != null && currentKey.isRepeatable()
// Repeatable key has been registered in {@link #onDownEventInternal(int,int,long)}. && (currentKey.getCode() == currentRepeatingKeyCode) && !isInSlidingKeyInput) {
return; return;
} }
detectAndSendKey(currentKey, mKeyX, mKeyY, eventTime); detectAndSendKey(currentKey, mKeyX, mKeyY, eventTime);
@ -1413,7 +1417,6 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
if (!key.isRepeatable()) return; if (!key.isRepeatable()) return;
// Don't start key repeat when we are in sliding input mode. // Don't start key repeat when we are in sliding input mode.
if (mIsInSlidingKeyInput) return; if (mIsInSlidingKeyInput) return;
detectAndSendKey(key, key.getX(), key.getY(), SystemClock.uptimeMillis());
final int startRepeatCount = 1; final int startRepeatCount = 1;
mTimerProxy.startKeyRepeatTimer(this, startRepeatCount, sParams.mKeyRepeatStartTimeout); mTimerProxy.startKeyRepeatTimer(this, startRepeatCount, sParams.mKeyRepeatStartTimeout);
} }
@ -1421,8 +1424,10 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
public void onKeyRepeat(final int code, final int repeatCount) { public void onKeyRepeat(final int code, final int repeatCount) {
final Key key = getKey(); final Key key = getKey();
if (key == null || key.getCode() != code) { if (key == null || key.getCode() != code) {
mCurrentRepeatingKeyCode = Constants.NOT_A_CODE;
return; return;
} }
mCurrentRepeatingKeyCode = code;
mIsDetectingGesture = false; mIsDetectingGesture = false;
final int nextRepeatCount = repeatCount + 1; final int nextRepeatCount = repeatCount + 1;
mTimerProxy.startKeyRepeatTimer(this, nextRepeatCount, sParams.mKeyRepeatInterval); mTimerProxy.startKeyRepeatTimer(this, nextRepeatCount, sParams.mKeyRepeatInterval);