Skip to content

Commit

Permalink
Fixes #2440 Fixes #2441 Hide selection context menu when back is pres…
Browse files Browse the repository at this point in the history
…sed (#2671)

* Indentation fix

* Hide selection context menus when back is pressed
  • Loading branch information
keianhzo committed Feb 5, 2020
1 parent f9bc1c2 commit d2d289c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 16 deletions.
Expand Up @@ -381,19 +381,19 @@ public void updateFocusedView(View aFocusedView) {
}

public void dismiss() {
exitVoiceInputMode();
if (mFocusedView != null && mFocusedView != mAttachedWindow) {
mFocusedView.clearFocus();
}
mWidgetPlacement.visible = false;
mWidgetManager.updateWidget(this);

mWidgetManager.popBackHandler(mBackHandler);

mIsCapsLock = false;
mIsLongPress = false;
handleShift(false);
hideOverlays();
exitVoiceInputMode();
if (mFocusedView != null && mFocusedView != mAttachedWindow) {
mFocusedView.clearFocus();
}
mWidgetPlacement.visible = false;
mWidgetManager.updateWidget(this);

mWidgetManager.popBackHandler(mBackHandler);

mIsCapsLock = false;
mIsLongPress = false;
handleShift(false);
hideOverlays();
}

public void proxifyLayerIfNeeded(ArrayList<WindowWidget> aWindows) {
Expand Down Expand Up @@ -1023,8 +1023,12 @@ public boolean dispatchKeyEvent(final KeyEvent event) {
final InputConnection connection = mInputConnection;
if (connection != null) {
if (isAttachToWindowWidget()) {
connection.sendKeyEvent(event);
hide(UIWidget.KEEP_WIDGET);
if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) {
return false;
} else {
connection.sendKeyEvent(event);
hide(UIWidget.KEEP_WIDGET);
}
return true;
}
// Android Components do not support InputConnection.sendKeyEvent()
Expand Down
Expand Up @@ -1806,10 +1806,13 @@ public void onAction(String action) {

@Override
public void onDismiss() {
hideContextMenus();
if (aSelection.isActionAvailable(GeckoSession.SelectionActionDelegate.ACTION_UNSELECT)) {
aSelection.execute(GeckoSession.SelectionActionDelegate.ACTION_UNSELECT);
} else {
aSelection.collapseToEnd();
}

aSelection.hide();
}
});
mSelectionMenu.show(KEEP_FOCUS);
Expand Down

0 comments on commit d2d289c

Please sign in to comment.