From 293373082f1cadbecbe7d848bfbc6aaf2f49897c Mon Sep 17 00:00:00 2001 From: Manuel Martin Date: Tue, 11 Feb 2020 11:29:47 +0100 Subject: [PATCH] Fixes #2562 Handle shift switching also for text keys (#2685) * Handle shift switching also for text keys * Cancel shift after adding a character from the popup menu * Close overlays if opened when clicking the back button --- .../vrbrowser/ui/widgets/KeyboardWidget.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/KeyboardWidget.java b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/KeyboardWidget.java index cd154e10a..1a07c6b4f 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/KeyboardWidget.java +++ b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/KeyboardWidget.java @@ -381,6 +381,11 @@ public void updateFocusedView(View aFocusedView) { } public void dismiss() { + if (mPopupKeyboardLayer.getVisibility() == VISIBLE) { + hideOverlays(); + return; + } + exitVoiceInputMode(); if (mFocusedView != null && mFocusedView != mAttachedWindow) { mFocusedView.clearFocus(); @@ -393,7 +398,6 @@ public void dismiss() { mIsCapsLock = false; mIsLongPress = false; handleShift(false); - hideOverlays(); } public void proxifyLayerIfNeeded(ArrayList aWindows) { @@ -525,10 +529,6 @@ public void onKey(int primaryCode, int[] keyCodes, boolean hasPopup) { break; } - if (!mIsCapsLock && primaryCode != CustomKeyboard.KEYCODE_SHIFT && mPopupKeyboardView.getVisibility() != View.VISIBLE) { - handleShift(false); - } - mIsLongPress = false; mIsMultiTap = false; } @@ -543,6 +543,7 @@ public void onText(CharSequence text) { if (!mIsLongPress) { handleText(text.toString()); } + mIsLongPress = false; mIsMultiTap = false; } @@ -862,6 +863,11 @@ private void handleText(String aText) { final InputConnection connection = mInputConnection; postInputCommand(() -> connection.commitText(text, 1)); } + + if (!mIsCapsLock) { + handleShift(false); + } + updateCandidates(); }