Snap for 7934630 from 486980a69d5d28ecb723512d6ceda70e8e256246 to sc-v2-release
Change-Id: Ibe02d7bd8ed176f00627478b293d0ccdc3bbd159
diff --git a/res-overlayable/values/overlayable.xml b/res-overlayable/values/overlayable.xml
index 893140b..2830abe 100644
--- a/res-overlayable/values/overlayable.xml
+++ b/res-overlayable/values/overlayable.xml
@@ -277,19 +277,19 @@
<item type="string" name="empty_notification_header"/>
<item type="string" name="header_text_separator"/>
<item type="string" name="manage_text"/>
- <item type="string" name="message_unshown_count"/>
<item type="string" name="notification_header"/>
<item type="string" name="notification_older"/>
<item type="string" name="notification_recents"/>
<item type="string" name="notification_service_label"/>
<item type="string" name="notifications"/>
<item type="string" name="restricted_hun_message_content"/>
- <item type="string" name="restricted_numbered_message_content"/>
<item type="string" name="see_more_message"/>
<item type="string" name="show_count_more"/>
<item type="string" name="show_more"/>
<item type="string" name="show_more_from_app"/>
<item type="string" name="toast_message_sent_success"/>
+ <item type="plurals" name="message_unshown_count"/>
+ <item type="plurals" name="restricted_numbered_message_content"/>
<item type="style" name="ClearAllButton"/>
<item type="style" name="ClearAllButtonFooter"/>
<item type="style" name="ClearAllButtonHeader"/>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 0038a7d..4e11648 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -83,10 +83,16 @@
<string name="show_count_more">Show <xliff:g id="count">%d</xliff:g> more</string>
<!-- Text indicating the number of the unshown messages in a messaging style notification [CHAR_LIMIT=15] -->
- <string name="message_unshown_count"><xliff:g id="count">%d</xliff:g> more messages</string>
+ <plurals name="message_unshown_count">
+ <item quantity="one"><xliff:g id="count">%d</xliff:g> more message</item>
+ <item quantity="other"><xliff:g id="count">%d</xliff:g> more messages</item>
+ </plurals>
<!-- Text indicating the number of new messages inside a messaging style notification during driving restriction [CHAR_LIMIT=30] -->
- <string name="restricted_numbered_message_content"><xliff:g id="count">%d</xliff:g> new messages</string>
+ <plurals name="restricted_numbered_message_content">
+ <item quantity="one"><xliff:g id="count">%d</xliff:g> new message</item>
+ <item quantity="other"><xliff:g id="count">%d</xliff:g> new messages</item>
+ </plurals>
<!-- Text indicating that a long text message notification can be expanded to show more text from the message [CHAR_LIMIT=20] -->
<string name="see_more_message">See more</string>
diff --git a/src/com/android/car/notification/template/MessageNotificationViewHolder.java b/src/com/android/car/notification/template/MessageNotificationViewHolder.java
index 8cfb2a5..01f4aa9 100644
--- a/src/com/android/car/notification/template/MessageNotificationViewHolder.java
+++ b/src/com/android/car/notification/template/MessageNotificationViewHolder.java
@@ -217,8 +217,8 @@
String unshownCountText = null;
if (!isRestricted && !isHeadsUp && messageStyleFlag) {
if (unshownCount > 0) {
- unshownCountText = mContext
- .getString(R.string.restricted_numbered_message_content, unshownCount);
+ unshownCountText = mContext.getResources().getQuantityString(
+ R.plurals.restricted_numbered_message_content, unshownCount, unshownCount);
} else if (messageText.toString().endsWith(mEllipsizedSuffix)) {
unshownCountText = mSeeMoreText;
}
@@ -262,9 +262,8 @@
if (isHeadsUp || messageCount == 1) {
messageText = mNewMessageText;
} else {
- messageText =
- mContext.getString(R.string.restricted_numbered_message_content,
- messageCount);
+ messageText = mContext.getResources().getQuantityString(
+ R.plurals.restricted_numbered_message_content, messageCount, messageCount);
}
}
@@ -397,8 +396,8 @@
if (finalUnshownCount <= 0) {
unshownCountText = null;
} else {
- unshownCountText =
- mContext.getString(R.string.message_unshown_count, finalUnshownCount);
+ unshownCountText = mContext.getResources().getQuantityString(
+ R.plurals.message_unshown_count, finalUnshownCount, finalUnshownCount);
}
Drawable launcherIcon = loadAppLauncherIcon(sbn);