Allow chips library clients to customize the a11y verbalization when the suggestion dropdown is opened.

Change-Id: Ide5dbb64bcdaa25f867ced6c9d4130bb73333571
diff --git a/sample/Android.mk b/sample/Android.mk
index d58e4b5..f6024a6 100644
--- a/sample/Android.mk
+++ b/sample/Android.mk
@@ -27,7 +27,7 @@
 
 LOCAL_STATIC_JAVA_LIBRARIES += libchips
 
-LOCAL_SDK_VERSION := 18
+LOCAL_SDK_VERSION := current
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src) \
         $(call all-logtags-files-under, $(src_dirs))
diff --git a/src/com/android/ex/chips/RecipientEditTextView.java b/src/com/android/ex/chips/RecipientEditTextView.java
index 162acb0..e5b7d99 100644
--- a/src/com/android/ex/chips/RecipientEditTextView.java
+++ b/src/com/android/ex/chips/RecipientEditTextView.java
@@ -534,6 +534,8 @@
         baseAdapter.registerUpdateObserver(new BaseRecipientAdapter.EntriesUpdatedObserver() {
             @Override
             public void onChanged(List<RecipientEntry> entries) {
+                int suggestionCount = entries == null ? 0 : entries.size();
+
                 // Scroll the chips field to the top of the screen so
                 // that the user can see as many results as possible.
                 if (entries != null && entries.size() > 0) {
@@ -542,8 +544,8 @@
                     // the count at the bottom of this function.
                     if (mCurrentSuggestionCount == 0) {
                         // Announce the new number of possible choices for accessibility.
-                        announceForAccessibilityCompat(getContext().getString(
-                                R.string.accessbility_suggestion_dropdown_opened));
+                        announceForAccessibilityCompat(
+                                getSuggestionDropdownOpenedVerbalization(suggestionCount));
                     }
                 }
 
@@ -561,12 +563,19 @@
                             getDropDownVerticalOffset());
                 }
 
-                mCurrentSuggestionCount = entries == null ? 0 : entries.size();
+                mCurrentSuggestionCount = suggestionCount;
             }
         });
         baseAdapter.setDropdownChipLayouter(mDropdownChipLayouter);
     }
 
+    /**
+     * Return the accessibility verbalization when the suggestion dropdown is opened.
+     */
+    public String getSuggestionDropdownOpenedVerbalization(int suggestionCount) {
+        return getResources().getString(R.string.accessbility_suggestion_dropdown_opened);
+    }
+
     @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
     private void announceForAccessibilityCompat(String text) {
         final AccessibilityManager accessibilityManager =