From 1513fec51cbb557685f1976ee2050c73ccdbe036 Mon Sep 17 00:00:00 2001 From: Tyler Gunn Date: Fri, 5 Dec 2014 14:19:00 -0800 Subject: Updating "Add Contact" to pre-populate full contact info. 1. For recent call entries with a name and phone number, the name will now also be added. 2. For recent call entries which have complete address information provided by nearby places, all information except the contact photo will be added. The contact photo is excluded, as the ContactsLoader would attempt to load the contact photo while parsing the contact information. On a slow connection this could cause a noticeable pause while adding the contact. Bug: 17308163 Change-Id: If2e78bd1257096b344ff2dd266dcdbaeed4f1471 --- src/com/android/dialer/DialtactsActivity.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src/com/android/dialer/DialtactsActivity.java') diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java index 5e6f03597..95b72157e 100644 --- a/src/com/android/dialer/DialtactsActivity.java +++ b/src/com/android/dialer/DialtactsActivity.java @@ -1050,8 +1050,22 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O } public static Intent getAddNumberToContactIntent(CharSequence text) { - final Intent intent = new Intent(Intent.ACTION_INSERT_OR_EDIT); - intent.putExtra(Intents.Insert.PHONE, text); + return getAddToContactIntent(null /* name */, text /* phoneNumber */, + -1 /* phoneNumberType */); + } + + public static Intent getAddToContactIntent(CharSequence name, CharSequence phoneNumber, + int phoneNumberType) { + Intent intent = new Intent(Intent.ACTION_INSERT_OR_EDIT); + intent.putExtra(Intents.Insert.PHONE, phoneNumber); + // Only include the name and phone type extras if they are specified (the method + // getAddNumberToContactIntent does not use them). + if (name != null) { + intent.putExtra(Intents.Insert.NAME, name); + } + if (phoneNumberType != -1) { + intent.putExtra(Intents.Insert.PHONE_TYPE, phoneNumberType); + } intent.setType(Contacts.CONTENT_ITEM_TYPE); return intent; } -- cgit v1.2.3