diff options
author | twyen <twyen@google.com> | 2018-06-26 16:04:53 -0700 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2018-06-26 16:04:53 -0700 |
commit | bfd105673cd6eb21a1c207d24169ad9bfe645539 (patch) | |
tree | 198fcf37848a75c8d68f74679a56fd9dc0f4891b /java/com/android/dialer/app/list/PhoneFavoritesTileAdapter.java | |
parent | ee0371753257a3db0cce37f5dffae7ac6ebf34b2 (diff) | |
parent | f9d508090cbf3b9f85b72241c77f625c152448bc (diff) |
Merge changes I45374e61,I265dcc61,Id4622886,I09d0df69,I3ea0fb46 am: 2f6900466e am: e6262b0bce
am: f9d508090c
Change-Id: I329713a5083f5ccd632b536e41f466eaef9dc4e2
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 = |