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

Commit 606479bc authored by Peter_Liang's avatar Peter_Liang
Browse files

Add the content description for accessibility tutorial pages.

Bug: 155833961
Test: manual test & robo test
Change-Id: Iec86a6478706dcf6ce224046e8439a3d3b68144a
parent dfb3f561
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -4942,6 +4942,8 @@
    </string>
    <!-- Summary for the accessibility preference screen to enable screen magnification via the nav bar. [CHAR LIMIT=none] -->
    <string name="accessibility_screen_magnification_navbar_summary">When magnification is turned on, you can zoom in on your screen.\n\n<b>To zoom</b>, start magnification, then tap anywhere on the screen.\n<ul><li>Drag 2 or more fingers to scroll</li>\n<li>Pinch 2 or more fingers to adjust zoom</li></ul>\n\n<b>To zoom temporarily</b>, start magnification, then touch &amp; hold anywhere on the screen.\n<ul><li>Drag to move around the screen</li>\n<li>Lift finger to zoom out</li></ul>\n\nYou can’t zoom in on the keyboard or navigation bar.</string>
    <!-- Accessibility label for paging indicator in accessibility tutorial page. [CHAR LIMIT=NONE] -->
    <string name="accessibility_tutorial_pager">Page <xliff:g id="current_page" example="2">%1$d</xliff:g> of <xliff:g id="num_pages" example="3">%2$d</xliff:g></string>
    <!-- Title for the accessibility tutorial dialog in accessibility service with button. [CHAR LIMIT=50] -->
    <string name="accessibility_tutorial_dialog_title_button">Use accessibility button to open</string>
    <!-- Title for the accessibility tutorial dialog in accessibility service with volume keys. [CHAR LIMIT=100] -->
+16 −3
Original line number Diff line number Diff line
@@ -297,8 +297,14 @@ public final class AccessibilityGestureNavigationTutorial {

        final ViewPager viewPager = contentView.findViewById(R.id.view_pager);
        viewPager.setAdapter(new TutorialPagerAdapter(tutorialPages));
        viewPager.setContentDescription(context.getString(R.string.accessibility_tutorial_pager,
                /* firstPage */ 1, tutorialPages.size()));
        viewPager.setImportantForAccessibility(tutorialPages.size() > 1
                ? View.IMPORTANT_FOR_ACCESSIBILITY_YES
                : View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS);
        viewPager.addOnPageChangeListener(
                new TutorialPageChangeListener(context, title, instruction, tutorialPages));
                new TutorialPageChangeListener(context, viewPager, title, instruction,
                        tutorialPages));

        return contentView;
    }
@@ -479,10 +485,12 @@ public final class AccessibilityGestureNavigationTutorial {
        private final TextSwitcher mTitle;
        private final TextSwitcher mInstruction;
        private final List<TutorialPage> mTutorialPages;
        private final ViewPager mViewPager;

        TutorialPageChangeListener(Context context, ViewGroup title, ViewGroup instruction,
                List<TutorialPage> tutorialPages) {
        TutorialPageChangeListener(Context context, ViewPager viewPager, ViewGroup title,
                ViewGroup instruction, List<TutorialPage> tutorialPages) {
            this.mContext = context;
            this.mViewPager = viewPager;
            this.mTitle = (TextSwitcher) title;
            this.mInstruction = (TextSwitcher) instruction;
            this.mTutorialPages = tutorialPages;
@@ -521,6 +529,11 @@ public final class AccessibilityGestureNavigationTutorial {
            }
            mTutorialPages.get(position).getIndicatorIcon().setEnabled(true);
            mLastTutorialPagePosition = position;

            final int currentPageNumber = position + 1;
            mViewPager.setContentDescription(
                    mContext.getString(R.string.accessibility_tutorial_pager,
                            currentPageNumber, mTutorialPages.size()));
        }

        @Override