diff options
Diffstat (limited to 'src/com/android/messaging/datamodel/data/ConversationListItemData.java')
-rw-r--r-- | src/com/android/messaging/datamodel/data/ConversationListItemData.java | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/src/com/android/messaging/datamodel/data/ConversationListItemData.java b/src/com/android/messaging/datamodel/data/ConversationListItemData.java index 77da49e..f627a09 100644 --- a/src/com/android/messaging/datamodel/data/ConversationListItemData.java +++ b/src/com/android/messaging/datamodel/data/ConversationListItemData.java @@ -67,6 +67,7 @@ public class ConversationListItemData { private String mDraftSubject; private String mSnippetSenderFirstName; private String mSnippetSenderDisplayDestination; + private boolean mIsEnterprise; public ConversationListItemData() { } @@ -118,6 +119,7 @@ public class ConversationListItemData { mSnippetSenderFirstName = cursor.getString(INDEX_SNIPPET_SENDER_FIRST_NAME); mSnippetSenderDisplayDestination = cursor.getString(INDEX_SNIPPET_SENDER_DISPLAY_DESTINATION); + mIsEnterprise = cursor.getInt(INDEX_IS_ENTERPRISE) == 1; } public String getConversationId() { @@ -157,20 +159,19 @@ public class ConversationListItemData { } /** - * @see DatabaseHelper.ConversationColumns#PARTICIPANT_CONTACT_ID - * @return the contact id of the participant if it is a 1:1 conversation, -1 for group. - */ + * @see ConversationColumns#PARTICIPANT_CONTACT_ID + * @return the contact id of the participant if it is a 1:1 conversation, -1 for group. + */ public long getParticipantContactId() { return mParticipantContactId; } /** - * TODO: support group conversation. - * @see android.provider.ContactsContract#isEnterpriseContactId(long) - * @return is the participant an enterprise contact. False if it is a group conversation. + * @see ConversationColumns#IS_ENTERPRISE + * @return whether the conversation is enterprise. */ - public boolean isParticipantEnterpriseContact() { - return ContactUtil.isEnterpriseContactId(getParticipantContactId()); + public boolean isEnterprise() { + return mIsEnterprise; } public String getParticipantLookupKey() { @@ -345,7 +346,9 @@ public class ConversationListItemData { + DatabaseHelper.PARTICIPANTS_TABLE + '.' + ParticipantColumns.FIRST_NAME + " as " + ConversationListViewColumns.SNIPPET_SENDER_FIRST_NAME + ", " + DatabaseHelper.PARTICIPANTS_TABLE + '.' + ParticipantColumns.DISPLAY_DESTINATION - + " as " + ConversationListViewColumns.SNIPPET_SENDER_DISPLAY_DESTINATION; + + " as " + ConversationListViewColumns.SNIPPET_SENDER_DISPLAY_DESTINATION + ", " + + DatabaseHelper.CONVERSATIONS_TABLE + '.' + ConversationColumns.IS_ENTERPRISE + + " as " + ConversationListViewColumns.IS_ENTERPRISE; private static final String JOIN_PARTICIPANTS = " LEFT JOIN " + DatabaseHelper.PARTICIPANTS_TABLE + " ON (" @@ -404,6 +407,7 @@ public class ConversationListItemData { static final String SNIPPET_SENDER_FIRST_NAME = "snippet_sender_first_name"; static final String SNIPPET_SENDER_DISPLAY_DESTINATION = "snippet_sender_display_destination"; + static final String IS_ENTERPRISE = ConversationColumns.IS_ENTERPRISE; } public static final String[] PROJECTION = { @@ -436,6 +440,7 @@ public class ConversationListItemData { ConversationListViewColumns.MESSAGE_RAW_TELEPHONY_STATUS, ConversationListViewColumns.SNIPPET_SENDER_FIRST_NAME, ConversationListViewColumns.SNIPPET_SENDER_DISPLAY_DESTINATION, + ConversationListViewColumns.IS_ENTERPRISE, }; private static final int INDEX_ID = 0; @@ -467,9 +472,20 @@ public class ConversationListItemData { private static final int INDEX_MESSAGE_RAW_TELEPHONY_STATUS = 26; private static final int INDEX_SNIPPET_SENDER_FIRST_NAME = 27; private static final int INDEX_SNIPPET_SENDER_DISPLAY_DESTINATION = 28; + private static final int INDEX_IS_ENTERPRISE = 29; private static final String DIVIDER_TEXT = ", "; + public static boolean hasAnyEnterpriseContact( + final List<ParticipantData> participants) { + for (final ParticipantData participant : participants) { + if (ContactUtil.isEnterpriseContactId(participant.getContactId())) { + return true; + } + } + return false; + } + /** * Get a conversation from the local DB based on the conversation id. * |