From 27160a44416df0439aa0a0db0ce89bdacf8ba67a Mon Sep 17 00:00:00 2001 From: Ritwika Mitra Date: Wed, 17 Jun 2020 20:30:16 -0700 Subject: Construct RTL-friendly group conversation title. Bug: 159221409 Test: manual, unit tested API Change-Id: I0b170d4ca5aa9f25c46c77493ade4098ed394e21 --- .../car/messenger/MessageNotificationDelegate.java | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) (limited to 'src/com') diff --git a/src/com/android/car/messenger/MessageNotificationDelegate.java b/src/com/android/car/messenger/MessageNotificationDelegate.java index 2b7126b..807b6d7 100644 --- a/src/com/android/car/messenger/MessageNotificationDelegate.java +++ b/src/com/android/car/messenger/MessageNotificationDelegate.java @@ -56,7 +56,6 @@ import com.bumptech.glide.request.target.SimpleTarget; import com.bumptech.glide.request.transition.Transition; import java.util.ArrayList; -import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -64,7 +63,6 @@ import java.util.Map; import java.util.Set; import java.util.concurrent.CompletableFuture; import java.util.function.Consumer; -import java.util.stream.Collectors; /** Delegate class responsible for handling messaging service actions */ public class MessageNotificationDelegate extends BaseNotificationDelegate implements @@ -410,24 +408,11 @@ public class MessageNotificationDelegate extends BaseNotificationDelegate implem } } - notificationInfo.setConvoTitle(constructGroupConversationTitle(names)); + notificationInfo.setConvoTitle(Utils.constructGroupConversationTitle(names, + mContext.getString(R.string.name_separator), mNotificationConversationTitleLength)); if (allNamesLoaded) mGeneratedGroupConversationTitles.add(conversationKey); } - /** - * Given a name of all the participants in a group conversation (some names might be phone - * numbers), this function creates the conversation title putting the names in alphabetical - * order first, then adding any phone numbers. This title should not exceed the - * mNotificationConversationTitleLength, so not all participants' names are guaranteed to be - * in the conversation title. - */ - private String constructGroupConversationTitle(List names) { - Collections.sort(names, Utils.ALPHA_THEN_NUMERIC_COMPARATOR); - - return names.stream().map(String::valueOf).collect( - Collectors.joining(mContext.getString(R.string.name_separator))); - } - private void loadPhoneNumberInfo(@Nullable String phoneNumber, Consumer action) { if (phoneNumber == null) { -- cgit v1.2.3