mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-04-20 14:19:08 +00:00
fix sliding input issues: take into account that keyboard height may change
This commit is contained in:
parent
356e39921b
commit
2db6d99a23
1 changed files with 11 additions and 1 deletions
|
@ -137,6 +137,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element,
|
||||||
|
|
||||||
// true if keyboard layout has been changed.
|
// true if keyboard layout has been changed.
|
||||||
private boolean mKeyboardLayoutHasBeenChanged;
|
private boolean mKeyboardLayoutHasBeenChanged;
|
||||||
|
private int keyboardChangeOccupiedHeightDifference;
|
||||||
|
|
||||||
// true if this pointer is no longer triggering any action because it has been canceled.
|
// true if this pointer is no longer triggering any action because it has been canceled.
|
||||||
private boolean mIsTrackingForActionDisabled;
|
private boolean mIsTrackingForActionDisabled;
|
||||||
|
@ -356,6 +357,11 @@ public final class PointerTracker implements PointerTrackerQueue.Element,
|
||||||
if (keyDetector == mKeyDetector && keyboard == mKeyboard) {
|
if (keyDetector == mKeyDetector && keyboard == mKeyboard) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (mKeyboard != null) {
|
||||||
|
// changing keyboards may change height
|
||||||
|
// since y is measured from top of view, this change needs to be considered in some places
|
||||||
|
keyboardChangeOccupiedHeightDifference = keyboard.mOccupiedHeight - mKeyboard.mOccupiedHeight;
|
||||||
|
}
|
||||||
mKeyDetector = keyDetector;
|
mKeyDetector = keyDetector;
|
||||||
mKeyboard = keyboard;
|
mKeyboard = keyboard;
|
||||||
// Mark that keyboard layout has been changed.
|
// Mark that keyboard layout has been changed.
|
||||||
|
@ -696,8 +702,12 @@ public final class PointerTracker implements PointerTrackerQueue.Element,
|
||||||
// This onPress call may have changed keyboard layout. Those cases are detected at
|
// This onPress call may have changed keyboard layout. Those cases are detected at
|
||||||
// {@link #setKeyboard}. In those cases, we should update key according to the new
|
// {@link #setKeyboard}. In those cases, we should update key according to the new
|
||||||
// keyboard layout.
|
// keyboard layout.
|
||||||
|
// Also height difference between keyboards needs to be considered.
|
||||||
if (callListenerOnPressAndCheckKeyboardLayoutChange(key, 0 /* repeatCount */)) {
|
if (callListenerOnPressAndCheckKeyboardLayoutChange(key, 0 /* repeatCount */)) {
|
||||||
key = onDownKey(x, y, eventTime);
|
final int yOffset = keyboardChangeOccupiedHeightDifference;
|
||||||
|
keyboardChangeOccupiedHeightDifference = 0;
|
||||||
|
CoordinateUtils.set(mDownCoordinates, x, y + yOffset);
|
||||||
|
key = onDownKey(x, y + yOffset, eventTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
startRepeatKey(key);
|
startRepeatKey(key);
|
||||||
|
|
Loading…
Add table
Reference in a new issue