Use quantitiy string for sharing contacts

Bug 28718104

Change-Id: Iea2d3fe05da75e5988e6ad5aace790fe064cf383
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 8b6dbf1..479afd2 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -421,8 +421,11 @@
     <!-- The menu item to add the the currently viewed contact to your contacts [CHAR LIMIT=30] -->
     <string name="menu_add_contact">Add to contacts</string>
 
-    <!-- Dialog title when picking the application to share a contact with. -->
-    <string name="share_via">Share contact via</string>
+    <!-- Dialog title when picking the application to share one or multiple contacts with. [CHAR LIMIT=40] -->
+    <plurals name="title_share_via">
+        <item quantity="one">Share contact via</item>
+        <item quantity="other">Share contacts via</item>
+    </plurals>
 
     <!-- Title for the disambiguation dialog that requests the user choose an account for the new label to be created under [CHAR LIMIT=NONE] -->
     <string name="dialog_new_group_account">Choose account</string>
diff --git a/src/com/android/contacts/activities/PeopleActivity.java b/src/com/android/contacts/activities/PeopleActivity.java
index 2a5f8fb..250799a 100644
--- a/src/com/android/contacts/activities/PeopleActivity.java
+++ b/src/com/android/contacts/activities/PeopleActivity.java
@@ -1346,9 +1346,10 @@
         intent.setType(Contacts.CONTENT_VCARD_TYPE);
         intent.putExtra(Intent.EXTRA_STREAM, uri);
         try {
-            // TODO(wenyiw): show different strings based on number of contacts.
-            startActivityForResult(Intent.createChooser(intent, getText(R.string.share_via)),
-                    ACTIVITY_REQUEST_CODE_SHARE);
+            startActivityForResult(Intent.createChooser(intent, getResources().getQuantityString(
+                    R.plurals.title_share_via,
+                    /* quantity */ mAllFragment.getSelectedContactIds().size()))
+                    , ACTIVITY_REQUEST_CODE_SHARE);
         } catch (final ActivityNotFoundException ex) {
             Toast.makeText(this, R.string.share_error, Toast.LENGTH_SHORT).show();
         }
diff --git a/src/com/android/contacts/quickcontact/QuickContactActivity.java b/src/com/android/contacts/quickcontact/QuickContactActivity.java
index f05636b..4181952 100644
--- a/src/com/android/contacts/quickcontact/QuickContactActivity.java
+++ b/src/com/android/contacts/quickcontact/QuickContactActivity.java
@@ -2813,7 +2813,8 @@
         intent.putExtra(Intent.EXTRA_STREAM, shareUri);
 
         // Launch chooser to share contact via
-        final CharSequence chooseTitle = getText(R.string.share_via);
+        final CharSequence chooseTitle = getResources().getQuantityString(
+                R.plurals.title_share_via, /* quantity */ 1);
         final Intent chooseIntent = Intent.createChooser(intent, chooseTitle);
 
         try {