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
diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java
index 398c90e..c85ce42 100644
--- a/src/com/android/dialer/DialtactsActivity.java
+++ b/src/com/android/dialer/DialtactsActivity.java
@@ -37,6 +37,7 @@
 import android.provider.CallLog.Calls;
 import android.provider.ContactsContract;
 import android.provider.ContactsContract.Contacts;
+import android.provider.ContactsContract.Intents;
 import android.provider.ContactsContract.Intents.UI;
 import android.provider.Settings;
 import android.speech.RecognizerIntent;
@@ -882,4 +883,17 @@
         final Intent intent = new Intent(this, AllContactsActivity.class);
         startActivity(intent);
     }
+
+    public static Intent getAddNumberToContactIntent(CharSequence text) {
+        final Intent intent = new Intent(Intent.ACTION_INSERT_OR_EDIT);
+        intent.putExtra(Intents.Insert.PHONE, text);
+        intent.setType(Contacts.CONTENT_ITEM_TYPE);
+        return intent;
+    }
+
+    public static Intent getInsertContactWithNameIntent(CharSequence text) {
+        final Intent intent = new Intent(Intent.ACTION_INSERT, Contacts.CONTENT_URI);
+        intent.putExtra(Intents.Insert.NAME, text);
+        return intent;
+    }
 }