Skip to content

Commit

Permalink
Fixes #2568 Fix issue with shift and multi tapping (#2636)
Browse files Browse the repository at this point in the history
* Fix issue with shift and multi tapping

* Improved multitap timeout and keyboard update
  • Loading branch information
keianhzo committed Jan 29, 2020
1 parent d3d21e6 commit 854287c
Showing 1 changed file with 9 additions and 7 deletions.
Expand Up @@ -256,7 +256,7 @@ public interface OnKeyboardActionListener {
private int mTapCount;
private long mLastTapTime;
private boolean mInMultiTap;
private static final int MULTITAP_INTERVAL = 800; // milliseconds
private static final int MULTITAP_INTERVAL = 250; // milliseconds
private StringBuilder mPreviewLabel = new StringBuilder(1);

/** Whether the keyboard bitmap needs to be redrawn before it's blitted. **/
Expand Down Expand Up @@ -547,11 +547,10 @@ public Keyboard getKeyboard() {
*/
public boolean setShifted(boolean shifted) {
if (mKeyboard != null) {
if (mKeyboard.setShifted(shifted)) {
// The whole keyboard probably needs to be redrawn
invalidateAllKeys();
return true;
}
mKeyboard.setShifted(shifted);
// The whole keyboard probably needs to be redrawn
invalidateAllKeys();
return true;
}
return false;
}
Expand Down Expand Up @@ -1519,7 +1518,10 @@ private void checkMultiTap(long eventTime, int keyIndex) {
}

} else if (key.codes[0] == CustomKeyboard.KEYCODE_SHIFT) {
mInMultiTap = true;
if (eventTime < mLastTapTime + MULTITAP_INTERVAL
&& keyIndex == mLastSentIndex) {
mInMultiTap = true;
}
}

if (eventTime > mLastTapTime + MULTITAP_INTERVAL || keyIndex != mLastSentIndex) {
Expand Down

0 comments on commit 854287c

Please sign in to comment.