diff options
author | calderwoodra <calderwoodra@google.com> | 2017-07-21 15:33:08 -0700 |
---|---|---|
committer | Eric Erfanian <erfanian@google.com> | 2017-07-25 16:45:16 +0000 |
commit | 4a599986183a41c4d67791c253bf3c22d10ef547 (patch) | |
tree | 18ff04c0f44bc188cc33772deff94d88f54d7e47 /java/com/android/dialer/searchfragment/cp2 | |
parent | 2919941419a5f814cd2f02a6b3876e56b0478352 (diff) |
Added RecyclerView.ViewHolder for remote contacts in search list.
When Dialer users search for contacts, if they have an enterprise account on
their device, they can also search for enterprise/remote contacts. This change
adds the viewholder that shows these contacts to the user.
Bug: 37209462
Test: RemoteContactViewHolderTest
PiperOrigin-RevId: 162793301
Change-Id: Ifa409f49c8a0069b0753a138f4762830921cb3f7
Diffstat (limited to 'java/com/android/dialer/searchfragment/cp2')
-rw-r--r-- | java/com/android/dialer/searchfragment/cp2/SearchContactViewHolder.java | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/java/com/android/dialer/searchfragment/cp2/SearchContactViewHolder.java b/java/com/android/dialer/searchfragment/cp2/SearchContactViewHolder.java index 734aefdcb..4b5cab901 100644 --- a/java/com/android/dialer/searchfragment/cp2/SearchContactViewHolder.java +++ b/java/com/android/dialer/searchfragment/cp2/SearchContactViewHolder.java @@ -91,7 +91,7 @@ public final class SearchContactViewHolder extends ViewHolder implements OnClick numberView.setText(QueryBoldingUtil.getNumberWithQueryBolded(query, secondaryInfo)); setCallToAction(cursor); - if (shouldShowPhoto(cursor, name)) { + if (shouldShowPhoto(cursor)) { nameOrNumberView.setVisibility(View.VISIBLE); photo.setVisibility(View.VISIBLE); String photoUri = cursor.getString(Projections.PHONE_PHOTO_URI); @@ -109,15 +109,16 @@ public final class SearchContactViewHolder extends ViewHolder implements OnClick } } - private boolean shouldShowPhoto(Cursor cursor, String currentName) { + private boolean shouldShowPhoto(Cursor cursor) { int currentPosition = cursor.getPosition(); if (currentPosition == 0) { return true; } else { + String currentLookupKey = cursor.getString(Projections.PHONE_LOOKUP_KEY); cursor.moveToPosition(currentPosition - 1); - String previousName = cursor.getString(Projections.PHONE_DISPLAY_NAME); + String previousLookupKey = cursor.getString(Projections.PHONE_LOOKUP_KEY); cursor.moveToPosition(currentPosition); - return !currentName.equals(previousName); + return !currentLookupKey.equals(previousLookupKey); } } |