summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTony Mak <tonymak@google.com>2016-06-28 15:44:27 +0100
committerTony Mak <tonymak@google.com>2016-06-28 15:44:27 +0100
commit2a50ffe57c45c99bbc8ab92fd07383582be9f836 (patch)
treebf493b7d999a69eaa34798d4982e585a77100b68 /src
parentd112c795ac1ce07d799f470cb8e7ec50efd3f340 (diff)
downloadpackages_apps_Messaging-2a50ffe57c45c99bbc8ab92fd07383582be9f836.tar.gz
packages_apps_Messaging-2a50ffe57c45c99bbc8ab92fd07383582be9f836.tar.bz2
packages_apps_Messaging-2a50ffe57c45c99bbc8ab92fd07383582be9f836.zip
Add badge in conversation view if the participant is a work contact
TODO: To handle conversation having more than one participants. Bug: 29065176 Change-Id: I3820454bf2b76c151dc3a13d9be270502029160d
Diffstat (limited to 'src')
-rw-r--r--src/com/android/messaging/datamodel/data/ConversationListItemData.java14
-rw-r--r--src/com/android/messaging/ui/conversationlist/ConversationListItemView.java8
2 files changed, 22 insertions, 0 deletions
diff --git a/src/com/android/messaging/datamodel/data/ConversationListItemData.java b/src/com/android/messaging/datamodel/data/ConversationListItemData.java
index b2e6e1c..77da49e 100644
--- a/src/com/android/messaging/datamodel/data/ConversationListItemData.java
+++ b/src/com/android/messaging/datamodel/data/ConversationListItemData.java
@@ -28,6 +28,7 @@ import com.android.messaging.datamodel.DatabaseHelper.ParticipantColumns;
import com.android.messaging.datamodel.DatabaseWrapper;
import com.android.messaging.datamodel.action.DeleteConversationAction;
import com.android.messaging.util.Assert;
+import com.android.messaging.util.ContactUtil;
import com.android.messaging.util.Dates;
import com.google.common.base.Joiner;
@@ -155,10 +156,23 @@ public class ConversationListItemData {
return mPreviewContentType;
}
+ /**
+ * @see DatabaseHelper.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.
+ */
+ public boolean isParticipantEnterpriseContact() {
+ return ContactUtil.isEnterpriseContactId(getParticipantContactId());
+ }
+
public String getParticipantLookupKey() {
return mParticipantLookupKey;
}
diff --git a/src/com/android/messaging/ui/conversationlist/ConversationListItemView.java b/src/com/android/messaging/ui/conversationlist/ConversationListItemView.java
index 9b8c5ff..58c4e69 100644
--- a/src/com/android/messaging/ui/conversationlist/ConversationListItemView.java
+++ b/src/com/android/messaging/ui/conversationlist/ConversationListItemView.java
@@ -118,6 +118,7 @@ public class ConversationListItemView extends FrameLayout implements OnClickList
private ViewGroup mCrossSwipeBackground;
private ViewGroup mSwipeableContent;
private TextView mConversationNameView;
+ private ImageView mWorkProfileIconView;
private TextView mSnippetTextView;
private TextView mSubjectTextView;
private TextView mTimestampTextView;
@@ -145,6 +146,7 @@ public class ConversationListItemView extends FrameLayout implements OnClickList
mConversationNameView = (TextView) findViewById(R.id.conversation_name);
mSnippetTextView = (TextView) findViewById(R.id.conversation_snippet);
mSubjectTextView = (TextView) findViewById(R.id.conversation_subject);
+ mWorkProfileIconView = (ImageView) findViewById(R.id.work_profile_icon);
mTimestampTextView = (TextView) findViewById(R.id.conversation_timestamp);
mContactIconView = (ContactIconView) findViewById(R.id.conversation_icon);
mContactCheckmarkView = (ImageView) findViewById(R.id.conversation_checkmark);
@@ -183,6 +185,11 @@ public class ConversationListItemView extends FrameLayout implements OnClickList
}
}
+ private void setWorkProfileIcon() {
+ mWorkProfileIconView.setVisibility(
+ mData.isParticipantEnterpriseContact() ? View.VISIBLE : View.GONE);
+ }
+
private void setConversationName() {
if (mData.getIsRead() || mData.getShowDraft()) {
mConversationNameView.setTextColor(mListItemReadColor);
@@ -391,6 +398,7 @@ public class ConversationListItemView extends FrameLayout implements OnClickList
setSnippet();
setConversationName();
setSubject();
+ setWorkProfileIcon();
setContentDescription(buildContentDescription(resources, mData,
mConversationNameView.getPaint()));