From 8c03464c2c348af3bcd3bdfb911cd1bf17a760d0 Mon Sep 17 00:00:00 2001 From: Brandon Maxwell Date: Fri, 30 Oct 2015 17:03:38 -0700 Subject: Updating InCallUI to respect name display and sort preferences + CallCardPresenter, StatusBarNotifier, ConferenceParticipantListAdapter respect display name preferences + ConferenceParticipantListAdapter sorts names in conference call based on sort order preference ~ Still need to populate data objects with real data, currently it's just stubbed Bug: 19364093 Change-Id: I77ad9cb063bf439ae7e5551e40946ea29e414b7f --- InCallUI/src/com/android/incallui/StatusBarNotifier.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'InCallUI/src/com/android/incallui/StatusBarNotifier.java') diff --git a/InCallUI/src/com/android/incallui/StatusBarNotifier.java b/InCallUI/src/com/android/incallui/StatusBarNotifier.java index 76a95f1a6..79a0b2cac 100644 --- a/InCallUI/src/com/android/incallui/StatusBarNotifier.java +++ b/InCallUI/src/com/android/incallui/StatusBarNotifier.java @@ -33,7 +33,9 @@ import android.text.BidiFormatter; import android.text.TextDirectionHeuristics; import android.text.TextUtils; +import com.android.contacts.common.preference.ContactsPreferences; import com.android.contacts.common.util.BitmapUtil; +import com.android.contacts.common.util.ContactDisplayUtils; import com.android.incallui.ContactInfoCache.ContactCacheEntry; import com.android.incallui.ContactInfoCache.ContactInfoCacheCallback; import com.android.incallui.InCallPresenter.InCallState; @@ -57,6 +59,7 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener, private static final int NOTIFICATION_INCOMING_CALL = 2; private final Context mContext; + private final ContactsPreferences mContactsPreferences; private final ContactInfoCache mContactInfoCache; private final NotificationManager mNotificationManager; private int mCurrentNotification = NOTIFICATION_NONE; @@ -71,6 +74,7 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener, public StatusBarNotifier(Context context, ContactInfoCache contactInfoCache) { Preconditions.checkNotNull(context); mContext = context; + mContactsPreferences = new ContactsPreferences(context); mContactInfoCache = contactInfoCache; mNotificationManager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE); @@ -360,13 +364,15 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener, if (call.isConferenceCall() && !call.hasProperty(Details.PROPERTY_GENERIC_CONFERENCE)) { return mContext.getResources().getString(R.string.card_title_conf_call); } - if (TextUtils.isEmpty(contactInfo.name)) { - return TextUtils.isEmpty(contactInfo.number) ? null - : BidiFormatter.getInstance().unicodeWrap( - contactInfo.number.toString(), TextDirectionHeuristics.LTR); + + String preferredName = ContactDisplayUtils.getPreferredDisplayName(contactInfo.namePrimary, + contactInfo.nameAlternative, mContactsPreferences.getDisplayOrder()); + if (TextUtils.isEmpty(preferredName)) { + return TextUtils.isEmpty(contactInfo.number) ? null : BidiFormatter.getInstance() + .unicodeWrap(contactInfo.number, TextDirectionHeuristics.LTR); } - return contactInfo.name; + return preferredName; } private void addPersonReference(Notification.Builder builder, ContactCacheEntry contactInfo, -- cgit v1.2.3