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

Commit 202320d7 authored by Tony Huang's avatar Tony Huang
Browse files

Avoid talkback speaking unnecessary information

Because No items view might occupy multiple columns on recycler view
when grid mode displayed, talkback will speak such infomation.
This will confuse user so we set span column to 1 in this case.

Fix: 141223688
Test: manual
Test: atest DocumentsUIGoogleTests
Change-Id: Idfe71830cc2fb2062da1c67cf26641083f35040c
parent 181d334c
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -596,6 +596,12 @@ public class DirectoryFragment extends Fragment implements SwipeRefreshLayout.On
    }

    private int calculateColumnCount(@ViewMode int mode) {
        // For fixing a11y issue b/141223688, if there's only "no items" displayed, we should set
        // span column to 1 to avoid talkback speaking unnecessary information.
        if (mModel != null && mModel.getItemCount() == 0) {
            return 1;
        }

        if (mode == MODE_LIST) {
            // List mode is a "grid" with 1 column.
            return 1;