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
This commit is contained in:
BIN
res/drawable-hdpi/ic_work_profile.png
Normal file
BIN
res/drawable-hdpi/ic_work_profile.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 158 B |
BIN
res/drawable-mdpi/ic_work_profile.png
Normal file
BIN
res/drawable-mdpi/ic_work_profile.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 160 B |
BIN
res/drawable-xhdpi/ic_work_profile.png
Normal file
BIN
res/drawable-xhdpi/ic_work_profile.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 223 B |
BIN
res/drawable-xxhdpi/ic_work_profile.png
Normal file
BIN
res/drawable-xxhdpi/ic_work_profile.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 214 B |
BIN
res/drawable-xxxhdpi/ic_work_profile.png
Normal file
BIN
res/drawable-xxxhdpi/ic_work_profile.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 343 B |
@@ -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"
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user