Update left nav label menu item content description
Bug: 32975864
Test: manually verified it announces "{label name} label", annoucement
of accounts are also correct, and left nav works well when
Talkback is off.
Change-Id: Ieb76be43b475565e0090ad1062eee3cc1f5805e8
diff --git a/src/com/android/contacts/ContactsDrawerActivity.java b/src/com/android/contacts/ContactsDrawerActivity.java
index b786940..2e024d4 100644
--- a/src/com/android/contacts/ContactsDrawerActivity.java
+++ b/src/com/android/contacts/ContactsDrawerActivity.java
@@ -437,6 +437,8 @@
return true;
}
});
+
+ updateMenuContentDescription(menuItem, getString(R.string.group_name_dialog_hint));
}
}
@@ -528,7 +530,6 @@
return;
}
-
for (int i = 0; i < accountFilterItems.size(); i++) {
final ContactListFilter filter = accountFilterItems.get(i);
final AccountDisplayInfo displayableAccount =
@@ -556,14 +557,8 @@
// Get rid of the default menu item overlay and show original account icons.
menuItem.getIcon().setColorFilter(Color.TRANSPARENT, PorterDuff.Mode.SRC_ATOP);
}
- // Create a dummy action view to attach extra hidden content description to the menuItem
- // for Talkback. We want Talkback to read out the account type but not have it be part
- // of the menuItem title.
- LinearLayout view = (LinearLayout) LayoutInflater.from(this)
- .inflate(R.layout.account_type_info, null);
- view.setContentDescription(displayableAccount.getTypeLabel());
- view.setVisibility(View.VISIBLE);
- menuItem.setActionView(view);
+
+ updateMenuContentDescription(menuItem, displayableAccount.getTypeLabel());
}
if (isAccountView()) {
@@ -571,6 +566,17 @@
}
}
+ private void updateMenuContentDescription(MenuItem menuItem, CharSequence contentDescription) {
+ // Create a dummy action view to attach extra hidden content description to the menuItem
+ // for Talkback. We want Talkback to read out the account type but not have it be part
+ // of the menuItem title.
+ final LinearLayout view = (LinearLayout) LayoutInflater.from(this)
+ .inflate(R.layout.menu_item_action_view, null);
+ view.setContentDescription(contentDescription);
+ view.setVisibility(View.VISIBLE);
+ menuItem.setActionView(view);
+ }
+
public void updateFilterMenu(ContactListFilter filter) {
clearCheckedMenus();
if (filter != null && filter.isContactsFilterType()) {