diff options
Diffstat (limited to 'src/com/android/contacts/quickcontact/QuickContactActivity.java')
-rw-r--r-- | src/com/android/contacts/quickcontact/QuickContactActivity.java | 53 |
1 files changed, 47 insertions, 6 deletions
diff --git a/src/com/android/contacts/quickcontact/QuickContactActivity.java b/src/com/android/contacts/quickcontact/QuickContactActivity.java index 09ddf35db..9a83cf4f6 100644 --- a/src/com/android/contacts/quickcontact/QuickContactActivity.java +++ b/src/com/android/contacts/quickcontact/QuickContactActivity.java @@ -109,6 +109,7 @@ import com.android.contacts.common.Collapser; import com.android.contacts.common.ContactsUtils; import com.android.contacts.common.GroupMetaData; import com.android.contacts.common.activity.RequestPermissionsActivity; +import com.android.contacts.common.dialog.CallSubjectDialog; import com.android.contacts.common.editor.SelectAccountDialogFragment; import com.android.contacts.common.interactions.TouchPointManager; import com.android.contacts.common.lettertiles.LetterTileDrawable; @@ -142,6 +143,7 @@ import com.android.contacts.common.SimContactsConstants; import com.android.contacts.common.util.DateUtils; import com.android.contacts.common.util.MaterialColorMapUtils; import com.android.contacts.common.util.MaterialColorMapUtils.MaterialPalette; +import com.android.contacts.common.util.UriUtils; import com.android.contacts.common.util.ViewUtil; import com.android.contacts.detail.ContactDisplayUtils; import com.android.contacts.editor.ContactEditorFragment; @@ -1399,7 +1401,9 @@ public class QuickContactActivity extends ContactsActivity { /* thirdIcon = */ null, /* thirdIntent = */ null, /* thirdContentDescription = */ null, - /* iconResourceId = */ 0); + /* thirdAction = */ Entry.ACTION_NONE, + /* thirdExtras = */ null, + /* iconResourceId = */ 0); List<Entry> phoneticList = new ArrayList<>(); phoneticList.add(phoneticEntry); // Phonetic name comes after nickname. Check to see if the first entry type is nickname @@ -1475,7 +1479,10 @@ public class QuickContactActivity extends ContactsActivity { /* alternateContentDescription = */ null, /* shouldApplyColor = */ true, /* isEditable = */ false, /* EntryContextMenuInfo = */ null, /* thirdIcon = */ null, /* thirdIntent = */ null, - /* thirdContentDescription = */ null, R.drawable.ic_phone_24dp); + /* thirdContentDescription = */ null, + /* thirdAction = */ Entry.ACTION_NONE, + /* thirdExtras = */ null, + R.drawable.ic_phone_24dp); final Drawable emailIcon = getResources().getDrawable( R.drawable.ic_email_24dp).mutate(); @@ -1488,6 +1495,7 @@ public class QuickContactActivity extends ContactsActivity { /* shouldApplyColor = */ true, /* isEditable = */ false, /* EntryContextMenuInfo = */ null, /* thirdIcon = */ null, /* thirdIntent = */ null, /* thirdContentDescription = */ null, + /* thirdAction = */ Entry.ACTION_NONE, /* thirdExtras = */ null, R.drawable.ic_email_24dp); final List<List<Entry>> promptEntries = new ArrayList<>(); @@ -1654,7 +1662,9 @@ public class QuickContactActivity extends ContactsActivity { EntryContextMenuInfo entryContextMenuInfo = null; Drawable thirdIcon = null; Intent thirdIntent = null; + int thirdAction = Entry.ACTION_NONE; String thirdContentDescription = null; + Bundle thirdExtras = null; int iconResourceId = 0; context = context.getApplicationContext(); @@ -1767,6 +1777,7 @@ public class QuickContactActivity extends ContactsActivity { } } else if (dataItem instanceof PhoneDataItem) { final PhoneDataItem phone = (PhoneDataItem) dataItem; + String phoneLabel = null; if (!TextUtils.isEmpty(phone.getNumber())) { primaryContentDescription.append(res.getString(R.string.call_other)).append(" "); header = sBidiFormatter.unicodeWrap(phone.buildDataStringForDisplay(context, kind), @@ -1795,10 +1806,12 @@ public class QuickContactActivity extends ContactsActivity { if (phone.hasKindTypeColumn(kind)) { final int kindTypeColumn = phone.getKindTypeColumn(kind); final String label = phone.getLabel(); + phoneLabel = label; if (kindTypeColumn == Phone.TYPE_CUSTOM && TextUtils.isEmpty(label)) { text = ""; } else { text = Phone.getTypeLabel(res, kindTypeColumn, label).toString(); + phoneLabel= text; primaryContentDescription.append(text).append(" "); } } @@ -1814,9 +1827,33 @@ public class QuickContactActivity extends ContactsActivity { alternateIcon = res.getDrawable(R.drawable.ic_message_24dp); alternateContentDescription.append(res.getString(R.string.sms_custom, header)); - // Add video call button if supported - if (CallUtil.isVideoEnabled(context)) { + if (CallUtil.isCallWithSubjectSupported(context)) { + thirdIcon = res.getDrawable(R.drawable.ic_call_note_white_24dp); + thirdAction = Entry.ACTION_CALL_WITH_SUBJECT; + thirdContentDescription = + res.getString(R.string.call_with_a_note); + + // Create a bundle containing the data the call subject dialog requires. + thirdExtras = new Bundle(); + thirdExtras.putLong(CallSubjectDialog.ARG_PHOTO_ID, + contactData.getPhotoId()); + thirdExtras.putParcelable(CallSubjectDialog.ARG_PHOTO_URI, + UriUtils.parseUriOrNull(contactData.getPhotoUri())); + thirdExtras.putParcelable(CallSubjectDialog.ARG_CONTACT_URI, + contactData.getLookupUri()); + thirdExtras.putString(CallSubjectDialog.ARG_NAME_OR_NUMBER, + contactData.getDisplayName()); + thirdExtras.putBoolean(CallSubjectDialog.ARG_IS_BUSINESS, false); + thirdExtras.putString(CallSubjectDialog.ARG_NUMBER, + phone.getNumber()); + thirdExtras.putString(CallSubjectDialog.ARG_DISPLAY_NUMBER, + phone.getFormattedPhoneNumber()); + thirdExtras.putString(CallSubjectDialog.ARG_NUMBER_LABEL, + phoneLabel); + } else if (CallUtil.isVideoEnabled(context)) { + // Add video call button if supported thirdIcon = res.getDrawable(R.drawable.ic_videocam); + thirdAction = Entry.ACTION_INTENT; thirdIntent = CallUtil.getVideoCallIntent(phone.getNumber(), CALL_ORIGIN_QUICK_CONTACTS_ACTIVITY); thirdContentDescription = @@ -1927,6 +1964,8 @@ public class QuickContactActivity extends ContactsActivity { /* thirdIcon = */null, /* thirdIntent = */null, /* thirdContentDescription = */null, + /* thirdAction = */ Entry.ACTION_NONE, + /* thirdExtras = */ null, /* iconResourceId = */0); } return null; @@ -2040,8 +2079,8 @@ public class QuickContactActivity extends ContactsActivity { new SpannableString(primaryContentDescription.toString()), intent, alternateIcon, alternateIntent, alternateContentDescription.toString(), shouldApplyColor, isEditable, - entryContextMenuInfo, thirdIcon, thirdIntent, thirdContentDescription, - iconResourceId); + entryContextMenuInfo, thirdIcon, thirdIntent, thirdContentDescription, thirdAction, + thirdExtras, iconResourceId); } private List<Entry> dataItemsToEntries(List<DataItem> dataItems, @@ -2312,6 +2351,8 @@ public class QuickContactActivity extends ContactsActivity { /* thirdIcon = */ null, /* thirdIntent = */ null, /* thirdContentDescription = */ null, + /* thirdAction = */ Entry.ACTION_NONE, + /* thirdActionExtras = */ null, interaction.getIconResourceId())); } return entries; |