Add MODE_PICK_MULTIPLE_PHONES mode which can be launched by
ACTION_GET_MULTIPLE_PHONES
a. Adds PhoneNumbersAdapter to handle the phone numbers don't
belong to any contacts.
b. UserSelection is added to handle the initial selection and
the user's change.
c. Supports the screen rotation.
The below 2 issues haven't been resolved, and need the decision
from the team.
a. There is no phone will be shown if the filtering text is empty
which make the user unable to select phone from all contacts in
search mode.
c. There is no title in search mode, the user don't know how many
phones has been selected.
Change-Id: Ieb50cf61ed895a1901a9b15ef8f8b26fcb37a48e
diff --git a/src/com/android/contacts/ContactsSearchManager.java b/src/com/android/contacts/ContactsSearchManager.java
index d65e079..2297817 100644
--- a/src/com/android/contacts/ContactsSearchManager.java
+++ b/src/com/android/contacts/ContactsSearchManager.java
@@ -40,18 +40,26 @@
public static final String ORIGINAL_COMPONENT_EXTRA_KEY = "originalComponent";
/**
+ * An extra that provides context for search UI and defines the scope for
+ * the search queries.
+ */
+ public static final String ORIGINAL_TYPE_EXTRA_KEY = "originalType";
+
+ /**
* Starts the contact list activity in the search mode.
*/
public static void startSearch(Activity context, String initialQuery) {
- context.startActivity(buildIntent(context, initialQuery));
+ context.startActivity(buildIntent(context, initialQuery, null));
}
public static void startSearchForResult(Activity context, String initialQuery,
- int requestCode) {
- context.startActivityForResult(buildIntent(context, initialQuery), requestCode);
+ int requestCode, Bundle includedExtras) {
+ context.startActivityForResult(
+ buildIntent(context, initialQuery, includedExtras), requestCode);
}
- private static Intent buildIntent(Activity context, String initialQuery) {
+ private static Intent buildIntent(
+ Activity context, String initialQuery, Bundle includedExtras) {
Intent intent = new Intent();
intent.setData(ContactsContract.Contacts.CONTENT_URI);
intent.setAction(UI.FILTER_CONTACTS_ACTION);
@@ -64,6 +72,10 @@
intent.putExtra(UI.FILTER_TEXT_EXTRA_KEY, initialQuery);
intent.putExtra(ORIGINAL_ACTION_EXTRA_KEY, originalIntent.getAction());
intent.putExtra(ORIGINAL_COMPONENT_EXTRA_KEY, originalIntent.getComponent().getClassName());
+ intent.putExtra(ORIGINAL_TYPE_EXTRA_KEY, originalIntent.getType());
+ if (includedExtras != null) {
+ intent.putExtras(includedExtras);
+ }
return intent;
}
}