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

Commit cc5ea443 authored by Wenyi Wang's avatar Wenyi Wang
Browse files

Only consume key event if the drawer is closed.

Bug: 34343480

Test: press non-arrow/tab keys when drawer is open and make sure
      search mode is not activated.

Change-Id: I62eed89d519223362ed6c36cbac3dd9855be135a
parent 3f9e1873
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -760,6 +760,11 @@ public class PeopleActivity extends AppCompatContactsActivity implements

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        // Only consume the event if the drawer is closed. Otherwise, key events will activate
        // search mode when drawer is open.
        if (mDrawerLayout.isDrawerOpen(GravityCompat.START)) {
            return false;
        }
        // Bring up the search UI if the user starts typing
        final int unicodeChar = event.getUnicodeChar();
        if ((unicodeChar != 0)
+2 −2
Original line number Diff line number Diff line
@@ -1228,12 +1228,12 @@ public class DefaultContactBrowseListFragment extends ContactBrowseListFragment
    }

    public boolean onKeyDown(int unicodeChar) {
        if (mActionBarAdapter.isSelectionMode()) {
        if (mActionBarAdapter != null && mActionBarAdapter.isSelectionMode()) {
            // Ignore keyboard input when in selection mode.
            return true;
        }

        if (!mActionBarAdapter.isSearchMode()) {
        if (mActionBarAdapter != null && !mActionBarAdapter.isSearchMode()) {
            final String query = new String(new int[]{unicodeChar}, 0, 1);
            mActionBarAdapter.setSearchMode(true);
            mActionBarAdapter.setQueryString(query);