From 4a599986183a41c4d67791c253bf3c22d10ef547 Mon Sep 17 00:00:00 2001 From: calderwoodra Date: Fri, 21 Jul 2017 15:33:08 -0700 Subject: 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 --- .../dialer/searchfragment/cp2/SearchContactViewHolder.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'java/com/android/dialer/searchfragment/cp2') 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); } } -- cgit v1.2.3