diff options
| author | 2019-05-31 11:52:00 +0800 | |
|---|---|---|
| committer | 2019-06-03 13:59:38 +0000 | |
| commit | 9176f033d97d4ec9435a5ca61f1b8c051dc46bbf (patch) | |
| tree | 082ea8a8b1c06c810bbb6d82c485b8006541f1aa | |
| parent | 6f574c4d3a79c4b0e55b046003c531d1342330db (diff) | |
User education support on disambiguation dialog
Support Accessibility education according to
1. Gesture Navigation is on or off
2. Screen reader feature (such as TalkBack) is enabled or not
Manual test screenshot: https://drive.google.com/open?id=1afTDRYPMcZphM5cL0krPDA_Vh9pRX-8x
Bug: 133811747
Test: Manual
Change-Id: I04ca36c9e88ff14e29103db41cfab2a9b53985d5
| -rw-r--r-- | core/java/com/android/internal/app/AccessibilityButtonChooserActivity.java | 27 | ||||
| -rw-r--r-- | core/res/res/layout/accessibility_button_chooser.xml | 1 | ||||
| -rw-r--r-- | core/res/res/values/strings.xml | 12 | ||||
| -rw-r--r-- | core/res/res/values/symbols.xml | 7 |
4 files changed, 44 insertions, 3 deletions
diff --git a/core/java/com/android/internal/app/AccessibilityButtonChooserActivity.java b/core/java/com/android/internal/app/AccessibilityButtonChooserActivity.java index b9ed96395130..7af45fc53ddf 100644 --- a/core/java/com/android/internal/app/AccessibilityButtonChooserActivity.java +++ b/core/java/com/android/internal/app/AccessibilityButtonChooserActivity.java @@ -15,6 +15,8 @@ */ package com.android.internal.app; +import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL; + import android.accessibilityservice.AccessibilityServiceInfo; import android.annotation.NonNull; import android.annotation.Nullable; @@ -64,8 +66,21 @@ public class AccessibilityButtonChooserActivity extends Activity { String component = Settings.Secure.getString(getContentResolver(), Settings.Secure.ACCESSIBILITY_BUTTON_TARGET_COMPONENT); + + if (isGestureNavigateEnabled()) { + TextView promptPrologue = findViewById(R.id.accessibility_button_prompt_prologue); + promptPrologue.setText(isTouchExploreOn() + ? R.string.accessibility_gesture_3finger_prompt_text + : R.string.accessibility_gesture_prompt_text); + } + if (TextUtils.isEmpty(component)) { TextView prompt = findViewById(R.id.accessibility_button_prompt); + if (isGestureNavigateEnabled()) { + prompt.setText(isTouchExploreOn() + ? R.string.accessibility_gesture_3finger_instructional_text + : R.string.accessibility_gesture_instructional_text); + } prompt.setVisibility(View.VISIBLE); } @@ -91,6 +106,16 @@ public class AccessibilityButtonChooserActivity extends Activity { }); } + private boolean isGestureNavigateEnabled() { + return NAV_BAR_MODE_GESTURAL == getResources().getInteger( + com.android.internal.R.integer.config_navBarInteractionMode); + } + + private boolean isTouchExploreOn() { + return ((AccessibilityManager) getSystemService(Context.ACCESSIBILITY_SERVICE)) + .isTouchExplorationEnabled(); + } + private static List<AccessibilityButtonTarget> getServiceAccessibilityButtonTargets( @NonNull Context context) { AccessibilityManager ams = (AccessibilityManager) context.getSystemService( @@ -177,4 +202,4 @@ public class AccessibilityButtonChooserActivity extends Activity { return mDrawable; } } -}
\ No newline at end of file +} diff --git a/core/res/res/layout/accessibility_button_chooser.xml b/core/res/res/layout/accessibility_button_chooser.xml index 480defbd5935..383780a3ccde 100644 --- a/core/res/res/layout/accessibility_button_chooser.xml +++ b/core/res/res/layout/accessibility_button_chooser.xml @@ -40,6 +40,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:minHeight="56dp" + android:id="@+id/accessibility_button_prompt_prologue" android:textAppearance="?attr/textAppearanceMedium" android:text="@string/accessibility_button_prompt_text" android:gravity="start|center_vertical" diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml index 5b917cc4fdf1..d46b3760f51e 100644 --- a/core/res/res/values/strings.xml +++ b/core/res/res/values/strings.xml @@ -4495,10 +4495,18 @@ <xliff:g id="service_name" example="TalkBack">%1$s</xliff:g></string> <!-- Text appearing in a prompt at the top of UI allowing the user to select a target service or feature to be assigned to the Accessibility button in the navigation bar. --> - <string name="accessibility_button_prompt_text">Choose a feature to use when you tap the Accessibility button:</string> + <string name="accessibility_button_prompt_text">Choose a service to use when you tap the accessibility button:</string> + <!-- Text appearing in a prompt at the top of UI allowing the user to select a target service or feature to be assigned to the Accessibility button when gesture navigation is enabled [CHAR LIMIT=none] --> + <string name="accessibility_gesture_prompt_text">Choose a service to use with the accessibility gesture (swipe up from the bottom of the screen with two fingers):</string> + <!-- Text appearing in a prompt at the top of UI allowing the user to select a target service or feature to be assigned to the Accessibility button when gesture navigation and TalkBack is enabled [CHAR LIMIT=none] --> + <string name="accessibility_gesture_3finger_prompt_text">Choose a service to use with the accessibility gesture (swipe up from the bottom of the screen with three fingers):</string> <!-- Text describing how to display UI allowing a user to select a target service or feature to be assigned to the Accessibility button in the navigation bar. --> - <string name="accessibility_button_instructional_text">To change features, touch & hold the Accessibility button.</string> + <string name="accessibility_button_instructional_text">To switch between services, touch & hold the accessibility button.</string> + <!-- Text describing how to display UI allowing a user to select a target service or feature to be assigned to the Accessibility button when gesture navigation is enabled. [CHAR LIMIT=none] --> + <string name="accessibility_gesture_instructional_text">To switch between services, swipe up with two fingers and hold.</string> + <!-- Text describing how to display UI allowing a user to select a target service or feature to be assigned to the Accessibility button when gesture navigation and TalkBack is enabled. [CHAR LIMIT=none] --> + <string name="accessibility_gesture_3finger_instructional_text">To switch between services, swipe up with three fingers and hold.</string> <!-- Text used to describe system navigation features, shown within a UI allowing a user to assign system magnification features to the Accessibility button in the navigation bar. --> <string name="accessibility_magnification_chooser_text">Magnification</string> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 4af05f699073..89cfa11a7737 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -3286,9 +3286,16 @@ <java-symbol type="layout" name="accessibility_button_chooser_item" /> <java-symbol type="id" name="accessibility_button_chooser_grid" /> <java-symbol type="id" name="accessibility_button_prompt" /> + <java-symbol type="id" name="accessibility_button_prompt_prologue" /> <java-symbol type="id" name="accessibility_button_target_icon" /> <java-symbol type="id" name="accessibility_button_target_label" /> <java-symbol type="string" name="accessibility_magnification_chooser_text" /> + + <java-symbol type="string" name="accessibility_gesture_prompt_text" /> + <java-symbol type="string" name="accessibility_gesture_3finger_prompt_text" /> + <java-symbol type="string" name="accessibility_gesture_instructional_text" /> + <java-symbol type="string" name="accessibility_gesture_3finger_instructional_text" /> + <java-symbol type="drawable" name="ic_accessibility_magnification" /> <!-- com.android.internal.widget.RecyclerView --> |