Adds photos to a-z list.
The implementation is meant to keep scrolling the list as smooth as
possible. Photo loading is only done once the list stops scrolling, at
which point, all visible photos are loaded and stuck in a cache.
diff --git a/src/com/android/contacts/ViewContactActivity.java b/src/com/android/contacts/ViewContactActivity.java
index 6414748..46cd26b 100644
--- a/src/com/android/contacts/ViewContactActivity.java
+++ b/src/com/android/contacts/ViewContactActivity.java
@@ -18,6 +18,7 @@
import static com.android.contacts.ContactEntryAdapter.AGGREGATE_PROJECTION;
import static com.android.contacts.ContactEntryAdapter.AGGREGATE_STARRED_COLUMN;
+import static com.android.contacts.ContactEntryAdapter.AGGREGATE_PHOTO_ID;
import static com.android.contacts.ContactEntryAdapter.DATA_1_COLUMN;
import static com.android.contacts.ContactEntryAdapter.DATA_2_COLUMN;
import static com.android.contacts.ContactEntryAdapter.DATA_3_COLUMN;
@@ -287,6 +288,15 @@
// Set the star
mStarView.setChecked(mCursor.getInt(AGGREGATE_STARRED_COLUMN) == 1 ? true : false);
+ //Set the photo
+ int photoId = mCursor.getInt(AGGREGATE_PHOTO_ID);
+ Bitmap photoBitmap = ContactsUtils.loadContactPhoto(
+ this, photoId, null);
+ if (photoBitmap == null) {
+ photoBitmap = ContactsUtils.loadPlaceholderPhoto(mNoPhotoResource, this, null);
+ }
+ mPhotoView.setImageBitmap(photoBitmap);
+
// Build up the contact entries
buildEntries(mCursor);
@@ -871,9 +881,6 @@
}
mOtherEntries.add(entry);
- // Load the photo
- } else if (mimetype.equals(CommonDataKinds.Photo.CONTENT_ITEM_TYPE)) {
- photoBitmap = ContactsUtils.loadContactPhoto(aggCursor, DATA_1_COLUMN, null);
}
@@ -921,11 +928,6 @@
// }
}
-
- if (photoBitmap == null) {
- photoBitmap = ContactsUtils.loadPlaceholderPhoto(mNoPhotoResource, this, null);
- }
- mPhotoView.setImageBitmap(photoBitmap);
}
}