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

Commit 5b61e45f authored by Erfan Norozi's avatar Erfan Norozi
Browse files

Hide recent searches as part of M3 uplift.

On larger screens the searchbar will be displayed inside the toolbar but
currently the M3 components library doesn't have DockedSearchBar which
supports a drop down for recent searches. And a full screen drop down is
not a great UX.

To make the user experience consistent, this will hide recent searches
on all form factors until DockedSearchBar is available.

Bug: 404388986
Flag: com.android.documentsui.flags.use_material3
Test: test DocumentsUIGoogleTests:com.android.documentsui.SearchViewUiTest
Change-Id: Ib8c4fe21d1441e174d119a689dcfb00af827a36d
parent e8c57790
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.documentsui.queries;

import static com.android.documentsui.util.FlagUtils.isUseMaterial3FlagEnabled;
import static com.android.documentsui.util.Material3Config.getRes;

import android.content.Context;
@@ -61,7 +62,8 @@ public class SearchFragment extends Fragment {
            Log.w(TAG, "Skip show because state saved");
            return;
        }
        if (fm.getHost().getContext().getResources().getBoolean(R.bool.show_docked_search)) {
        // TODO(b/414507592): Enable recent searches after DockedSearchBar is available.
        if (isUseMaterial3FlagEnabled()) {
            return;
        }

+6 −10
Original line number Diff line number Diff line
@@ -54,7 +54,6 @@ import com.android.documentsui.rules.TestFilesRule;

import org.junit.After;
import org.junit.Assert;
import org.junit.Assume;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -152,10 +151,9 @@ public class SearchViewUiTest extends ActivityTestJunit4<FilesActivity> {
    }

    @Test
    // TODO(b/414507592): Remove once recent searches is enabled again.
    @RequiresFlagsDisabled(FLAG_USE_MATERIAL3)
    public void testSearchFragment_DismissedOnCloseAfterCancel() throws Exception {
        // TODO(b/414478221): Add search history for docked searchbar.
        Assume.assumeFalse(context.getResources().getBoolean(R.bool.show_docked_search));

        bots.search.expand();
        bots.search.setInputText("query text");

@@ -297,10 +295,9 @@ public class SearchViewUiTest extends ActivityTestJunit4<FilesActivity> {
    }

    @Test
    // TODO(b/414507592): Remove once recent searches is enabled again.
    @RequiresFlagsDisabled(FLAG_USE_MATERIAL3)
    public void testSearchHistory_showAfterSearchViewClear() throws Exception {
        // TODO(b/414478221): Add search history for docked searchbar.
        Assume.assumeFalse(context.getResources().getBoolean(R.bool.show_docked_search));

        bots.search.expand();
        bots.search.setInputText("chocolate");

@@ -315,10 +312,9 @@ public class SearchViewUiTest extends ActivityTestJunit4<FilesActivity> {
    }

    @Test
    // TODO(b/414507592): Remove once recent searches is enabled again.
    @RequiresFlagsDisabled(FLAG_USE_MATERIAL3)
    public void testSearchView_focusClearedAfterSelectingSearchHistory() throws Exception {
        // TODO(b/414478221): Add search history for docked searchbar.
        Assume.assumeFalse(context.getResources().getBoolean(R.bool.show_docked_search));

        String queryText = "history";
        bots.search.expand();
        bots.search.setInputText(queryText);