diff options
author | Brandon Maxwell <maxwelb@google.com> | 2015-10-23 12:01:00 -0700 |
---|---|---|
committer | Brandon Maxwell <maxwelb@google.com> | 2015-10-26 16:32:29 -0700 |
commit | 36aeec91ed927b7fe3a27bcd5e224443899117f1 (patch) | |
tree | 853e12b1c575c2ecfc568001e7a73da8e67d2869 /src/com/android/dialer/CallDetailActivity.java | |
parent | c58c53f9bf497f891e857da4b55a02b594082da6 (diff) |
CallDetailActivity respect display name order
- Updated the CallDetailActivity to choose whether to show last name first
or first name first based on user preferences.
- Modified callLog code to behave in a similar fashion
- Fixed bug in ContactInfoHelperTests
- Rename PhoneCallDetails.name -> PhoneCallDetails.namePrimary
Bug: 19364093
Change-Id: I50971ad0f26f6ede49f1c82965d1b00ce0cba4d3
Diffstat (limited to 'src/com/android/dialer/CallDetailActivity.java')
-rw-r--r-- | src/com/android/dialer/CallDetailActivity.java | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/com/android/dialer/CallDetailActivity.java b/src/com/android/dialer/CallDetailActivity.java index 284a5785e..2aff61c4c 100644 --- a/src/com/android/dialer/CallDetailActivity.java +++ b/src/com/android/dialer/CallDetailActivity.java @@ -24,7 +24,6 @@ import android.net.Uri; import android.os.Bundle; import android.provider.ContactsContract.CommonDataKinds.Phone; import android.support.v7.app.AppCompatActivity; -import android.telecom.PhoneAccountHandle; import android.text.BidiFormatter; import android.text.TextDirectionHeuristics; import android.text.TextUtils; @@ -45,6 +44,7 @@ import com.android.contacts.common.ContactPhotoManager.DefaultImageRequest; import com.android.contacts.common.ContactPhotoManager; import com.android.contacts.common.GeoUtil; import com.android.contacts.common.interactions.TouchPointManager; +import com.android.contacts.common.preference.ContactsPreferences; import com.android.contacts.common.testing.NeededForTesting; import com.android.contacts.common.util.UriUtils; import com.android.dialer.calllog.CallDetailHistoryAdapter; @@ -109,7 +109,6 @@ public class CallDetailActivity extends AppCompatActivity mDetails = details[0]; mNumber = TextUtils.isEmpty(mDetails.number) ? null : mDetails.number.toString(); mDisplayNumber = mDetails.displayNumber; - final int numberPresentation = mDetails.numberPresentation; final CharSequence callLocationOrType = getNumberTypeOrLocation(mDetails); @@ -117,8 +116,10 @@ public class CallDetailActivity extends AppCompatActivity final String displayNumberStr = mBidiFormatter.unicodeWrap( displayNumber.toString(), TextDirectionHeuristics.LTR); - if (!TextUtils.isEmpty(mDetails.name)) { - mCallerName.setText(mDetails.name); + mDetails.nameDisplayOrder = mContactsPreferences.getDisplayOrder(); + + if (!TextUtils.isEmpty(mDetails.getPreferredName())) { + mCallerName.setText(mDetails.getPreferredName()); mCallerNumber.setText(callLocationOrType + " " + displayNumberStr); } else { mCallerName.setText(displayNumberStr); @@ -174,7 +175,7 @@ public class CallDetailActivity extends AppCompatActivity * @return The phone number type or location. */ private CharSequence getNumberTypeOrLocation(PhoneCallDetails details) { - if (!TextUtils.isEmpty(details.name)) { + if (!TextUtils.isEmpty(details.namePrimary)) { return Phone.getTypeLabel(mResources, details.numberType, details.numberLabel); } else { @@ -185,6 +186,7 @@ public class CallDetailActivity extends AppCompatActivity private Context mContext; private ContactInfoHelper mContactInfoHelper; + private ContactsPreferences mContactsPreferences; private CallTypeHelper mCallTypeHelper; private ContactPhotoManager mContactPhotoManager; private FilteredNumberAsyncQueryHandler mFilteredNumberAsyncQueryHandler; @@ -223,6 +225,7 @@ public class CallDetailActivity extends AppCompatActivity mContext = this; mResources = getResources(); mContactInfoHelper = new ContactInfoHelper(this, GeoUtil.getCurrentCountryIso(this)); + mContactsPreferences = new ContactsPreferences(mContext); mCallTypeHelper = new CallTypeHelper(getResources()); mFilteredNumberAsyncQueryHandler = new FilteredNumberAsyncQueryHandler(getContentResolver()); @@ -280,6 +283,7 @@ public class CallDetailActivity extends AppCompatActivity @Override public void onResume() { super.onResume(); + mContactsPreferences.refreshValue(ContactsPreferences.DISPLAY_ORDER_KEY); getCallDetails(); } @@ -436,8 +440,8 @@ public class CallDetailActivity extends AppCompatActivity contactType = ContactPhotoManager.TYPE_BUSINESS; } - final String displayName = TextUtils.isEmpty(mDetails.name) - ? mDetails.displayNumber : mDetails.name.toString(); + final String displayName = TextUtils.isEmpty(mDetails.namePrimary) + ? mDetails.displayNumber : mDetails.namePrimary.toString(); final String lookupKey = mDetails.contactUri == null ? null : UriUtils.getLookupKeyFromUri(mDetails.contactUri); |