Add the content description for accessibility tutorial pages.
Bug: 155833961 Test: manual test & robo test Change-Id: Iec86a6478706dcf6ce224046e8439a3d3b68144a
This commit is contained in:
@@ -4942,6 +4942,8 @@
|
|||||||
</string>
|
</string>
|
||||||
<!-- Summary for the accessibility preference screen to enable screen magnification via the nav bar. [CHAR LIMIT=none] -->
|
<!-- 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 & 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>
|
<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 & 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] -->
|
<!-- 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>
|
<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] -->
|
<!-- Title for the accessibility tutorial dialog in accessibility service with volume keys. [CHAR LIMIT=100] -->
|
||||||
|
@@ -297,8 +297,14 @@ public final class AccessibilityGestureNavigationTutorial {
|
|||||||
|
|
||||||
final ViewPager viewPager = contentView.findViewById(R.id.view_pager);
|
final ViewPager viewPager = contentView.findViewById(R.id.view_pager);
|
||||||
viewPager.setAdapter(new TutorialPagerAdapter(tutorialPages));
|
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(
|
viewPager.addOnPageChangeListener(
|
||||||
new TutorialPageChangeListener(context, title, instruction, tutorialPages));
|
new TutorialPageChangeListener(context, viewPager, title, instruction,
|
||||||
|
tutorialPages));
|
||||||
|
|
||||||
return contentView;
|
return contentView;
|
||||||
}
|
}
|
||||||
@@ -479,10 +485,12 @@ public final class AccessibilityGestureNavigationTutorial {
|
|||||||
private final TextSwitcher mTitle;
|
private final TextSwitcher mTitle;
|
||||||
private final TextSwitcher mInstruction;
|
private final TextSwitcher mInstruction;
|
||||||
private final List<TutorialPage> mTutorialPages;
|
private final List<TutorialPage> mTutorialPages;
|
||||||
|
private final ViewPager mViewPager;
|
||||||
|
|
||||||
TutorialPageChangeListener(Context context, ViewGroup title, ViewGroup instruction,
|
TutorialPageChangeListener(Context context, ViewPager viewPager, ViewGroup title,
|
||||||
List<TutorialPage> tutorialPages) {
|
ViewGroup instruction, List<TutorialPage> tutorialPages) {
|
||||||
this.mContext = context;
|
this.mContext = context;
|
||||||
|
this.mViewPager = viewPager;
|
||||||
this.mTitle = (TextSwitcher) title;
|
this.mTitle = (TextSwitcher) title;
|
||||||
this.mInstruction = (TextSwitcher) instruction;
|
this.mInstruction = (TextSwitcher) instruction;
|
||||||
this.mTutorialPages = tutorialPages;
|
this.mTutorialPages = tutorialPages;
|
||||||
@@ -521,6 +529,11 @@ public final class AccessibilityGestureNavigationTutorial {
|
|||||||
}
|
}
|
||||||
mTutorialPages.get(position).getIndicatorIcon().setEnabled(true);
|
mTutorialPages.get(position).getIndicatorIcon().setEnabled(true);
|
||||||
mLastTutorialPagePosition = position;
|
mLastTutorialPagePosition = position;
|
||||||
|
|
||||||
|
final int currentPageNumber = position + 1;
|
||||||
|
mViewPager.setContentDescription(
|
||||||
|
mContext.getString(R.string.accessibility_tutorial_pager,
|
||||||
|
currentPageNumber, mTutorialPages.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Reference in New Issue
Block a user