Merge "Overflow a11y" into rvc-dev
This commit is contained in:
@@ -2611,6 +2611,10 @@
|
|||||||
<!-- Text used for content description of settings button in the header of expanded bubble
|
<!-- Text used for content description of settings button in the header of expanded bubble
|
||||||
view. [CHAR_LIMIT=NONE] -->
|
view. [CHAR_LIMIT=NONE] -->
|
||||||
<string name="bubbles_settings_button_description">Settings for <xliff:g id="app_name" example="YouTube">%1$s</xliff:g> bubbles</string>
|
<string name="bubbles_settings_button_description">Settings for <xliff:g id="app_name" example="YouTube">%1$s</xliff:g> bubbles</string>
|
||||||
|
<!-- Content description for button that shows bubble overflow on click [CHAR LIMIT=NONE] -->
|
||||||
|
<string name="bubble_overflow_button_content_description">Overflow</string>
|
||||||
|
<!-- Action to add overflow bubble back to stack. [CHAR LIMIT=NONE] -->
|
||||||
|
<string name="bubble_accessibility_action_add_back">Add back to stack</string>
|
||||||
<!-- The text for the manage bubbles link. [CHAR LIMIT=NONE] -->
|
<!-- The text for the manage bubbles link. [CHAR LIMIT=NONE] -->
|
||||||
<string name="manage_bubbles_text">Manage</string>
|
<string name="manage_bubbles_text">Manage</string>
|
||||||
<!-- Content description when a bubble is focused. [CHAR LIMIT=NONE] -->
|
<!-- Content description when a bubble is focused. [CHAR LIMIT=NONE] -->
|
||||||
|
|||||||
@@ -79,6 +79,8 @@ public class BubbleOverflow implements BubbleViewProvider {
|
|||||||
mOverflowBtn = (BadgedImageView) mInflater.inflate(R.layout.bubble_overflow_button,
|
mOverflowBtn = (BadgedImageView) mInflater.inflate(R.layout.bubble_overflow_button,
|
||||||
parentViewGroup /* root */,
|
parentViewGroup /* root */,
|
||||||
false /* attachToRoot */);
|
false /* attachToRoot */);
|
||||||
|
mOverflowBtn.setContentDescription(mContext.getResources().getString(
|
||||||
|
R.string.bubble_overflow_button_content_description));
|
||||||
|
|
||||||
TypedArray ta = mContext.obtainStyledAttributes(
|
TypedArray ta = mContext.obtainStyledAttributes(
|
||||||
new int[]{android.R.attr.colorBackgroundFloating});
|
new int[]{android.R.attr.colorBackgroundFloating});
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import static com.android.systemui.bubbles.BubbleDebugConfig.TAG_BUBBLES;
|
|||||||
import static com.android.systemui.bubbles.BubbleDebugConfig.TAG_WITH_CLASS_NAME;
|
import static com.android.systemui.bubbles.BubbleDebugConfig.TAG_WITH_CLASS_NAME;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.app.Notification;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
@@ -32,6 +33,7 @@ import android.util.Log;
|
|||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.view.accessibility.AccessibilityNodeInfo;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
@@ -103,7 +105,7 @@ public class BubbleOverflowActivity extends Activity {
|
|||||||
- res.getDimensionPixelSize(R.dimen.bubble_overflow_padding);
|
- res.getDimensionPixelSize(R.dimen.bubble_overflow_padding);
|
||||||
final int viewHeight = recyclerViewHeight / rows;
|
final int viewHeight = recyclerViewHeight / rows;
|
||||||
|
|
||||||
mAdapter = new BubbleOverflowAdapter(mOverflowBubbles,
|
mAdapter = new BubbleOverflowAdapter(getApplicationContext(), mOverflowBubbles,
|
||||||
mBubbleController::promoteBubbleFromOverflow, viewWidth, viewHeight);
|
mBubbleController::promoteBubbleFromOverflow, viewWidth, viewHeight);
|
||||||
mRecyclerView.setAdapter(mAdapter);
|
mRecyclerView.setAdapter(mAdapter);
|
||||||
|
|
||||||
@@ -221,13 +223,15 @@ public class BubbleOverflowActivity extends Activity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class BubbleOverflowAdapter extends RecyclerView.Adapter<BubbleOverflowAdapter.ViewHolder> {
|
class BubbleOverflowAdapter extends RecyclerView.Adapter<BubbleOverflowAdapter.ViewHolder> {
|
||||||
|
private Context mContext;
|
||||||
private Consumer<Bubble> mPromoteBubbleFromOverflow;
|
private Consumer<Bubble> mPromoteBubbleFromOverflow;
|
||||||
private List<Bubble> mBubbles;
|
private List<Bubble> mBubbles;
|
||||||
private int mWidth;
|
private int mWidth;
|
||||||
private int mHeight;
|
private int mHeight;
|
||||||
|
|
||||||
public BubbleOverflowAdapter(List<Bubble> list, Consumer<Bubble> promoteBubble, int width,
|
public BubbleOverflowAdapter(Context context, List<Bubble> list, Consumer<Bubble> promoteBubble,
|
||||||
int height) {
|
int width, int height) {
|
||||||
|
mContext = context;
|
||||||
mBubbles = list;
|
mBubbles = list;
|
||||||
mPromoteBubbleFromOverflow = promoteBubble;
|
mPromoteBubbleFromOverflow = promoteBubble;
|
||||||
mWidth = width;
|
mWidth = width;
|
||||||
@@ -260,6 +264,32 @@ class BubbleOverflowAdapter extends RecyclerView.Adapter<BubbleOverflowAdapter.V
|
|||||||
mPromoteBubbleFromOverflow.accept(b);
|
mPromoteBubbleFromOverflow.accept(b);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
final CharSequence titleCharSeq =
|
||||||
|
b.getEntry().getSbn().getNotification().extras.getCharSequence(
|
||||||
|
Notification.EXTRA_TITLE);
|
||||||
|
String titleStr = mContext.getResources().getString(R.string.notification_bubble_title);
|
||||||
|
if (titleCharSeq != null) {
|
||||||
|
titleStr = titleCharSeq.toString();
|
||||||
|
}
|
||||||
|
vh.iconView.setContentDescription(mContext.getResources().getString(
|
||||||
|
R.string.bubble_content_description_single, titleStr, b.getAppName()));
|
||||||
|
|
||||||
|
vh.iconView.setAccessibilityDelegate(
|
||||||
|
new View.AccessibilityDelegate() {
|
||||||
|
@Override
|
||||||
|
public void onInitializeAccessibilityNodeInfo(View host,
|
||||||
|
AccessibilityNodeInfo info) {
|
||||||
|
super.onInitializeAccessibilityNodeInfo(host, info);
|
||||||
|
// Talkback prompts "Double tap to add back to stack"
|
||||||
|
// instead of the default "Double tap to activate"
|
||||||
|
info.addAction(
|
||||||
|
new AccessibilityNodeInfo.AccessibilityAction(
|
||||||
|
AccessibilityNodeInfo.ACTION_CLICK,
|
||||||
|
mContext.getResources().getString(
|
||||||
|
R.string.bubble_accessibility_action_add_back)));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
Bubble.FlyoutMessage message = b.getFlyoutMessage();
|
Bubble.FlyoutMessage message = b.getFlyoutMessage();
|
||||||
if (message != null && message.senderName != null) {
|
if (message != null && message.senderName != null) {
|
||||||
vh.textView.setText(message.senderName);
|
vh.textView.setText(message.senderName);
|
||||||
|
|||||||
Reference in New Issue
Block a user