diff options
author | Mindy Pereira <mindyp@google.com> | 2011-06-07 16:39:24 -0700 |
---|---|---|
committer | Mindy Pereira <mindyp@google.com> | 2011-06-07 18:21:56 -0700 |
commit | 90081ee88c7eb216ea22f426aa6856e310a867e1 (patch) | |
tree | b467aeb85fe6cca735f0120aead6878f2880aacd /chips/src/com/android/ex/chips/BaseRecipientAdapter.java | |
parent | fcdaf46366afd32e8b35406216dbb3c6961793aa (diff) | |
download | android_frameworks_ex-90081ee88c7eb216ea22f426aa6856e310a867e1.tar.gz android_frameworks_ex-90081ee88c7eb216ea22f426aa6856e310a867e1.tar.bz2 android_frameworks_ex-90081ee88c7eb216ea22f426aa6856e310a867e1.zip |
Make sure even second level addresses have a photo uri.
When a second level item is chosen, we still want to show
the associated contact photo. We need to set the uri but can get the
photo on the fly later.
Change-Id: Idc9e02452ad5e1d6291776a94a6f3c3c6ada14b4
Diffstat (limited to 'chips/src/com/android/ex/chips/BaseRecipientAdapter.java')
-rw-r--r-- | chips/src/com/android/ex/chips/BaseRecipientAdapter.java | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/chips/src/com/android/ex/chips/BaseRecipientAdapter.java b/chips/src/com/android/ex/chips/BaseRecipientAdapter.java index cc254df..811c120 100644 --- a/chips/src/com/android/ex/chips/BaseRecipientAdapter.java +++ b/chips/src/com/android/ex/chips/BaseRecipientAdapter.java @@ -520,7 +520,7 @@ public abstract class BaseRecipientAdapter extends BaseAdapter implements Filter // We already have a section for the person. final List<RecipientEntry> entryList = mEntryMap.get(contactId); entryList.add(RecipientEntry.constructSecondLevelEntry( - displayName, destination, contactId, dataId)); + displayName, destination, contactId, dataId, thumbnailUriString)); } else { final List<RecipientEntry> entryList = new ArrayList<RecipientEntry>(); entryList.add(RecipientEntry.constructTopLevelEntry( @@ -621,6 +621,27 @@ public abstract class BaseRecipientAdapter extends BaseAdapter implements Filter }); } + protected void fetchPhoto(final RecipientEntry entry, final Uri photoThumbnailUri) { + byte[] photoBytes = mPhotoCacheMap.get(photoThumbnailUri); + if (photoBytes != null) { + entry.setPhotoBytes(photoBytes); + return; + } + final Cursor photoCursor = mContentResolver.query(photoThumbnailUri, PhotoQuery.PROJECTION, + null, null, null); + if (photoCursor != null) { + try { + if (photoCursor.moveToFirst()) { + photoBytes = photoCursor.getBlob(PhotoQuery.PHOTO); + entry.setPhotoBytes(photoBytes); + mPhotoCacheMap.put(photoThumbnailUri, photoBytes); + } + } finally { + photoCursor.close(); + } + } + } + private Cursor doQuery(CharSequence constraint, int limit, Long directoryId) { final Cursor cursor; if (mQueryType == QUERY_TYPE_EMAIL) { |