diff options
author | Andrew Lee <anwlee@google.com> | 2015-10-06 16:12:58 -0700 |
---|---|---|
committer | Andrew Lee <anwlee@google.com> | 2015-10-07 12:02:28 -0700 |
commit | e854a00c98aa05ab114216e9802b543479d308a4 (patch) | |
tree | 690af60dcfae21032793c46e6ed7e41895889c0c /src/com/android/dialer/calllog/CallLogListItemViewHolder.java | |
parent | 9fd3d0a81031baa83d1a141837c76afba79f3a02 (diff) |
Consolidate setPhoto logic.
This makes the ViewHolder self-capable of updating/setting its
photo, so if we want to update the photo in the future (either
in teh scope of a listener, or in the ViewHolder itself), we
don't need to worry about configuring and passing around a
bunch of commands.
Bug: 23943480
Change-Id: I17653014dd81fcb9ae7a667539e40a9310a72d36
Diffstat (limited to 'src/com/android/dialer/calllog/CallLogListItemViewHolder.java')
-rw-r--r-- | src/com/android/dialer/calllog/CallLogListItemViewHolder.java | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/com/android/dialer/calllog/CallLogListItemViewHolder.java b/src/com/android/dialer/calllog/CallLogListItemViewHolder.java index 30aaee087..5b47d4477 100644 --- a/src/com/android/dialer/calllog/CallLogListItemViewHolder.java +++ b/src/com/android/dialer/calllog/CallLogListItemViewHolder.java @@ -527,11 +527,11 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder view.setSingleLine(!isExpanded); } - public void setPhoto(long photoId, Uri photoUri, Uri contactUri, String displayName, - boolean isVoicemail, boolean isBusiness) { - quickContactView.assignContactUri(contactUri); + public void updatePhoto() { + quickContactView.assignContactUri(info.lookupUri); quickContactView.setOverlay(null); + final boolean isVoicemail = mTelecomCallLogCache.isVoicemailNumber(accountHandle, number); int contactType = ContactPhotoManager.TYPE_DEFAULT; if (isVoicemail) { contactType = ContactPhotoManager.TYPE_VOICEMAIL; @@ -539,19 +539,17 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder contactType = ContactPhotoManager.TYPE_BUSINESS; } - String lookupKey = null; - if (contactUri != null) { - lookupKey = UriUtils.getLookupKeyFromUri(contactUri); - } - - DefaultImageRequest request = new DefaultImageRequest( + final String lookupKey = info.lookupUri != null + ? UriUtils.getLookupKeyFromUri(info.lookupUri) : null; + final String displayName = TextUtils.isEmpty(info.name) ? displayNumber : info.name; + final DefaultImageRequest request = new DefaultImageRequest( displayName, lookupKey, contactType, true /* isCircular */); - if (photoId == 0 && photoUri != null) { - ContactPhotoManager.getInstance(mContext).loadPhoto(quickContactView, photoUri, + if (info.photoId == 0 && info.photoUri != null) { + ContactPhotoManager.getInstance(mContext).loadPhoto(quickContactView, info.photoUri, mPhotoSize, false /* darkTheme */, true /* isCircular */, request); } else { - ContactPhotoManager.getInstance(mContext).loadThumbnail(quickContactView, photoId, + ContactPhotoManager.getInstance(mContext).loadThumbnail(quickContactView, info.photoId, false /* darkTheme */, true /* isCircular */, request); } } |