diff options
author | Tony Mak <tonymak@google.com> | 2016-05-16 15:43:55 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2016-05-16 15:43:55 +0000 |
commit | 722c058dcc5109d02af494063db16b17a628b612 (patch) | |
tree | 58abba437855d6abd25a2317e902d74fed68479a | |
parent | 9cd2bdf010086e5b2bd1f4a4f5edaac77da1e101 (diff) | |
parent | c4073ff4ce1a342daad01a99d3fce84c54bc4776 (diff) | |
download | android_packages_apps_Messaging-722c058dcc5109d02af494063db16b17a628b612.tar.gz android_packages_apps_Messaging-722c058dcc5109d02af494063db16b17a628b612.tar.bz2 android_packages_apps_Messaging-722c058dcc5109d02af494063db16b17a628b612.zip |
Add badge icon for work contact in search result
am: c4073ff4ce
* commit 'c4073ff4ce1a342daad01a99d3fce84c54bc4776':
Add badge icon for work contact in search result
Change-Id: I8a9556c786697c69af468c62a7d5a658ba87100d
-rw-r--r-- | res/drawable-hdpi/ic_work_profile.png | bin | 0 -> 158 bytes | |||
-rw-r--r-- | res/drawable-mdpi/ic_work_profile.png | bin | 0 -> 160 bytes | |||
-rw-r--r-- | res/drawable-xhdpi/ic_work_profile.png | bin | 0 -> 223 bytes | |||
-rw-r--r-- | res/drawable-xxhdpi/ic_work_profile.png | bin | 0 -> 214 bytes | |||
-rw-r--r-- | res/drawable-xxxhdpi/ic_work_profile.png | bin | 0 -> 343 bytes | |||
-rw-r--r-- | res/layout/contact_list_item_view.xml | 33 | ||||
-rw-r--r-- | src/com/android/messaging/datamodel/data/ContactListItemData.java | 16 | ||||
-rw-r--r-- | src/com/android/messaging/ui/contact/ContactDropdownLayouter.java | 4 | ||||
-rw-r--r-- | src/com/android/messaging/ui/contact/ContactListItemView.java | 13 |
9 files changed, 52 insertions, 14 deletions
diff --git a/res/drawable-hdpi/ic_work_profile.png b/res/drawable-hdpi/ic_work_profile.png Binary files differnew file mode 100644 index 0000000..5c2e457 --- /dev/null +++ b/res/drawable-hdpi/ic_work_profile.png diff --git a/res/drawable-mdpi/ic_work_profile.png b/res/drawable-mdpi/ic_work_profile.png Binary files differnew file mode 100644 index 0000000..b7ffd2b --- /dev/null +++ b/res/drawable-mdpi/ic_work_profile.png diff --git a/res/drawable-xhdpi/ic_work_profile.png b/res/drawable-xhdpi/ic_work_profile.png Binary files differnew file mode 100644 index 0000000..b47b485 --- /dev/null +++ b/res/drawable-xhdpi/ic_work_profile.png diff --git a/res/drawable-xxhdpi/ic_work_profile.png b/res/drawable-xxhdpi/ic_work_profile.png Binary files differnew file mode 100644 index 0000000..de257e7 --- /dev/null +++ b/res/drawable-xxhdpi/ic_work_profile.png diff --git a/res/drawable-xxxhdpi/ic_work_profile.png b/res/drawable-xxxhdpi/ic_work_profile.png Binary files differnew file mode 100644 index 0000000..72292bd --- /dev/null +++ b/res/drawable-xxxhdpi/ic_work_profile.png diff --git a/res/layout/contact_list_item_view.xml b/res/layout/contact_list_item_view.xml index 3015ae3..71a7370 100644 --- a/res/layout/contact_list_item_view.xml +++ b/res/layout/contact_list_item_view.xml @@ -63,15 +63,30 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center_vertical" > - <TextView - android:id="@+id/contact_name" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:paddingBottom="4dp" - android:singleLine="true" - android:maxLines="1" - android:ellipsize="end" - style="@style/ContactListItem" /> + + <LinearLayout + android:orientation="horizontal" + android:layout_width="match_parent" + android:layout_height="wrap_content"> + <TextView + android:id="@+id/contact_name" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_weight="1" + android:paddingBottom="4dp" + android:singleLine="true" + android:maxLines="1" + android:ellipsize="end" + style="@style/ContactListItem" /> + + <ImageView android:id="@+id/work_profile_icon" + android:src="@drawable/ic_work_profile" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:scaleType="center" + android:layout_gravity="center_vertical" + android:visibility="gone" /> + </LinearLayout> <LinearLayout android:orientation="horizontal" diff --git a/src/com/android/messaging/datamodel/data/ContactListItemData.java b/src/com/android/messaging/datamodel/data/ContactListItemData.java index dcc7e20..b9c7e85 100644 --- a/src/com/android/messaging/datamodel/data/ContactListItemData.java +++ b/src/com/android/messaging/datamodel/data/ContactListItemData.java @@ -46,6 +46,9 @@ public class ContactListItemData { // existing chip for which we show full contact detail for the selected contact). private boolean mSingleRecipient; + // Is the contact in managed profile. + private boolean mIsWorkContact; + /** * Bind to a contact cursor in the contact list. */ @@ -77,6 +80,8 @@ public class ContactListItemData { mRecipientEntry = ContactUtil.createRecipientEntry(displayName, DisplayNameSources.STRUCTURED_NAME, destination, destinationType, destinationLabel, contactId, lookupKey, dataId, photoThumbnailUri, isFirstLevel); + + mIsWorkContact = ContactUtil.isEnterpriseContactId(contactId); } /** @@ -84,13 +89,15 @@ public class ContactListItemData { * optional styled name & destination for showing bold search match. */ public void bind(final RecipientEntry entry, final CharSequence styledName, - final CharSequence styledDestination, final boolean singleRecipient) { + final CharSequence styledDestination, final boolean singleRecipient, + final boolean isWorkContact) { Assert.isTrue(entry.isValid()); mRecipientEntry = entry; mStyledName = styledName; mStyledDestination = styledDestination; mAlphabetHeader = null; mSingleRecipient = singleRecipient; + mIsWorkContact = isWorkContact; } public CharSequence getDisplayName() { @@ -157,4 +164,11 @@ public class ContactListItemData { public RecipientEntry getRecipientEntry() { return mRecipientEntry; } + + /** + * @return whether the contact is in managed profile. + */ + public boolean getIsWorkContact() { + return mIsWorkContact; + } } diff --git a/src/com/android/messaging/ui/contact/ContactDropdownLayouter.java b/src/com/android/messaging/ui/contact/ContactDropdownLayouter.java index 7df62de..051ebeb 100644 --- a/src/com/android/messaging/ui/contact/ContactDropdownLayouter.java +++ b/src/com/android/messaging/ui/contact/ContactDropdownLayouter.java @@ -34,6 +34,7 @@ import com.android.messaging.ui.ContactIconView; import com.android.messaging.util.Assert; import com.android.messaging.util.AvatarUriUtil; import com.android.messaging.util.ContactRecipientEntryUtils; +import com.android.messaging.util.ContactUtil; /** * An implementation for {@link DropdownChipLayouter}. Layouts the dropdown @@ -99,8 +100,9 @@ public class ContactDropdownLayouter extends DropdownChipLayouter { Assert.isTrue(itemView instanceof ContactListItemView); final ContactListItemView contactListItemView = (ContactListItemView) itemView; contactListItemView.setImageClickHandlerDisabled(true); + boolean isWorkContact = ContactUtil.isEnterpriseContactId(entry.getContactId()); contactListItemView.bind(entry, styledResults[0], styledResults[1], - mClivHostInterface, (type == AdapterType.SINGLE_RECIPIENT)); + mClivHostInterface, (type == AdapterType.SINGLE_RECIPIENT), isWorkContact); return itemView; } diff --git a/src/com/android/messaging/ui/contact/ContactListItemView.java b/src/com/android/messaging/ui/contact/ContactListItemView.java index 6904da6..b0e8957 100644 --- a/src/com/android/messaging/ui/contact/ContactListItemView.java +++ b/src/com/android/messaging/ui/contact/ContactListItemView.java @@ -53,6 +53,7 @@ public class ContactListItemView extends LinearLayout implements OnClickListener private TextView mAlphabetHeaderTextView; private ContactIconView mContactIconView; private ImageView mContactCheckmarkView; + private ImageView mWorkProfileIcon; private HostInterface mHostInterface; private boolean mShouldShowAlphabetHeader; @@ -69,6 +70,7 @@ public class ContactListItemView extends LinearLayout implements OnClickListener mAlphabetHeaderTextView = (TextView) findViewById(R.id.alphabet_header); mContactIconView = (ContactIconView) findViewById(R.id.contact_icon); mContactCheckmarkView = (ImageView) findViewById(R.id.contact_checkmark); + mWorkProfileIcon = (ImageView) findViewById(R.id.work_profile_icon); } /** @@ -100,11 +102,12 @@ public class ContactListItemView extends LinearLayout implements OnClickListener * @param isSingleRecipient whether this item is shown as the only line item in the single * recipient drop down from the chips view. If this is the case, we always show the * contact avatar even if it's not a first-level entry. + * @param isWorkContact whether the contact is in managed profile. */ public void bind(final RecipientEntry recipientEntry, final CharSequence styledName, final CharSequence styledDestination, final HostInterface hostInterface, - final boolean isSingleRecipient) { - mData.bind(recipientEntry, styledName, styledDestination, isSingleRecipient); + final boolean isSingleRecipient, final boolean isWorkContact) { + mData.bind(recipientEntry, styledName, styledDestination, isSingleRecipient, isWorkContact); mHostInterface = hostInterface; mShouldShowAlphabetHeader = false; updateViewAppearance(); @@ -152,7 +155,11 @@ public class ContactListItemView extends LinearLayout implements OnClickListener mContactDetailsTextView.setVisibility(VISIBLE); mContactDetailTypeTextView.setVisibility(VISIBLE); } - + if (mData.getIsWorkContact()) { + mWorkProfileIcon.setVisibility(VISIBLE); + } else { + mWorkProfileIcon.setVisibility(GONE); + } if (mShouldShowAlphabetHeader) { mAlphabetHeaderTextView.setVisibility(VISIBLE); mAlphabetHeaderTextView.setText(mData.getAlphabetHeader()); |