From 4029f92f12695af38a6a481b962051a0bc1f957c Mon Sep 17 00:00:00 2001 From: Julia Reynolds Date: Fri, 29 May 2020 15:33:29 -0400 Subject: [PATCH] Add a bubbles content description Test: manual with a11y service Fixes: 155262236 Change-Id: Ib4c9650e1d90c4681ca721df3fde58ffc9430078 --- res/values/strings.xml | 4 ++++ .../notification/AppBubbleListPreferenceController.java | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/res/values/strings.xml b/res/values/strings.xml index 29687401662..a60a46455cb 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -8241,6 +8241,10 @@ Conversations All conversations can bubble except + + Turn off bubbles for this conversation + + Turn on bubbles for this conversation Swipe actions diff --git a/src/com/android/settings/notification/AppBubbleListPreferenceController.java b/src/com/android/settings/notification/AppBubbleListPreferenceController.java index 457a61ce45b..5564f43ecca 100644 --- a/src/com/android/settings/notification/AppBubbleListPreferenceController.java +++ b/src/com/android/settings/notification/AppBubbleListPreferenceController.java @@ -111,6 +111,7 @@ public class AppBubbleListPreferenceController extends AppConversationListPrefer public Preference createConversationPref(final ConversationChannelWrapper conversation) { final ConversationPreference pref = new ConversationPreference(mContext); populateConversationPreference(conversation, pref); + pref.setOnClickBubblesConversation(mAppRow.bubblePreference == BUBBLE_PREFERENCE_ALL); pref.setOnClickListener((v) -> { conversation.getNotificationChannel().setAllowBubbles(DEFAULT_ALLOW_BUBBLE); mBackend.updateChannel(mAppRow.pkg, mAppRow.uid, conversation.getNotificationChannel()); @@ -127,6 +128,7 @@ public class AppBubbleListPreferenceController extends AppConversationListPrefer public static class ConversationPreference extends Preference implements View.OnClickListener { View.OnClickListener mOnClickListener; + boolean mOnClickBubbles; ConversationPreference(Context context) { super(context); @@ -137,9 +139,16 @@ public class AppBubbleListPreferenceController extends AppConversationListPrefer public void onBindViewHolder(final PreferenceViewHolder holder) { super.onBindViewHolder(holder); ImageView view = holder.itemView.findViewById(R.id.button); + view.setContentDescription(mOnClickBubbles + ? getContext().getString(R.string.bubble_app_setting_bubble_conversation) + : getContext().getString(R.string.bubble_app_setting_unbubble_conversation)); view.setOnClickListener(mOnClickListener); } + public void setOnClickBubblesConversation(boolean enablesBubbles) { + mOnClickBubbles = enablesBubbles; + } + public void setOnClickListener(View.OnClickListener listener) { mOnClickListener = listener; }