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

Commit 1e67177e authored by Tony Huang's avatar Tony Huang
Browse files

Update apps row show rule

On design mock document, apps row should show when search.
It also can fix UI overlapping bug.

Fix: 123699651
Test: manual
Test: atest DocumentsUITests
Change-Id: I6dd3d934a951bdfd5f2d56696e66bf8fe600513c
parent 55ba6da7
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -353,7 +353,6 @@ public abstract class BaseActivity
        }

        updateHeaderTitle();
        mAppsRowManager.updateView(this);
    }

    @Override
@@ -480,6 +479,7 @@ public abstract class BaseActivity
        invalidateOptionsMenu();
        mSortController.onViewModeChanged(mState.derivedMode);
        mSearchManager.updateChips(getCurrentRoot().derivedMimeTypes);
        mAppsRowManager.updateView(this);
    }

    private final List<String> getExcludedAuthorities() {
+3 −3
Original line number Diff line number Diff line
@@ -69,17 +69,17 @@ public class AppsRowManager {
        return mDataList;
    }

    private boolean shouldShow(State state, boolean isSearching) {
    private boolean shouldShow(State state) {
        boolean isHiddenAction = state.action == State.ACTION_CREATE
                || state.action == State.ACTION_OPEN_TREE
                || state.action == State.ACTION_PICK_COPY_DESTINATION;
        return state.stack.isRecents() && !isSearching && !isHiddenAction && mDataList.size() > 0;
        return state.stack.isRecents() && !isHiddenAction && mDataList.size() > 0;
    }

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

        if (!shouldShow(activity.getDisplayState(), activity.isSearchExpanded())) {
        if (!shouldShow(activity.getDisplayState())) {
            appsRowLayout.setVisibility(View.GONE);
            return;
        }
+0 −19
Original line number Diff line number Diff line
@@ -116,7 +116,6 @@ public class AppsRowManagerTest {
    public void testUpdateView_matchedState_showRow() {
        mState.action = State.ACTION_BROWSE;
        mState.stack.changeRoot(TestProvidersAccess.RECENTS);
        when(mActivity.isSearchExpanded()).thenReturn(false);
        final List<Item> rootList = new ArrayList<>();
        rootList.add(new RootItem(TestProvidersAccess.INSPECTOR, mActionHandler));
        mAppsRowManager.updateList(rootList);
@@ -130,7 +129,6 @@ public class AppsRowManagerTest {
    @Test
    public void testUpdateView_notInRecent_hideRow() {
        mState.action = State.ACTION_BROWSE;
        when(mActivity.isSearchExpanded()).thenReturn(false);
        final List<Item> rootList = new ArrayList<>();
        rootList.add(new RootItem(TestProvidersAccess.INSPECTOR, mActionHandler));
        mAppsRowManager.updateList(rootList);
@@ -147,7 +145,6 @@ public class AppsRowManagerTest {
        mState.action = State.ACTION_OPEN_TREE;

        mState.stack.changeRoot(TestProvidersAccess.RECENTS);
        when(mActivity.isSearchExpanded()).thenReturn(false);
        final List<Item> rootList = new ArrayList<>();
        rootList.add(new RootItem(TestProvidersAccess.INSPECTOR, mActionHandler));
        mAppsRowManager.updateList(rootList);
@@ -161,7 +158,6 @@ public class AppsRowManagerTest {
    public void testUpdateView_noItems_hideRow() {
        mState.action = State.ACTION_BROWSE;
        mState.stack.changeRoot(TestProvidersAccess.RECENTS);
        when(mActivity.isSearchExpanded()).thenReturn(false);

        final List<Item> rootList = new ArrayList<>();
        mAppsRowManager.updateList(rootList);
@@ -170,20 +166,5 @@ public class AppsRowManagerTest {

        assertEquals(View.GONE, mAppsRow.getVisibility());
    }

    @Test
    public void testUpdateView_inSearching_hideRow() {
        mState.action = State.ACTION_BROWSE;
        mState.stack.changeRoot(TestProvidersAccess.RECENTS);
        final List<Item> rootList = new ArrayList<>();
        rootList.add(new RootItem(TestProvidersAccess.INSPECTOR, mActionHandler));
        mAppsRowManager.updateList(rootList);

        when(mActivity.isSearchExpanded()).thenReturn(true);

        mAppsRowManager.updateView(mActivity);

        assertEquals(View.GONE, mAppsRow.getVisibility());
    }
}