From 305e920048ca6828c700c02a6983a6cb97bf1692 Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Tue, 23 Jan 2018 17:46:47 -0800 Subject: [PATCH] Add notification count to content description for badged apps Bug: 70389249 Change-Id: If7f43941d501ba807adbb33d489da3944c012e94 --- res/values/strings.xml | 5 +++++ src/com/android/launcher3/BubbleTextView.java | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/res/values/strings.xml b/res/values/strings.xml index ee09946717..2318e9e182 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -132,6 +132,11 @@ Disabled %1$s + + + %1$s, has %2$d notification + %1$s, has %2$d notifications + diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java index 46d7227081..dbdb2dca95 100644 --- a/src/com/android/launcher3/BubbleTextView.java +++ b/src/com/android/launcher3/BubbleTextView.java @@ -560,6 +560,15 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, invalidate(); } } + if (itemInfo.contentDescription != null) { + if (hasBadge()) { + int count = mBadgeInfo.getNotificationCount(); + setContentDescription(getContext().getResources().getQuantityString( + R.plurals.badged_app_label, count, itemInfo.contentDescription, count)); + } else { + setContentDescription(itemInfo.contentDescription); + } + } } }