Update left nav label menu item content description
am: 5678dcb0b5
Change-Id: Ibfbbbaf9e9e43bc9f031b2003f886e2a2adeaf6c
diff --git a/res/layout/menu_item_action_view.xml b/res/layout/menu_item_action_view.xml
new file mode 100644
index 0000000..62eb758
--- /dev/null
+++ b/res/layout/menu_item_action_view.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2016 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<!-- A dummy action view to attach extra hidden content description to menuItem for Talkback. -->
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:visibility="gone">
+ <View
+ android:layout_width="1dp"
+ android:layout_height= "1dp" />
+</LinearLayout>
\ No newline at end of file
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()) {