From 854287c0ef4ae03c3ea20a002e8f4410809ff085 Mon Sep 17 00:00:00 2001 From: Manuel Martin Date: Wed, 29 Jan 2020 01:57:10 +0100 Subject: [PATCH] Fixes #2568 Fix issue with shift and multi tapping (#2636) * Fix issue with shift and multi tapping * Improved multitap timeout and keyboard update --- .../vrbrowser/ui/views/CustomKeyboardView.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/app/src/common/shared/org/mozilla/vrbrowser/ui/views/CustomKeyboardView.java b/app/src/common/shared/org/mozilla/vrbrowser/ui/views/CustomKeyboardView.java index 479df0710..06605283d 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/ui/views/CustomKeyboardView.java +++ b/app/src/common/shared/org/mozilla/vrbrowser/ui/views/CustomKeyboardView.java @@ -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. **/ @@ -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; } @@ -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) {