summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJin Cao <jinyan@google.com>2014-09-17 17:17:01 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-09-17 17:17:01 +0000
commitef086f5d8cb0d3fd260a62d78f62c19aa0b18331 (patch)
tree88d93028b69349dc172fd38b9837b0dd8b4c27dc
parent46b38b7ffe4a3c7d05a993470229e0dd0301fc4e (diff)
parentb1aeb7b6e08b0b8dd548c4f0e5ac55844fd7f55d (diff)
downloadandroid_frameworks_opt_chips-ef086f5d8cb0d3fd260a62d78f62c19aa0b18331.tar.gz
android_frameworks_opt_chips-ef086f5d8cb0d3fd260a62d78f62c19aa0b18331.tar.bz2
android_frameworks_opt_chips-ef086f5d8cb0d3fd260a62d78f62c19aa0b18331.zip
am b1aeb7b6: Announce chips dropdown for accessibility
* commit 'b1aeb7b6e08b0b8dd548c4f0e5ac55844fd7f55d': Announce chips dropdown for accessibility
-rw-r--r--res/values/strings.xml2
-rw-r--r--src/com/android/ex/chips/RecipientEditTextView.java12
2 files changed, 13 insertions, 1 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml
index d1c9c7f..82cbf25 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -26,4 +26,6 @@
<!-- Text displayed in the enter key slot when the recipientedittextview has focus.
[CHAR LIMIT=12] -->
<string name="action_label">Return</string>
+ <!-- Announce the number of possible recipient entries that the user can select from for accessibility purposes [CHAR LIMIT=200] -->
+ <string name="accessbility_suggestion_dropdown_opened">Contact suggestions opened</string>
</resources>
diff --git a/src/com/android/ex/chips/RecipientEditTextView.java b/src/com/android/ex/chips/RecipientEditTextView.java
index 10187d6..44c6aa3 100644
--- a/src/com/android/ex/chips/RecipientEditTextView.java
+++ b/src/com/android/ex/chips/RecipientEditTextView.java
@@ -183,10 +183,11 @@ public class RecipientEditTextView extends MultiAutoCompleteTextView implements
private ReplacementDrawableSpan mMoreChip;
private TextView mMoreItem;
+ private int mCurrentSuggestionCount;
+
// VisibleForTesting
final ArrayList<String> mPendingChips = new ArrayList<String>();
-
private int mPendingChipsCount = 0;
private int mCheckedItem;
private boolean mNoChips = false;
@@ -503,6 +504,13 @@ public class RecipientEditTextView extends MultiAutoCompleteTextView implements
// that the user can see as many results as possible.
if (entries != null && entries.size() > 0) {
scrollBottomIntoView();
+ // Here the current suggestion count is still the old one since we update
+ // the count at the bottom of this function.
+ if (mCurrentSuggestionCount == 0) {
+ // Announce the new number of possible choices for accessibility.
+ announceForAccessibility(getContext().getString(
+ R.string.accessbility_suggestion_dropdown_opened));
+ }
}
// Set the dropdown height to be the remaining height
final int[] coords = new int[2];
@@ -510,6 +518,8 @@ public class RecipientEditTextView extends MultiAutoCompleteTextView implements
final Rect displayFrame = new Rect();
getWindowVisibleDisplayFrame(displayFrame);
setDropDownHeight(displayFrame.bottom - coords[1] - getHeight());
+
+ mCurrentSuggestionCount = entries == null ? 0 : entries.size();
}
});
baseAdapter.setDropdownChipLayouter(mDropdownChipLayouter);