diff options
author | Evan Millar <emillar@google.com> | 2009-08-10 16:32:58 -0700 |
---|---|---|
committer | Evan Millar <emillar@google.com> | 2009-08-12 11:27:45 -0700 |
commit | 773c6341244ed0be380b8242fb6d17d53c491f56 (patch) | |
tree | 9bf048d8655a0ce9e8974175edf1491f31d9b722 /core | |
parent | b5a72b0e14aefb658695bed8d2b598b701abaf3d (diff) | |
download | frameworks_base-773c6341244ed0be380b8242fb6d17d53c491f56.zip frameworks_base-773c6341244ed0be380b8242fb6d17d53c491f56.tar.gz frameworks_base-773c6341244ed0be380b8242fb6d17d53c491f56.tar.bz2 |
Add presence to ContactsHeaderWidget
Diffstat (limited to 'core')
-rw-r--r-- | core/java/com/android/internal/widget/ContactHeaderWidget.java | 18 | ||||
-rw-r--r-- | core/res/res/layout-ja/contact_header_name.xml | 4 | ||||
-rw-r--r-- | core/res/res/layout/contact_header.xml | 7 | ||||
-rw-r--r-- | core/res/res/layout/contact_header_name.xml | 2 |
4 files changed, 26 insertions, 5 deletions
diff --git a/core/java/com/android/internal/widget/ContactHeaderWidget.java b/core/java/com/android/internal/widget/ContactHeaderWidget.java index 58fa0ba..462143f 100644 --- a/core/java/com/android/internal/widget/ContactHeaderWidget.java +++ b/core/java/com/android/internal/widget/ContactHeaderWidget.java @@ -35,6 +35,7 @@ import android.provider.ContactsContract.Contacts; import android.provider.ContactsContract.Data; import android.provider.ContactsContract.Intents; import android.provider.ContactsContract.PhoneLookup; +import android.provider.ContactsContract.Presence; import android.provider.ContactsContract.RawContacts; import android.provider.ContactsContract.CommonDataKinds.Photo; import android.provider.SocialContract.Activities; @@ -61,12 +62,13 @@ public class ContactHeaderWidget extends FrameLayout implements View.OnClickList private TextView mPhoneticNameView; private CheckBox mStarredView; private ImageView mPhotoView; + private ImageView mPresenceView; private TextView mStatusView; private int mNoPhotoResource; private QueryHandler mQueryHandler; protected long mContactId; - protected Uri mContactDataUri; + protected Uri mContactSummaryUri; protected Uri mContactUri; protected Uri mStatusUri; @@ -84,12 +86,14 @@ public class ContactHeaderWidget extends FrameLayout implements View.OnClickList Contacts.DISPLAY_NAME, Contacts.STARRED, Contacts.PHOTO_ID, + Contacts.PRESENCE_STATUS, }; protected static final int HEADER_DISPLAY_NAME_COLUMN_INDEX = 0; //TODO: We need to figure out how we're going to get the phonetic name. //static final int HEADER_PHONETIC_NAME_COLUMN_INDEX protected static final int HEADER_STARRED_COLUMN_INDEX = 1; protected static final int HEADER_PHOTO_ID_COLUMN_INDEX = 2; + protected static final int HEADER_PRESENCE_STATUS_COLUMN_INDEX = 3; //Projection used for finding the most recent social status. protected static final String[] SOCIAL_PROJECTION = new String[] { @@ -144,6 +148,8 @@ public class ContactHeaderWidget extends FrameLayout implements View.OnClickList mPhotoView.setOnClickListener(this); mPhotoView.setOnLongClickListener(this); + mPresenceView = (ImageView) findViewById(R.id.presence); + mStatusView = (TextView)findViewById(R.id.status); // Set the photo with a random "no contact" image @@ -250,7 +256,7 @@ public class ContactHeaderWidget extends FrameLayout implements View.OnClickList public void bindFromContactId(long contactId) { mContactId = contactId; mContactUri = ContentUris.withAppendedId(Contacts.CONTENT_URI, mContactId); - mContactDataUri = Uri.withAppendedPath(mContactUri, Contacts.Data.CONTENT_DIRECTORY); + mContactSummaryUri = ContentUris.withAppendedId(Contacts.CONTENT_SUMMARY_URI, mContactId); mStatusUri = ContentUris.withAppendedId( SocialContract.Activities.CONTENT_CONTACT_STATUS_URI, mContactId); redrawHeader(); @@ -317,8 +323,8 @@ public class ContactHeaderWidget extends FrameLayout implements View.OnClickList } protected void redrawHeader() { - if (mContactDataUri != null) { - mQueryHandler.startQuery(TOKEN_CONTACT_INFO, null, mContactDataUri, HEADER_PROJECTION, + if (mContactSummaryUri != null) { + mQueryHandler.startQuery(TOKEN_CONTACT_INFO, null, mContactSummaryUri, HEADER_PROJECTION, null, null, null); } @@ -352,6 +358,10 @@ public class ContactHeaderWidget extends FrameLayout implements View.OnClickList photoBitmap = loadPlaceholderPhoto(null); } mPhotoView.setImageBitmap(photoBitmap); + + //Set the presence status + int presence = c.getInt(HEADER_PRESENCE_STATUS_COLUMN_INDEX); + mPresenceView.setImageResource(Presence.getPresenceIconResourceId(presence)); } } diff --git a/core/res/res/layout-ja/contact_header_name.xml b/core/res/res/layout-ja/contact_header_name.xml index 03332b1..20df5c6 100644 --- a/core/res/res/layout-ja/contact_header_name.xml +++ b/core/res/res/layout-ja/contact_header_name.xml @@ -25,6 +25,8 @@ <TextView android:id="@+id/name" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:singleLine="true" + android:ellipsize="end" android:textAppearance="?android:attr/textAppearanceLargeInverse" android:textColor="@android:color/secondary_text_light" /> @@ -32,6 +34,8 @@ <TextView android:id="@+id/phonetic_name" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:singleLine="true" + android:ellipsize="end" android:textAppearance="?android:attr/textAppearanceSmallInverse" android:textColor="@android:color/secondary_text_light" /> diff --git a/core/res/res/layout/contact_header.xml b/core/res/res/layout/contact_header.xml index 06cd38c..73e379b 100644 --- a/core/res/res/layout/contact_header.xml +++ b/core/res/res/layout/contact_header.xml @@ -48,6 +48,13 @@ </LinearLayout> + <ImageView + android:id="@+id/presence" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:paddingLeft="3dip" + android:paddingRight="6dip"/> + <CheckBox android:id="@+id/star" android:layout_width="wrap_content" diff --git a/core/res/res/layout/contact_header_name.xml b/core/res/res/layout/contact_header_name.xml index aec943e..77751c3 100644 --- a/core/res/res/layout/contact_header_name.xml +++ b/core/res/res/layout/contact_header_name.xml @@ -21,6 +21,6 @@ android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceLargeInverse" android:textColor="@android:color/secondary_text_light" - android:maxLines="2" + android:singleLine="true" android:ellipsize="end" /> |