Loading src/com/android/contacts/ContactTileLoaderFactory.java +0 −1 Original line number Diff line number Diff line Loading @@ -23,7 +23,6 @@ import android.net.Uri; import android.provider.ContactsContract; import android.provider.ContactsContract.CommonDataKinds.Phone; import android.provider.ContactsContract.Contacts; import android.provider.ContactsContract.Contacts.Data; /** * Used to create {@link CursorLoader}s to load different groups of {@link ContactTileView}s Loading src/com/android/contacts/list/ContactListAdapter.java +30 −34 Original line number Diff line number Diff line Loading @@ -45,14 +45,13 @@ public abstract class ContactListAdapter extends ContactEntryListAdapter { Contacts.SORT_KEY_PRIMARY, // 3 Contacts.STARRED, // 4 Contacts.CONTACT_PRESENCE, // 5 Contacts.CONTACT_CHAT_CAPABILITY, // 6 Contacts.CONTACT_STATUS, // 7 Contacts.PHOTO_ID, // 8 Contacts.PHOTO_THUMBNAIL_URI, // 9 Contacts.LOOKUP_KEY, // 10 Contacts.PHONETIC_NAME, // 11 Contacts.HAS_PHONE_NUMBER, // 12 Contacts.IS_USER_PROFILE, // 13 Contacts.CONTACT_STATUS, // 6 Contacts.PHOTO_ID, // 7 Contacts.PHOTO_THUMBNAIL_URI, // 8 Contacts.LOOKUP_KEY, // 9 Contacts.PHONETIC_NAME, // 10 Contacts.HAS_PHONE_NUMBER, // 11 Contacts.IS_USER_PROFILE, // 12 }; protected static final String[] PROJECTION_DATA = new String[] { Loading @@ -62,13 +61,12 @@ public abstract class ContactListAdapter extends ContactEntryListAdapter { Data.SORT_KEY_PRIMARY, // 3 Data.STARRED, // 4 Data.CONTACT_PRESENCE, // 5 Data.CONTACT_CHAT_CAPABILITY, // 6 Data.CONTACT_STATUS, // 7 Data.PHOTO_ID, // 8 Data.PHOTO_THUMBNAIL_URI, // 9 Data.LOOKUP_KEY, // 10 Data.PHONETIC_NAME, // 11 Data.HAS_PHONE_NUMBER, // 12 Data.CONTACT_STATUS, // 6 Data.PHOTO_ID, // 7 Data.PHOTO_THUMBNAIL_URI, // 8 Data.LOOKUP_KEY, // 9 Data.PHONETIC_NAME, // 10 Data.HAS_PHONE_NUMBER, // 11 }; protected static final String[] FILTER_PROJECTION = new String[] { Loading @@ -78,15 +76,14 @@ public abstract class ContactListAdapter extends ContactEntryListAdapter { Contacts.SORT_KEY_PRIMARY, // 3 Contacts.STARRED, // 4 Contacts.CONTACT_PRESENCE, // 5 Contacts.CONTACT_CHAT_CAPABILITY, // 6 Contacts.CONTACT_STATUS, // 7 Contacts.PHOTO_ID, // 8 Contacts.PHOTO_THUMBNAIL_URI, // 9 Contacts.LOOKUP_KEY, // 10 Contacts.PHONETIC_NAME, // 11 Contacts.HAS_PHONE_NUMBER, // 12 Contacts.IS_USER_PROFILE, // 13 SearchSnippetColumns.SNIPPET, // 14 Contacts.CONTACT_STATUS, // 6 Contacts.PHOTO_ID, // 7 Contacts.PHOTO_THUMBNAIL_URI, // 8 Contacts.LOOKUP_KEY, // 9 Contacts.PHONETIC_NAME, // 10 Contacts.HAS_PHONE_NUMBER, // 11 Contacts.IS_USER_PROFILE, // 12 SearchSnippetColumns.SNIPPET, // 13 }; protected static final int CONTACT_ID_COLUMN_INDEX = 0; Loading @@ -95,15 +92,14 @@ public abstract class ContactListAdapter extends ContactEntryListAdapter { protected static final int CONTACT_SORT_KEY_PRIMARY_COLUMN_INDEX = 3; protected static final int CONTACT_STARRED_COLUMN_INDEX = 4; protected static final int CONTACT_PRESENCE_STATUS_COLUMN_INDEX = 5; protected static final int CONTACT_CHAT_CAPABILITY_COLUMN_INDEX = 6; protected static final int CONTACT_CONTACT_STATUS_COLUMN_INDEX = 7; protected static final int CONTACT_PHOTO_ID_COLUMN_INDEX = 8; protected static final int CONTACT_PHOTO_URI_COLUMN_INDEX = 9; protected static final int CONTACT_LOOKUP_KEY_COLUMN_INDEX = 10; protected static final int CONTACT_PHONETIC_NAME_COLUMN_INDEX = 11; protected static final int CONTACT_HAS_PHONE_COLUMN_INDEX = 12; protected static final int CONTACT_IS_USER_PROFILE = 13; protected static final int CONTACT_SNIPPET_COLUMN_INDEX = 14; protected static final int CONTACT_CONTACT_STATUS_COLUMN_INDEX = 6; protected static final int CONTACT_PHOTO_ID_COLUMN_INDEX = 7; protected static final int CONTACT_PHOTO_URI_COLUMN_INDEX = 8; protected static final int CONTACT_LOOKUP_KEY_COLUMN_INDEX = 9; protected static final int CONTACT_PHONETIC_NAME_COLUMN_INDEX = 10; protected static final int CONTACT_HAS_PHONE_COLUMN_INDEX = 11; protected static final int CONTACT_IS_USER_PROFILE = 12; protected static final int CONTACT_SNIPPET_COLUMN_INDEX = 13; private CharSequence mUnknownNameText; private int mDisplayNameColumnIndex; Loading Loading @@ -281,7 +277,7 @@ public abstract class ContactListAdapter extends ContactEntryListAdapter { protected void bindPresenceAndStatusMessage(final ContactListItemView view, Cursor cursor) { view.showPresenceAndStatusMessage(cursor, CONTACT_PRESENCE_STATUS_COLUMN_INDEX, CONTACT_CHAT_CAPABILITY_COLUMN_INDEX, CONTACT_CONTACT_STATUS_COLUMN_INDEX); CONTACT_CONTACT_STATUS_COLUMN_INDEX); } protected void bindSearchSnippet(final ContactListItemView view, Cursor cursor) { Loading src/com/android/contacts/list/ContactListItemView.java +2 −7 Original line number Diff line number Diff line Loading @@ -1050,17 +1050,12 @@ public class ContactListItemView extends ViewGroup * Sets the proper icon (star or presence or nothing) and/or status message. */ public void showPresenceAndStatusMessage(Cursor cursor, int presenceColumnIndex, int capabilityColumnIndex, int contactStatusColumnIndex) { int contactStatusColumnIndex) { Drawable icon = null; int presence = 0; int chatCapability = 0; if (!cursor.isNull(presenceColumnIndex)) { presence = cursor.getInt(presenceColumnIndex); if (capabilityColumnIndex != 0 && !cursor.isNull(presenceColumnIndex)) { chatCapability = cursor.getInt(capabilityColumnIndex); } icon = ContactPresenceIconUtil.getChatCapabilityIcon( getContext(), presence, chatCapability); icon = ContactPresenceIconUtil.getPresenceIcon(getContext(), presence); } setPresence(icon); Loading src/com/android/contacts/list/ContactTileAdapter.java +24 −4 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.contacts.list; import com.android.contacts.ContactPhotoManager; import com.android.contacts.ContactPresenceIconUtil; import com.android.contacts.ContactStatusUtil; import com.android.contacts.ContactTileLoaderFactory; import com.android.contacts.GroupMemberLoader; import com.android.contacts.R; Loading @@ -25,6 +27,7 @@ import android.content.ContentUris; import android.content.Context; import android.content.res.Resources; import android.database.Cursor; import android.graphics.drawable.Drawable; import android.net.Uri; import android.provider.ContactsContract.CommonDataKinds.Phone; import android.provider.ContactsContract.Contacts; Loading Loading @@ -238,8 +241,8 @@ public class ContactTileAdapter extends BaseAdapter { contact.photoUri = (photoUri != null ? Uri.parse(photoUri) : null); contact.lookupKey = ContentUris.withAppendedId( Uri.withAppendedPath(Contacts.CONTENT_LOOKUP_URI, lookupKey), id); contact.presence = cursor.isNull(mPresenceIndex) ? null : cursor.getInt(mPresenceIndex); // Set phone number and label if (mDisplayType == DisplayType.STREQUENT_PHONE_ONLY) { int phoneNumberType = cursor.getInt(mPhoneNumberTypeIndex); String phoneNumberCustomLabel = cursor.getString(mPhoneNumberLabelIndex); Loading @@ -247,8 +250,25 @@ public class ContactTileAdapter extends BaseAdapter { phoneNumberCustomLabel); contact.phoneNumber = cursor.getString(mPhoneNumberIndex); } else { contact.status = cursor.getString(mStatusIndex); contact.presence = cursor.isNull(mPresenceIndex) ? null : cursor.getInt(mPresenceIndex); // Set presence icon and status message Drawable icon = null; int presence = 0; if (!cursor.isNull(mPresenceIndex)) { presence = cursor.getInt(mPresenceIndex); icon = ContactPresenceIconUtil.getPresenceIcon(mContext, presence); } contact.presenceIcon = icon; String statusMessage = null; if (mStatusIndex != 0 && !cursor.isNull(mStatusIndex)) { statusMessage = cursor.getString(mStatusIndex); } // If there is no status message from the contact, but there was a presence value, // then use the default status message string if (statusMessage == null && presence != 0) { statusMessage = ContactStatusUtil.getStatusString(mContext, presence); } contact.status = statusMessage; } return contact; Loading Loading @@ -530,7 +550,7 @@ public class ContactTileAdapter extends BaseAdapter { public String phoneNumber; public Uri photoUri; public Uri lookupKey; public Integer presence; public Drawable presenceIcon; } private static class ViewTypes { Loading src/com/android/contacts/list/ContactTileView.java +4 −14 Original line number Diff line number Diff line Loading @@ -96,22 +96,12 @@ public class ContactTileView extends FrameLayout { mLookupUri = entry.lookupKey; if (mStatus != null) { String statusText; if (entry.presence == null) { if (entry.status == null) { mStatus.setVisibility(View.GONE); } else { statusText = (entry.status != null ? entry.status : ContactStatusUtil.getStatusString(mContext, entry.presence)); mStatus.setText(statusText); int presenceDrawableResId = (entry.presence == null ? 0 : StatusUpdates.getPresenceIconResourceId(entry.presence)); if (presenceDrawableResId != 0) { Log.i(TAG, "iconId = " + presenceDrawableResId); mStatus.setCompoundDrawablesWithIntrinsicBounds( getResources().getDrawable(presenceDrawableResId), mStatus.setText(entry.status); mStatus.setCompoundDrawablesWithIntrinsicBounds(entry.presenceIcon, null, null, null); } mStatus.setVisibility(View.VISIBLE); } } Loading Loading
src/com/android/contacts/ContactTileLoaderFactory.java +0 −1 Original line number Diff line number Diff line Loading @@ -23,7 +23,6 @@ import android.net.Uri; import android.provider.ContactsContract; import android.provider.ContactsContract.CommonDataKinds.Phone; import android.provider.ContactsContract.Contacts; import android.provider.ContactsContract.Contacts.Data; /** * Used to create {@link CursorLoader}s to load different groups of {@link ContactTileView}s Loading
src/com/android/contacts/list/ContactListAdapter.java +30 −34 Original line number Diff line number Diff line Loading @@ -45,14 +45,13 @@ public abstract class ContactListAdapter extends ContactEntryListAdapter { Contacts.SORT_KEY_PRIMARY, // 3 Contacts.STARRED, // 4 Contacts.CONTACT_PRESENCE, // 5 Contacts.CONTACT_CHAT_CAPABILITY, // 6 Contacts.CONTACT_STATUS, // 7 Contacts.PHOTO_ID, // 8 Contacts.PHOTO_THUMBNAIL_URI, // 9 Contacts.LOOKUP_KEY, // 10 Contacts.PHONETIC_NAME, // 11 Contacts.HAS_PHONE_NUMBER, // 12 Contacts.IS_USER_PROFILE, // 13 Contacts.CONTACT_STATUS, // 6 Contacts.PHOTO_ID, // 7 Contacts.PHOTO_THUMBNAIL_URI, // 8 Contacts.LOOKUP_KEY, // 9 Contacts.PHONETIC_NAME, // 10 Contacts.HAS_PHONE_NUMBER, // 11 Contacts.IS_USER_PROFILE, // 12 }; protected static final String[] PROJECTION_DATA = new String[] { Loading @@ -62,13 +61,12 @@ public abstract class ContactListAdapter extends ContactEntryListAdapter { Data.SORT_KEY_PRIMARY, // 3 Data.STARRED, // 4 Data.CONTACT_PRESENCE, // 5 Data.CONTACT_CHAT_CAPABILITY, // 6 Data.CONTACT_STATUS, // 7 Data.PHOTO_ID, // 8 Data.PHOTO_THUMBNAIL_URI, // 9 Data.LOOKUP_KEY, // 10 Data.PHONETIC_NAME, // 11 Data.HAS_PHONE_NUMBER, // 12 Data.CONTACT_STATUS, // 6 Data.PHOTO_ID, // 7 Data.PHOTO_THUMBNAIL_URI, // 8 Data.LOOKUP_KEY, // 9 Data.PHONETIC_NAME, // 10 Data.HAS_PHONE_NUMBER, // 11 }; protected static final String[] FILTER_PROJECTION = new String[] { Loading @@ -78,15 +76,14 @@ public abstract class ContactListAdapter extends ContactEntryListAdapter { Contacts.SORT_KEY_PRIMARY, // 3 Contacts.STARRED, // 4 Contacts.CONTACT_PRESENCE, // 5 Contacts.CONTACT_CHAT_CAPABILITY, // 6 Contacts.CONTACT_STATUS, // 7 Contacts.PHOTO_ID, // 8 Contacts.PHOTO_THUMBNAIL_URI, // 9 Contacts.LOOKUP_KEY, // 10 Contacts.PHONETIC_NAME, // 11 Contacts.HAS_PHONE_NUMBER, // 12 Contacts.IS_USER_PROFILE, // 13 SearchSnippetColumns.SNIPPET, // 14 Contacts.CONTACT_STATUS, // 6 Contacts.PHOTO_ID, // 7 Contacts.PHOTO_THUMBNAIL_URI, // 8 Contacts.LOOKUP_KEY, // 9 Contacts.PHONETIC_NAME, // 10 Contacts.HAS_PHONE_NUMBER, // 11 Contacts.IS_USER_PROFILE, // 12 SearchSnippetColumns.SNIPPET, // 13 }; protected static final int CONTACT_ID_COLUMN_INDEX = 0; Loading @@ -95,15 +92,14 @@ public abstract class ContactListAdapter extends ContactEntryListAdapter { protected static final int CONTACT_SORT_KEY_PRIMARY_COLUMN_INDEX = 3; protected static final int CONTACT_STARRED_COLUMN_INDEX = 4; protected static final int CONTACT_PRESENCE_STATUS_COLUMN_INDEX = 5; protected static final int CONTACT_CHAT_CAPABILITY_COLUMN_INDEX = 6; protected static final int CONTACT_CONTACT_STATUS_COLUMN_INDEX = 7; protected static final int CONTACT_PHOTO_ID_COLUMN_INDEX = 8; protected static final int CONTACT_PHOTO_URI_COLUMN_INDEX = 9; protected static final int CONTACT_LOOKUP_KEY_COLUMN_INDEX = 10; protected static final int CONTACT_PHONETIC_NAME_COLUMN_INDEX = 11; protected static final int CONTACT_HAS_PHONE_COLUMN_INDEX = 12; protected static final int CONTACT_IS_USER_PROFILE = 13; protected static final int CONTACT_SNIPPET_COLUMN_INDEX = 14; protected static final int CONTACT_CONTACT_STATUS_COLUMN_INDEX = 6; protected static final int CONTACT_PHOTO_ID_COLUMN_INDEX = 7; protected static final int CONTACT_PHOTO_URI_COLUMN_INDEX = 8; protected static final int CONTACT_LOOKUP_KEY_COLUMN_INDEX = 9; protected static final int CONTACT_PHONETIC_NAME_COLUMN_INDEX = 10; protected static final int CONTACT_HAS_PHONE_COLUMN_INDEX = 11; protected static final int CONTACT_IS_USER_PROFILE = 12; protected static final int CONTACT_SNIPPET_COLUMN_INDEX = 13; private CharSequence mUnknownNameText; private int mDisplayNameColumnIndex; Loading Loading @@ -281,7 +277,7 @@ public abstract class ContactListAdapter extends ContactEntryListAdapter { protected void bindPresenceAndStatusMessage(final ContactListItemView view, Cursor cursor) { view.showPresenceAndStatusMessage(cursor, CONTACT_PRESENCE_STATUS_COLUMN_INDEX, CONTACT_CHAT_CAPABILITY_COLUMN_INDEX, CONTACT_CONTACT_STATUS_COLUMN_INDEX); CONTACT_CONTACT_STATUS_COLUMN_INDEX); } protected void bindSearchSnippet(final ContactListItemView view, Cursor cursor) { Loading
src/com/android/contacts/list/ContactListItemView.java +2 −7 Original line number Diff line number Diff line Loading @@ -1050,17 +1050,12 @@ public class ContactListItemView extends ViewGroup * Sets the proper icon (star or presence or nothing) and/or status message. */ public void showPresenceAndStatusMessage(Cursor cursor, int presenceColumnIndex, int capabilityColumnIndex, int contactStatusColumnIndex) { int contactStatusColumnIndex) { Drawable icon = null; int presence = 0; int chatCapability = 0; if (!cursor.isNull(presenceColumnIndex)) { presence = cursor.getInt(presenceColumnIndex); if (capabilityColumnIndex != 0 && !cursor.isNull(presenceColumnIndex)) { chatCapability = cursor.getInt(capabilityColumnIndex); } icon = ContactPresenceIconUtil.getChatCapabilityIcon( getContext(), presence, chatCapability); icon = ContactPresenceIconUtil.getPresenceIcon(getContext(), presence); } setPresence(icon); Loading
src/com/android/contacts/list/ContactTileAdapter.java +24 −4 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.contacts.list; import com.android.contacts.ContactPhotoManager; import com.android.contacts.ContactPresenceIconUtil; import com.android.contacts.ContactStatusUtil; import com.android.contacts.ContactTileLoaderFactory; import com.android.contacts.GroupMemberLoader; import com.android.contacts.R; Loading @@ -25,6 +27,7 @@ import android.content.ContentUris; import android.content.Context; import android.content.res.Resources; import android.database.Cursor; import android.graphics.drawable.Drawable; import android.net.Uri; import android.provider.ContactsContract.CommonDataKinds.Phone; import android.provider.ContactsContract.Contacts; Loading Loading @@ -238,8 +241,8 @@ public class ContactTileAdapter extends BaseAdapter { contact.photoUri = (photoUri != null ? Uri.parse(photoUri) : null); contact.lookupKey = ContentUris.withAppendedId( Uri.withAppendedPath(Contacts.CONTENT_LOOKUP_URI, lookupKey), id); contact.presence = cursor.isNull(mPresenceIndex) ? null : cursor.getInt(mPresenceIndex); // Set phone number and label if (mDisplayType == DisplayType.STREQUENT_PHONE_ONLY) { int phoneNumberType = cursor.getInt(mPhoneNumberTypeIndex); String phoneNumberCustomLabel = cursor.getString(mPhoneNumberLabelIndex); Loading @@ -247,8 +250,25 @@ public class ContactTileAdapter extends BaseAdapter { phoneNumberCustomLabel); contact.phoneNumber = cursor.getString(mPhoneNumberIndex); } else { contact.status = cursor.getString(mStatusIndex); contact.presence = cursor.isNull(mPresenceIndex) ? null : cursor.getInt(mPresenceIndex); // Set presence icon and status message Drawable icon = null; int presence = 0; if (!cursor.isNull(mPresenceIndex)) { presence = cursor.getInt(mPresenceIndex); icon = ContactPresenceIconUtil.getPresenceIcon(mContext, presence); } contact.presenceIcon = icon; String statusMessage = null; if (mStatusIndex != 0 && !cursor.isNull(mStatusIndex)) { statusMessage = cursor.getString(mStatusIndex); } // If there is no status message from the contact, but there was a presence value, // then use the default status message string if (statusMessage == null && presence != 0) { statusMessage = ContactStatusUtil.getStatusString(mContext, presence); } contact.status = statusMessage; } return contact; Loading Loading @@ -530,7 +550,7 @@ public class ContactTileAdapter extends BaseAdapter { public String phoneNumber; public Uri photoUri; public Uri lookupKey; public Integer presence; public Drawable presenceIcon; } private static class ViewTypes { Loading
src/com/android/contacts/list/ContactTileView.java +4 −14 Original line number Diff line number Diff line Loading @@ -96,22 +96,12 @@ public class ContactTileView extends FrameLayout { mLookupUri = entry.lookupKey; if (mStatus != null) { String statusText; if (entry.presence == null) { if (entry.status == null) { mStatus.setVisibility(View.GONE); } else { statusText = (entry.status != null ? entry.status : ContactStatusUtil.getStatusString(mContext, entry.presence)); mStatus.setText(statusText); int presenceDrawableResId = (entry.presence == null ? 0 : StatusUpdates.getPresenceIconResourceId(entry.presence)); if (presenceDrawableResId != 0) { Log.i(TAG, "iconId = " + presenceDrawableResId); mStatus.setCompoundDrawablesWithIntrinsicBounds( getResources().getDrawable(presenceDrawableResId), mStatus.setText(entry.status); mStatus.setCompoundDrawablesWithIntrinsicBounds(entry.presenceIcon, null, null, null); } mStatus.setVisibility(View.VISIBLE); } } Loading