Mods to the ContactHeaderWidget to be able to have it display strings
as passed in by the caller. For example we may want to use this in
the case when there is no contact in a given circumstance.
diff --git a/core/java/com/android/internal/widget/ContactHeaderWidget.java b/core/java/com/android/internal/widget/ContactHeaderWidget.java
index 45bd0cf..e4aaf38 100644
--- a/core/java/com/android/internal/widget/ContactHeaderWidget.java
+++ b/core/java/com/android/internal/widget/ContactHeaderWidget.java
@@ -233,6 +233,8 @@
if (c.moveToFirst()) {
long contactId = c.getLong(EMAIL_LOOKUP_CONTACT_ID_COLUMN_INDEX);
bindFromContactId(contactId);
+ } else {
+ bindStatic(emailAddress, "");
}
} finally {
if (c != null) {
@@ -257,6 +259,8 @@
if (c.moveToFirst()) {
long contactId = c.getLong(PHONE_LOOKUP_CONTACT_ID_COLUMN_INDEX);
bindFromContactId(contactId);
+ } else {
+ bindStatic(number, "");
}
} finally {
if (c != null) {
@@ -265,6 +269,13 @@
}
}
+ public void bindStatic(String main, String secondary) {
+ mDisplayNameView.setText(main);
+ mStatusView.setText(secondary);
+ mStarredView.setVisibility(View.GONE);
+ mPhotoView.setImageBitmap(loadPlaceholderPhoto(null));
+ }
+
protected void redrawHeader() {
if (mContactDataUri != null) {
mQueryHandler.startQuery(TOKEN_CONTACT_INFO, null, mContactDataUri, HEADER_PROJECTION,