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

Commit 4a297811 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Hide tabs and apps when tapping a filter in an empty search" into...

Merge "Hide tabs and apps when tapping a filter in an empty search" into rvc-dev am: 16f72e93 am: 1cc02d9b am: 5dcfd516

Change-Id: I73daccf69bbf90a607f9c74a05fc10e8b75c8509
parents e3397c15 5dcfd516
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -213,6 +213,9 @@ public abstract class BaseActivity
                    Metrics.logUserAction(MetricConsts.USER_ACTION_SEARCH_CHIP);
                    Metrics.logSearchType(item.getChipType());
                }
                // We also need to update AppsRowManager because we may want to show/hide the
                // appsRow in cross-profile search according to the searching conditions.
                mAppsRowManager.updateView(BaseActivity.this);
            }

            @Override
@@ -791,11 +794,6 @@ public abstract class BaseActivity
        return mSearchManager.isExpanded();
    }

    @Override
    public boolean isTextSearching() {
        return mSearchManager.isTextSearching();
    }

    @Override
    public UserId getSelectedUser() {
        return mNavigator.getSelectedUser();
+0 −1
Original line number Diff line number Diff line
@@ -234,6 +234,5 @@ public class NavigationViewManager {
        @Deprecated  // Use CommonAddones#refreshCurrentRootAndDirectory
        void refreshCurrentRootAndDirectory(int animation);
        boolean isSearchExpanded();
        boolean isTextSearching();
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -138,7 +138,7 @@ public class ProfileTabs implements ProfileTabsAddons {
        // 5. the root supports cross profile.
        return mState.supportsCrossProfile()
                && mTabs.getTabCount() > 1
                && !mEnv.isTextSearching()
                && !mEnv.isSearchExpanded()
                && mState.stack.size() <= 1
                && mState.stack.getRoot() != null && mState.stack.getRoot().supportsCrossProfile();
    }
+5 −5
Original line number Diff line number Diff line
@@ -84,22 +84,22 @@ public class AppsRowManager {
        return mDataList;
    }

    private boolean shouldShow(State state, boolean isTextSearching) {
    private boolean shouldShow(State state, boolean isSearchExpanded) {
        boolean isHiddenAction = state.action == State.ACTION_CREATE
                || state.action == State.ACTION_OPEN_TREE
                || state.action == State.ACTION_PICK_COPY_DESTINATION;
        boolean isTextSearchingAcrossProfile = mUserIdManager.getUserIds().size() > 1
        boolean isSearchExpandedAcrossProfile = mUserIdManager.getUserIds().size() > 1
                && state.supportsCrossProfile()
                && isTextSearching;
                && isSearchExpanded;

        return state.stack.isRecents() && !isHiddenAction && mDataList.size() > 0
                && !isTextSearchingAcrossProfile;
                && !isSearchExpandedAcrossProfile;
    }

    public void updateView(BaseActivity activity) {
        final View appsRowLayout = activity.findViewById(R.id.apps_row);

        if (!shouldShow(activity.getDisplayState(), activity.isTextSearching())) {
        if (!shouldShow(activity.getDisplayState(), activity.isSearchExpanded())) {
            appsRowLayout.setVisibility(View.GONE);
            return;
        }
+4 −10
Original line number Diff line number Diff line
@@ -72,7 +72,7 @@ public class ProfileTabsTest {

        mTabLayout = view.findViewById(R.id.tabs);
        mTestEnv = new TestEnvironment();
        mTestEnv.isTextSearching = false;
        mTestEnv.isSearchExpanded = false;

        mTestUserIdManager = new TestUserIdManager();
        mTestCommonAddons = new TestCommonAddons();
@@ -152,7 +152,7 @@ public class ProfileTabsTest {

    @Test
    public void testUpdateView_twoUsers_isSearching_shouldHide() {
        mTestEnv.isTextSearching = true;
        mTestEnv.isSearchExpanded = true;
        initializeWithUsers(systemUser, managedUser);

        assertThat(mTabLayout.getVisibility()).isEqualTo(View.GONE);
@@ -242,7 +242,7 @@ public class ProfileTabsTest {
     */
    private static class TestEnvironment implements NavigationViewManager.Environment {

        public boolean isTextSearching = false;
        public boolean isSearchExpanded = false;

        @Override
        public RootInfo getCurrentRoot() {
@@ -261,14 +261,8 @@ public class ProfileTabsTest {

        @Override
        public boolean isSearchExpanded() {
            throw new UnsupportedOperationException("not implemented");
            return isSearchExpanded;
        }

        @Override
        public boolean isTextSearching() {
            return isTextSearching;
        }

    }

    private static class TestCommonAddons implements AbstractActionHandler.CommonAddons {
Loading