Merge "Sets accessibility importance for the home/up button. Bug: 7196985 Change-Id: I4d27470eccb8933f751db892218a8032a80df3da" into jb-mr1-dev

This commit is contained in:
Svetoslav Ganov
2012-10-01 16:40:17 -07:00
committed by Android (Google) Code Review

View File

@@ -556,12 +556,16 @@ public class ActionBarView extends AbsActionBarView {
// Make sure the home button has an accurate content description for accessibility.
if (!enable) {
mHomeLayout.setContentDescription(null);
} else if ((mDisplayOptions & ActionBar.DISPLAY_HOME_AS_UP) != 0) {
mHomeLayout.setContentDescription(mContext.getResources().getText(
R.string.action_bar_up_description));
mHomeLayout.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO);
} else {
mHomeLayout.setContentDescription(mContext.getResources().getText(
R.string.action_bar_home_description));
mHomeLayout.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_AUTO);
if ((mDisplayOptions & ActionBar.DISPLAY_HOME_AS_UP) != 0) {
mHomeLayout.setContentDescription(mContext.getResources().getText(
R.string.action_bar_up_description));
} else {
mHomeLayout.setContentDescription(mContext.getResources().getText(
R.string.action_bar_home_description));
}
}
}
@@ -624,12 +628,16 @@ public class ActionBarView extends AbsActionBarView {
// Make sure the home button has an accurate content description for accessibility.
if (!mHomeLayout.isEnabled()) {
mHomeLayout.setContentDescription(null);
} else if ((options & ActionBar.DISPLAY_HOME_AS_UP) != 0) {
mHomeLayout.setContentDescription(mContext.getResources().getText(
R.string.action_bar_up_description));
mHomeLayout.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO);
} else {
mHomeLayout.setContentDescription(mContext.getResources().getText(
R.string.action_bar_home_description));
mHomeLayout.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_AUTO);
if ((options & ActionBar.DISPLAY_HOME_AS_UP) != 0) {
mHomeLayout.setContentDescription(mContext.getResources().getText(
R.string.action_bar_up_description));
} else {
mHomeLayout.setContentDescription(mContext.getResources().getText(
R.string.action_bar_home_description));
}
}
}