Loading res/layout/menu_item_action_view.xml 0 → 100644 +27 −0 Original line number Diff line number Diff line <?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 src/com/android/contacts/ContactsDrawerActivity.java +15 −9 Original line number Diff line number Diff line Loading @@ -437,6 +437,8 @@ public abstract class ContactsDrawerActivity extends AppCompatContactsActivity i return true; } }); updateMenuContentDescription(menuItem, getString(R.string.group_name_dialog_hint)); } } Loading Loading @@ -528,7 +530,6 @@ public abstract class ContactsDrawerActivity extends AppCompatContactsActivity i return; } for (int i = 0; i < accountFilterItems.size(); i++) { final ContactListFilter filter = accountFilterItems.get(i); final AccountDisplayInfo displayableAccount = Loading Loading @@ -556,14 +557,8 @@ public abstract class ContactsDrawerActivity extends AppCompatContactsActivity i // 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()) { Loading @@ -571,6 +566,17 @@ public abstract class ContactsDrawerActivity extends AppCompatContactsActivity i } } 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()) { Loading Loading
res/layout/menu_item_action_view.xml 0 → 100644 +27 −0 Original line number Diff line number Diff line <?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
src/com/android/contacts/ContactsDrawerActivity.java +15 −9 Original line number Diff line number Diff line Loading @@ -437,6 +437,8 @@ public abstract class ContactsDrawerActivity extends AppCompatContactsActivity i return true; } }); updateMenuContentDescription(menuItem, getString(R.string.group_name_dialog_hint)); } } Loading Loading @@ -528,7 +530,6 @@ public abstract class ContactsDrawerActivity extends AppCompatContactsActivity i return; } for (int i = 0; i < accountFilterItems.size(); i++) { final ContactListFilter filter = accountFilterItems.get(i); final AccountDisplayInfo displayableAccount = Loading Loading @@ -556,14 +557,8 @@ public abstract class ContactsDrawerActivity extends AppCompatContactsActivity i // 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()) { Loading @@ -571,6 +566,17 @@ public abstract class ContactsDrawerActivity extends AppCompatContactsActivity i } } 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()) { Loading