Merge "User education support on disambiguation dialog" into qt-dev

am: 327751f18f

Change-Id: I10d527a237fa2c47d6bef193de8aa194f391c74b
This commit is contained in:
Kevin Yao
2019-06-03 18:40:08 -07:00
committed by android-build-merger
4 changed files with 44 additions and 3 deletions

View File

@@ -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;
}
}
}
}

View File

@@ -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"

View File

@@ -4498,10 +4498,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 &amp; hold the Accessibility button.</string>
<string name="accessibility_button_instructional_text">To switch between services, touch &amp; 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>

View File

@@ -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 -->