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

Commit 3bbfe612 authored by Shawn Lin's avatar Shawn Lin Committed by Android (Google) Code Review
Browse files

Merge "Fixed option menu poping up when search bar is expanded"

parents 3201039c 142e27b8
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -93,6 +93,7 @@ public abstract class MenuManager {
        updateDebug(mOptionMenu.findItem(R.id.option_menu_debug));
        updateInspect(mOptionMenu.findItem(R.id.option_menu_inspect));
        Menus.disableHiddenItems(mOptionMenu);
        mSearchManager.updateMenu();
    }

    /**
+0 −8
Original line number Diff line number Diff line
@@ -68,14 +68,6 @@ public final class MenuManager extends com.android.documentsui.MenuManager {
        mUriLookup = uriLookup;
    }

    @Override
    public void updateOptionMenu(Menu menu) {
        super.updateOptionMenu(menu);

        // It hides icon if searching in progress
        mSearchManager.updateMenu();
    }

    @Override
    public void updateKeyboardShortcutsMenu(
            List<KeyboardShortcutGroup> data, IntFunction<String> stringSupplier) {
+1 −1
Original line number Diff line number Diff line
@@ -129,7 +129,7 @@ public class SearchViewManager implements
     * is done before onPrepareOptionsMenu(Menu menu) that is overriding the icons visibility.
     */
    public void updateMenu() {
        if (isSearching() && mFullBar) {
        if (isExpanded() && mFullBar) {
            mMenu.setGroupVisible(R.id.group_hide_when_searching, false);
        }
    }
+4 −0
Original line number Diff line number Diff line
@@ -40,6 +40,10 @@ public class MenuBot extends Bots.BaseBot {
        return mDevice.findObject(By.text(menuLabel)) != null;
    }

    public boolean hasMenuItemByDesc(String menuDesc) throws UiObjectNotFoundException {
        return mDevice.findObject(By.desc(menuDesc)) != null;
    }

    public void assertPresentMenuItems(Map<String, Boolean> menuStates) throws Exception {
        for (String key : menuStates.keySet()) {
            if (menuStates.get(key)) {
+13 −0
Original line number Diff line number Diff line
@@ -67,6 +67,19 @@ public class SearchViewUiTest extends ActivityTest<FilesActivity> {
        // bots.search.assertIconVisible(false);
    }

    public void testSearchView_ShouldHideOptionMenuOnExpanding() throws Exception {
        bots.search.clickIcon();
        device.waitForIdle();

        bots.search.assertInputExists(true);
        bots.search.assertInputFocused(true);
        device.waitForIdle();

        assertFalse(bots.menu.hasMenuItem("Grid view"));
        assertFalse(bots.menu.hasMenuItem("List view"));
        assertFalse(bots.menu.hasMenuItemByDesc("More options"));
    }

    public void testSearchView_CollapsesOnBack() throws Exception {
        bots.search.clickIcon();
        device.pressBack();