Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a6309c30 authored by Bjorn Bringert's avatar Bjorn Bringert
Browse files

On BACK in search, hide just IME if IME is fullscreen

Since a fullscreen IME covers the entire search dialog, there was
no discoverable way to get back to the search dialog.
Now, on BACK presses when the IME is fullscreen (e.g. in landscape
mode without hard keyboard), we dismiss only the IME.
A second BACK press will dismiss the search dialog.

Fixes http://b/issue?id=2159132

Change-Id: I8e5736d83d7c35936a718929017ea04c6214700b
parent 95c98dd5
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -1812,7 +1812,18 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS

    @Override
    public void onBackPressed() {
        // If the input method is covering the search dialog completely,
        // e.g. in landscape mode with no hard keyboard, dismiss just the input method
        InputMethodManager imm = (InputMethodManager)getContext()
                .getSystemService(Context.INPUT_METHOD_SERVICE);
        if (imm != null && imm.isFullscreenMode() &&
                imm.hideSoftInputFromWindow(getWindow().getDecorView().getWindowToken(), 0)) {
            return;
        }
        // Otherwise, go back to any previous source (e.g. back to QSB when
        // pivoted into a source.
        if (!backToPreviousComponent()) {
            // If no previous source, close search dialog
            cancel();
        }
    }