From e142481570d7fbda5d035555fe217314e396ae90 Mon Sep 17 00:00:00 2001 From: Yorke Lee Date: Wed, 4 Sep 2013 18:24:48 -0700 Subject: Add call shortcuts to phone number list adapters * Add a new class DialerPhoneNumberListAdapter, which both RegularSearchListADapter and SmartDialNumberListAdapter extend. DialerPhoneNumberListAdapter allows the addition of pre-defined call shortcuts at the end of the phone number list that can be toggled on or off. * For the SmartDialSearchFragment, the only shortcut that is available is always the Add number to contacts shortcut. * For the RegularSearchFragment, if the user enters a string that contains all dialable numbers, it is treated as a phone number and the call directly and add number to contacts shortcuts are enabled. Otherwise, it is treated as a name, and only the add contact with a new name shortcut is enabled. * Add a intent that allows the user to directly create a new contact that has the name field pre-populated. This intent is used if the user enters input that looks like a name in the search view. Bug: 10339630 Change-Id: I2ae757ce505d85a8780d28d89e09fb7084c773b1 --- src/com/android/dialer/dialpad/DialpadFragment.java | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'src/com/android/dialer/dialpad/DialpadFragment.java') diff --git a/src/com/android/dialer/dialpad/DialpadFragment.java b/src/com/android/dialer/dialpad/DialpadFragment.java index 79e830730..79d10c07c 100644 --- a/src/com/android/dialer/dialpad/DialpadFragment.java +++ b/src/com/android/dialer/dialpad/DialpadFragment.java @@ -36,10 +36,11 @@ import android.os.Bundle; import android.os.RemoteException; import android.os.ServiceManager; import android.os.SystemProperties; -import android.provider.Contacts.Intents.Insert; +import android.provider.ContactsContract.Contacts; import android.provider.Contacts.People; import android.provider.Contacts.Phones; import android.provider.Contacts.PhonesColumns; +import android.provider.ContactsContract.Intents; import android.provider.Settings; import android.telephony.PhoneNumberUtils; import android.telephony.PhoneStateListener; @@ -766,18 +767,11 @@ public class DialpadFragment extends Fragment } else { final CharSequence digits = mDigits.getText(); // Put the current digits string into an intent - addToContactMenuItem.setIntent(getAddToContactIntent(digits)); + addToContactMenuItem.setIntent(DialtactsActivity.getAddNumberToContactIntent(digits)); addToContactMenuItem.setVisible(true); } } - private static Intent getAddToContactIntent(CharSequence digits) { - final Intent intent = new Intent(Intent.ACTION_INSERT_OR_EDIT); - intent.putExtra(Insert.PHONE, digits); - intent.setType(People.CONTENT_ITEM_TYPE); - return intent; - } - private void keyPressed(int keyCode) { switch (keyCode) { case KeyEvent.KEYCODE_1: -- cgit v1.2.3