mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
Merge "Remove mAbortKey flag completely" into gingerbread
This commit is contained in:
commit
eeb77d4f6a
@ -212,8 +212,6 @@ public class LatinKeyboardBaseView extends View implements View.OnClickListener
|
|||||||
|
|
||||||
private final ProximityKeyDetector mProximityKeyDetector = new ProximityKeyDetector();
|
private final ProximityKeyDetector mProximityKeyDetector = new ProximityKeyDetector();
|
||||||
|
|
||||||
private boolean mAbortKey;
|
|
||||||
|
|
||||||
// For multi-tap
|
// For multi-tap
|
||||||
private int mLastSentIndex;
|
private int mLastSentIndex;
|
||||||
private int mTapCount;
|
private int mTapCount;
|
||||||
@ -628,10 +626,6 @@ public class LatinKeyboardBaseView extends View implements View.OnClickListener
|
|||||||
invalidateAllKeys();
|
invalidateAllKeys();
|
||||||
computeProximityThreshold(keyboard);
|
computeProximityThreshold(keyboard);
|
||||||
mMiniKeyboardCache.clear();
|
mMiniKeyboardCache.clear();
|
||||||
// Not really necessary to do every time, but will free up views
|
|
||||||
// Switching to a different keyboard should abort any pending keys so that the key up
|
|
||||||
// doesn't get delivered to the old or new keyboard
|
|
||||||
mAbortKey = true; // Until the next ACTION_DOWN
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1124,7 +1118,6 @@ public class LatinKeyboardBaseView extends View implements View.OnClickListener
|
|||||||
Key popupKey = mKeys[keyIndex];
|
Key popupKey = mKeys[keyIndex];
|
||||||
boolean result = onLongPress(popupKey);
|
boolean result = onLongPress(popupKey);
|
||||||
if (result) {
|
if (result) {
|
||||||
mAbortKey = true;
|
|
||||||
showPreview(NOT_A_KEY);
|
showPreview(NOT_A_KEY);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@ -1239,13 +1232,8 @@ public class LatinKeyboardBaseView extends View implements View.OnClickListener
|
|||||||
// Track the last few movements to look for spurious swipes.
|
// Track the last few movements to look for spurious swipes.
|
||||||
mSwipeTracker.addMovement(me);
|
mSwipeTracker.addMovement(me);
|
||||||
|
|
||||||
// Ignore all motion events until a DOWN.
|
// We must disable gesture detector while mini-keyboard is on the screen.
|
||||||
if (mAbortKey
|
if (!mMiniKeyboardOnScreen && mGestureDetector.onTouchEvent(me)) {
|
||||||
&& action != MotionEvent.ACTION_DOWN && action != MotionEvent.ACTION_CANCEL) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mGestureDetector.onTouchEvent(me)) {
|
|
||||||
showPreview(NOT_A_KEY);
|
showPreview(NOT_A_KEY);
|
||||||
mHandler.cancelKeyTimers();
|
mHandler.cancelKeyTimers();
|
||||||
return true;
|
return true;
|
||||||
@ -1315,7 +1303,6 @@ public class LatinKeyboardBaseView extends View implements View.OnClickListener
|
|||||||
|
|
||||||
private void onDownEvent(int touchX, int touchY, long eventTime) {
|
private void onDownEvent(int touchX, int touchY, long eventTime) {
|
||||||
int keyIndex = mProximityKeyDetector.getKeyIndexAndNearbyCodes(touchX, touchY, null);
|
int keyIndex = mProximityKeyDetector.getKeyIndexAndNearbyCodes(touchX, touchY, null);
|
||||||
mAbortKey = false;
|
|
||||||
mCurrentKey = keyIndex;
|
mCurrentKey = keyIndex;
|
||||||
mStartX = touchX;
|
mStartX = touchX;
|
||||||
mStartY = touchY;
|
mStartY = touchY;
|
||||||
@ -1326,11 +1313,6 @@ public class LatinKeyboardBaseView extends View implements View.OnClickListener
|
|||||||
if (keyIndex >= 0 && mKeys[keyIndex].repeatable) {
|
if (keyIndex >= 0 && mKeys[keyIndex].repeatable) {
|
||||||
repeatKey(keyIndex);
|
repeatKey(keyIndex);
|
||||||
mHandler.startKeyRepeatTimer(REPEAT_START_DELAY, keyIndex);
|
mHandler.startKeyRepeatTimer(REPEAT_START_DELAY, keyIndex);
|
||||||
// Delivering the key could have caused an abort
|
|
||||||
if (mAbortKey) {
|
|
||||||
mHandler.cancelKeyRepeatTimer();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (keyIndex != NOT_A_KEY) {
|
if (keyIndex != NOT_A_KEY) {
|
||||||
mHandler.startLongPressTimer(keyIndex, LONGPRESS_TIMEOUT);
|
mHandler.startLongPressTimer(keyIndex, LONGPRESS_TIMEOUT);
|
||||||
@ -1387,7 +1369,7 @@ public class LatinKeyboardBaseView extends View implements View.OnClickListener
|
|||||||
}
|
}
|
||||||
showPreview(NOT_A_KEY);
|
showPreview(NOT_A_KEY);
|
||||||
// If we're not on a repeating key (which sends on a DOWN event)
|
// If we're not on a repeating key (which sends on a DOWN event)
|
||||||
if (!wasInKeyRepeat && !mMiniKeyboardOnScreen && !mAbortKey) {
|
if (!wasInKeyRepeat && !mMiniKeyboardOnScreen) {
|
||||||
detectAndSendKey(mCurrentKey, touchX, touchY, eventTime);
|
detectAndSendKey(mCurrentKey, touchX, touchY, eventTime);
|
||||||
}
|
}
|
||||||
invalidateKey(keyIndex);
|
invalidateKey(keyIndex);
|
||||||
@ -1397,7 +1379,6 @@ public class LatinKeyboardBaseView extends View implements View.OnClickListener
|
|||||||
mHandler.cancelKeyTimers();
|
mHandler.cancelKeyTimers();
|
||||||
mHandler.cancelPopupPreview();
|
mHandler.cancelPopupPreview();
|
||||||
dismissPopupKeyboard();
|
dismissPopupKeyboard();
|
||||||
mAbortKey = true;
|
|
||||||
showPreview(NOT_A_KEY);
|
showPreview(NOT_A_KEY);
|
||||||
invalidateKey(mCurrentKey);
|
invalidateKey(mCurrentKey);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user