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

Commit 1dad12e2 authored by Aga Wronska's avatar Aga Wronska
Browse files

Add guard to access drawer toolbar when setting accessibility, because this...

Add guard to access drawer toolbar when setting accessibility, because this toolbar does not exist in
fixed_layout mode.

Change-Id: Iaccbdf848b7d1e9ccb7c4cca3afd153a2246e68d
Fixed: 27812831
parent 9dec524c
Loading
Loading
Loading
Loading
+13 −6
Original line number Diff line number Diff line
@@ -527,10 +527,14 @@ public class DirectoryFragment extends Fragment

            // Re-enable TalkBack for the toolbars, as they are no longer covered by action mode.
            final Toolbar toolbar = (Toolbar) getActivity().findViewById(R.id.toolbar);
            final Toolbar rootsToolbar = (Toolbar) getActivity().findViewById(R.id.roots_toolbar);
            toolbar.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_AUTO);

            // This toolbar is not present in the fixed_layout
            final Toolbar rootsToolbar = (Toolbar) getActivity().findViewById(R.id.roots_toolbar);
            if (rootsToolbar != null) {
                rootsToolbar.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_AUTO);
            }
        }

        @Override
        public boolean onCreateActionMode(ActionMode mode, Menu menu) {
@@ -544,13 +548,16 @@ public class DirectoryFragment extends Fragment
                // Hide the toolbars if action mode is enabled, so TalkBack doesn't navigate to
                // these controls when using linear navigation.
                final Toolbar toolbar = (Toolbar) getActivity().findViewById(R.id.toolbar);
                final Toolbar rootsToolbar = (Toolbar) getActivity().findViewById(
                        R.id.roots_toolbar);
                toolbar.setImportantForAccessibility(
                        View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS);

                // This toolbar is not present in the fixed_layout
                final Toolbar rootsToolbar = (Toolbar) getActivity().findViewById(
                        R.id.roots_toolbar);
                if (rootsToolbar != null) {
                    rootsToolbar.setImportantForAccessibility(
                            View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS);

                }
                return true;
            }