diff options
author | Brandon Maxwell <maxwelb@google.com> | 2015-10-30 17:03:38 -0700 |
---|---|---|
committer | Brandon Maxwell <maxwelb@google.com> | 2015-11-03 12:50:11 -0800 |
commit | 8c03464c2c348af3bcd3bdfb911cd1bf17a760d0 (patch) | |
tree | ae3ec01aeda2ed8ac059f0dc3d20e94d0df99ac2 /InCallUI/src/com/android/incallui/StatusBarNotifier.java | |
parent | b121fac65ada38d92ac8dca298eadde163f443fb (diff) |
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
Diffstat (limited to 'InCallUI/src/com/android/incallui/StatusBarNotifier.java')
-rw-r--r-- | InCallUI/src/com/android/incallui/StatusBarNotifier.java | 16 |
1 files changed, 11 insertions, 5 deletions
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, |