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

Commit c914f9fc authored by Diksha Gohlyan's avatar Diksha Gohlyan Committed by Android (Google) Code Review
Browse files

Merge "A11y for grid and list mode" into mainline-prod

parents 130e41c8 35187921
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -540,4 +540,11 @@
    <!-- Snackbar shown when users drag and drop files from another app
    to DocumentsUI. [CHAR_LIMIT=100] -->
    <string name="drag_from_another_app">You can\u2019t move files from another app.</string>

    <!-- Accessibility announcement when switching to grid mode of files and directories shown. [CHAR_LIMIT=100] -->
    <string name="grid_mode_showing">Showing in grid mode.</string>

    <!-- Accessibility announcement when switching to list mode of files and directories shown. [CHAR_LIMIT=100] -->
    <string name="list_mode_showing">Showing in list mode.</string>

</resources>
+9 −5
Original line number Diff line number Diff line
@@ -180,6 +180,7 @@ public class DirectoryFragment extends Fragment implements SwipeRefreshLayout.On
    private SelectionMetadata mSelectionMetadata;
    private KeyInputHandler mKeyListener;
    private @Nullable DragHoverListener mDragHoverListener;
    private View mRootView;
    private IconHelper mIconHelper;
    private SwipeRefreshLayout mRefreshLayout;
    private RecyclerView mRecView;
@@ -348,12 +349,12 @@ public class DirectoryFragment extends Fragment implements SwipeRefreshLayout.On

        mHandler = new Handler(Looper.getMainLooper());
        mActivity = (BaseActivity) getActivity();
        final View view = inflater.inflate(R.layout.fragment_directory, container, false);
        mRootView = inflater.inflate(R.layout.fragment_directory, container, false);

        mProgressBar = view.findViewById(R.id.progressbar);
        mProgressBar = mRootView.findViewById(R.id.progressbar);
        assert mProgressBar != null;

        mRecView = (RecyclerView) view.findViewById(R.id.dir_list);
        mRecView = (RecyclerView) mRootView.findViewById(R.id.dir_list);
        mRecView.setRecyclerListener(
                new RecyclerListener() {
                    @Override
@@ -362,7 +363,7 @@ public class DirectoryFragment extends Fragment implements SwipeRefreshLayout.On
                    }
                });

        mRefreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.refresh_layout);
        mRefreshLayout = (SwipeRefreshLayout) mRootView.findViewById(R.id.refresh_layout);
        mRefreshLayout.setOnRefreshListener(this);
        mRecView.setItemAnimator(new DirectoryItemAnimator());

@@ -398,7 +399,7 @@ public class DirectoryFragment extends Fragment implements SwipeRefreshLayout.On

        setPreDrawListenerEnabled(true);

        return view;
        return mRootView;
    }

    @Override
@@ -684,6 +685,9 @@ public class DirectoryFragment extends Fragment implements SwipeRefreshLayout.On

    public void onViewModeChanged() {
        // Mode change is just visual change; no need to kick loader.
        mRootView.announceForAccessibility(getString(
                mState.derivedMode == State.MODE_GRID ? R.string.grid_mode_showing
                        : R.string.list_mode_showing));
        onDisplayStateChanged();
    }