Loading src/com/android/documentsui/BaseActivity.java +1 −1 Original line number Diff line number Diff line Loading @@ -353,7 +353,6 @@ public abstract class BaseActivity } updateHeaderTitle(); mAppsRowManager.updateView(this); } @Override Loading Loading @@ -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() { Loading src/com/android/documentsui/dirlist/AppsRowManager.java +3 −3 Original line number Diff line number Diff line Loading @@ -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; } Loading tests/unit/com/android/documentsui/dirlist/AppsRowManagerTest.java +0 −19 Original line number Diff line number Diff line Loading @@ -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); Loading @@ -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); Loading @@ -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); Loading @@ -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); Loading @@ -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()); } } Loading
src/com/android/documentsui/BaseActivity.java +1 −1 Original line number Diff line number Diff line Loading @@ -353,7 +353,6 @@ public abstract class BaseActivity } updateHeaderTitle(); mAppsRowManager.updateView(this); } @Override Loading Loading @@ -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() { Loading
src/com/android/documentsui/dirlist/AppsRowManager.java +3 −3 Original line number Diff line number Diff line Loading @@ -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; } Loading
tests/unit/com/android/documentsui/dirlist/AppsRowManagerTest.java +0 −19 Original line number Diff line number Diff line Loading @@ -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); Loading @@ -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); Loading @@ -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); Loading @@ -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); Loading @@ -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()); } }