diff options
author | twyen <twyen@google.com> | 2018-06-26 15:39:38 -0700 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2018-06-26 15:39:38 -0700 |
commit | e6262b0bcebc185ee15ad22d6e723e80c2b267a2 (patch) | |
tree | 198fcf37848a75c8d68f74679a56fd9dc0f4891b /java/com/android/dialer/app/list/PhoneFavoritesTileAdapter.java | |
parent | 9dc597525bfdf5cadfc9089ceaef8b471eaf7bcf (diff) | |
parent | 2f6900466eb5d41709927a79374b3ccd0cfaa6c1 (diff) |
Merge changes I45374e61,I265dcc61,Id4622886,I09d0df69,I3ea0fb46
am: 2f6900466e
Change-Id: I9ca24b23be3c19b961f9c1c8806e69bc02da726e
Diffstat (limited to 'java/com/android/dialer/app/list/PhoneFavoritesTileAdapter.java')
-rw-r--r-- | java/com/android/dialer/app/list/PhoneFavoritesTileAdapter.java | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/java/com/android/dialer/app/list/PhoneFavoritesTileAdapter.java b/java/com/android/dialer/app/list/PhoneFavoritesTileAdapter.java index a20185989..4cc48a6de 100644 --- a/java/com/android/dialer/app/list/PhoneFavoritesTileAdapter.java +++ b/java/com/android/dialer/app/list/PhoneFavoritesTileAdapter.java @@ -37,10 +37,10 @@ import android.widget.BaseAdapter; import com.android.contacts.common.ContactTileLoaderFactory; import com.android.contacts.common.list.ContactEntry; import com.android.contacts.common.list.ContactTileView; -import com.android.contacts.common.preference.ContactsPreferences; import com.android.dialer.app.R; import com.android.dialer.common.LogUtil; import com.android.dialer.contactphoto.ContactPhotoManager; +import com.android.dialer.contacts.ContactsComponent; import com.android.dialer.duo.Duo; import com.android.dialer.duo.DuoComponent; import com.android.dialer.logging.InteractionEvent; @@ -78,11 +78,11 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements OnDragDrop private OnDataSetChangedForAnimationListener dataSetChangedListener; private Context context; private Resources resources; - private ContactsPreferences contactsPreferences; private final Comparator<ContactEntry> contactEntryComparator = new Comparator<ContactEntry>() { @Override public int compare(ContactEntry lhs, ContactEntry rhs) { + return ComparisonChain.start() .compare(lhs.pinned, rhs.pinned) .compare(getPreferredSortName(lhs), getPreferredSortName(rhs)) @@ -90,11 +90,9 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements OnDragDrop } private String getPreferredSortName(ContactEntry contactEntry) { - if (contactsPreferences.getSortOrder() == ContactsPreferences.SORT_ORDER_PRIMARY - || TextUtils.isEmpty(contactEntry.nameAlternative)) { - return contactEntry.namePrimary; - } - return contactEntry.nameAlternative; + return ContactsComponent.get(context) + .contactDisplayPreferences() + .getSortName(contactEntry.namePrimary, contactEntry.nameAlternative); } }; /** Back up of the temporarily removed Contact during dragging. */ @@ -121,7 +119,6 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements OnDragDrop this.listener = listener; this.context = context; resources = context.getResources(); - contactsPreferences = new ContactsPreferences(this.context); numFrequents = 0; contactEntries = new ArrayList<>(); } @@ -140,11 +137,6 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements OnDragDrop this.inDragging = inDragging; } - void refreshContactsPreferences() { - contactsPreferences.refreshValue(ContactsPreferences.DISPLAY_ORDER_KEY); - contactsPreferences.refreshValue(ContactsPreferences.SORT_ORDER_KEY); - } - /** * Gets the number of frequents from the passed in cursor. * @@ -256,7 +248,6 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements OnDragDrop (!TextUtils.isEmpty(nameAlternative)) ? nameAlternative : resources.getString(R.string.missing_name); - contact.nameDisplayOrder = contactsPreferences.getDisplayOrder(); contact.photoUri = (photoUri != null ? Uri.parse(photoUri) : null); contact.lookupKey = lookupKey; contact.lookupUri = |