Settings suggestions now describes expand and collapse in talkback
Bug: 30314874
Change-Id: I2231148594c8e878111a754e5806c20dd4e289af
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 514bf66..c61614e 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -5860,6 +5860,12 @@
<!--Dashboard strings-->
<!-- Text to describe the dashboard fragment title [CHAR LIMIT=16] -->
<string name="dashboard_title">Settings</string>
+ <!-- Text to describe the items to be expanded as suggested settings [CHAR LIMIT=none] -->
+ <plurals name="settings_suggestion_header_summary_hidden_items">
+ <item quantity="one">Show %d hidden item</item>
+ <item quantity="other">Show %d hidden items</item>
+ </plurals>
+
<!-- Search strings -->
<!-- Text to describe the search results fragment title [CHAR LIMIT=16] -->
diff --git a/src/com/android/settings/dashboard/DashboardAdapter.java b/src/com/android/settings/dashboard/DashboardAdapter.java
index ca68a74..6b2e145 100644
--- a/src/com/android/settings/dashboard/DashboardAdapter.java
+++ b/src/com/android/settings/dashboard/DashboardAdapter.java
@@ -301,11 +301,22 @@
}
private void onBindSuggestionHeader(final DashboardItemHolder holder) {
- holder.icon.setImageResource(hasMoreSuggestions() ? R.drawable.ic_expand_more
- : R.drawable.ic_expand_less);
- holder.title.setText(mContext.getString(R.string.suggestions_title, mSuggestions.size()));
+ final boolean moreSuggestions = hasMoreSuggestions();
final int undisplayedSuggestionCount =
mSuggestions.size() - getDisplayableSuggestionCount();
+ holder.icon.setImageResource(moreSuggestions ? R.drawable.ic_expand_more
+ : R.drawable.ic_expand_less);
+ holder.title.setText(mContext.getString(R.string.suggestions_title, mSuggestions.size()));
+ String summaryContentDescription;
+ if (moreSuggestions) {
+ summaryContentDescription = mContext.getResources().getQuantityString(
+ R.plurals.settings_suggestion_header_summary_hidden_items,
+ undisplayedSuggestionCount, undisplayedSuggestionCount);
+ } else {
+ summaryContentDescription = mContext.getString(R.string.condition_expand_hide);
+ }
+ holder.summary.setContentDescription(summaryContentDescription);
+
if (undisplayedSuggestionCount == 0) {
holder.summary.setText(null);
} else {