Merge "Don't load photo if it's id is 0. Saves one database query Bug:2546767" into froyo
This commit is contained in:
committed by
Android (Google) Code Review
commit
58c9a4bca0
@@ -269,9 +269,19 @@ public class ContactHeaderWidget extends FrameLayout implements View.OnClickList
|
|||||||
bindContactInfo(cursor);
|
bindContactInfo(cursor);
|
||||||
Uri lookupUri = Contacts.getLookupUri(cursor.getLong(ContactQuery._ID),
|
Uri lookupUri = Contacts.getLookupUri(cursor.getLong(ContactQuery._ID),
|
||||||
cursor.getString(ContactQuery.LOOKUP_KEY));
|
cursor.getString(ContactQuery.LOOKUP_KEY));
|
||||||
startPhotoQuery(cursor.getLong(ContactQuery.PHOTO_ID),
|
|
||||||
lookupUri, false /* don't reset query handler */);
|
final long photoId = cursor.getLong(ContactQuery.PHOTO_ID);
|
||||||
invalidate();
|
|
||||||
|
if (photoId == 0) {
|
||||||
|
mPhotoView.setImageBitmap(loadPlaceholderPhoto(null));
|
||||||
|
if (cookie != null && cookie instanceof Uri) {
|
||||||
|
mPhotoView.assignContactUri((Uri) cookie);
|
||||||
|
}
|
||||||
|
invalidate();
|
||||||
|
} else {
|
||||||
|
startPhotoQuery(photoId, lookupUri,
|
||||||
|
false /* don't reset query handler */);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// shouldn't really happen
|
// shouldn't really happen
|
||||||
setDisplayName(null, null);
|
setDisplayName(null, null);
|
||||||
|
|||||||
Reference in New Issue
Block a user