Merge "Manage button a11y local actions prompt" into rvc-dev
This commit is contained in:
@@ -57,6 +57,7 @@ import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.WindowInsets;
|
||||
import android.view.WindowManager;
|
||||
import android.view.accessibility.AccessibilityNodeInfo;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import com.android.internal.policy.ScreenDecorationsUtils;
|
||||
@@ -456,6 +457,19 @@ public class BubbleExpandedView extends LinearLayout {
|
||||
mSettingsIcon.setContentDescription(getResources().getString(
|
||||
R.string.bubbles_settings_button_description, bubble.getAppName()));
|
||||
|
||||
mSettingsIcon.setAccessibilityDelegate(
|
||||
new AccessibilityDelegate() {
|
||||
@Override
|
||||
public void onInitializeAccessibilityNodeInfo(View host,
|
||||
AccessibilityNodeInfo info) {
|
||||
super.onInitializeAccessibilityNodeInfo(host, info);
|
||||
// On focus, have TalkBack say
|
||||
// "Actions available. Use swipe up then right to view."
|
||||
// in addition to the default "double tap to activate".
|
||||
mStackView.setupLocalMenu(info);
|
||||
}
|
||||
});
|
||||
|
||||
if (isNew) {
|
||||
mPendingIntent = mBubble.getBubbleIntent();
|
||||
if (mPendingIntent != null || mBubble.getShortcutInfo() != null) {
|
||||
|
||||
@@ -1076,26 +1076,27 @@ public class BubbleStackView extends FrameLayout
|
||||
@Override
|
||||
public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) {
|
||||
super.onInitializeAccessibilityNodeInfoInternal(info);
|
||||
setupLocalMenu(info);
|
||||
}
|
||||
|
||||
// Custom actions.
|
||||
void setupLocalMenu(AccessibilityNodeInfo info) {
|
||||
Resources res = mContext.getResources();
|
||||
|
||||
// Custom local actions.
|
||||
AccessibilityAction moveTopLeft = new AccessibilityAction(R.id.action_move_top_left,
|
||||
getContext().getResources()
|
||||
.getString(R.string.bubble_accessibility_action_move_top_left));
|
||||
res.getString(R.string.bubble_accessibility_action_move_top_left));
|
||||
info.addAction(moveTopLeft);
|
||||
|
||||
AccessibilityAction moveTopRight = new AccessibilityAction(R.id.action_move_top_right,
|
||||
getContext().getResources()
|
||||
.getString(R.string.bubble_accessibility_action_move_top_right));
|
||||
res.getString(R.string.bubble_accessibility_action_move_top_right));
|
||||
info.addAction(moveTopRight);
|
||||
|
||||
AccessibilityAction moveBottomLeft = new AccessibilityAction(R.id.action_move_bottom_left,
|
||||
getContext().getResources()
|
||||
.getString(R.string.bubble_accessibility_action_move_bottom_left));
|
||||
res.getString(R.string.bubble_accessibility_action_move_bottom_left));
|
||||
info.addAction(moveBottomLeft);
|
||||
|
||||
AccessibilityAction moveBottomRight = new AccessibilityAction(R.id.action_move_bottom_right,
|
||||
getContext().getResources()
|
||||
.getString(R.string.bubble_accessibility_action_move_bottom_right));
|
||||
res.getString(R.string.bubble_accessibility_action_move_bottom_right));
|
||||
info.addAction(moveBottomRight);
|
||||
|
||||
// Default actions.
|
||||
|
||||
Reference in New Issue
Block a user