Skip to content

Commit

Permalink
Fixes #2562 Handle shift switching also for text keys (#2685)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
keianhzo committed Feb 11, 2020
1 parent 3949e4c commit 2933730
Showing 1 changed file with 11 additions and 5 deletions.
Expand Up @@ -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();
Expand All @@ -393,7 +398,6 @@ public void dismiss() {
mIsCapsLock = false;
mIsLongPress = false;
handleShift(false);
hideOverlays();
}

public void proxifyLayerIfNeeded(ArrayList<WindowWidget> aWindows) {
Expand Down Expand Up @@ -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;
}
Expand All @@ -543,6 +543,7 @@ public void onText(CharSequence text) {
if (!mIsLongPress) {
handleText(text.toString());
}

mIsLongPress = false;
mIsMultiTap = false;
}
Expand Down Expand Up @@ -862,6 +863,11 @@ private void handleText(String aText) {
final InputConnection connection = mInputConnection;
postInputCommand(() -> connection.commitText(text, 1));
}

if (!mIsCapsLock) {
handleShift(false);
}

updateCandidates();
}

Expand Down

0 comments on commit 2933730

Please sign in to comment.