Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7901b2a5 authored by Adam Powell's avatar Adam Powell
Browse files

Set the default content description for Toolbars acting as action bars

Bug 15814044

Change-Id: I07c20de1349cb07f21eaf0db718da94c0ba7043d
parent 4212d1f2
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -38177,6 +38177,7 @@ package android.widget {
    method public android.graphics.drawable.Drawable getLogo();
    method public java.lang.CharSequence getLogoDescription();
    method public android.view.Menu getMenu();
    method public java.lang.CharSequence getNavigationContentDescription();
    method public android.graphics.drawable.Drawable getNavigationIcon();
    method public java.lang.CharSequence getSubtitle();
    method public java.lang.CharSequence getTitle();
+11 −0
Original line number Diff line number Diff line
@@ -634,6 +634,17 @@ public class Toolbar extends ViewGroup {
        setNavigationIcon(getContext().getDrawable(resId));
    }

    /**
     * Retrieve the currently configured content description for the navigation button view.
     * This will be used to describe the navigation action to users through mechanisms such
     * as screen readers or tooltips.
     *
     * @return The navigation button's content description
     */
    public CharSequence getNavigationContentDescription() {
        return mNavButtonView != null ? mNavButtonView.getContentDescription() : null;
    }

    /**
     * Set a content description for the navigation button if one is present. The content
     * description will be read via screen readers or other accessibility systems to explain
+5 −0
Original line number Diff line number Diff line
@@ -152,6 +152,11 @@ public class ToolbarWidgetWrapper implements DecorToolbar {

        a.recycle();

        if (TextUtils.isEmpty(mToolbar.getNavigationContentDescription())) {
            mToolbar.setNavigationContentDescription(
                    getContext().getResources().getText(R.string.action_bar_up_description));
        }

        mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
            final ActionMenuItem mNavItem = new ActionMenuItem(mToolbar.getContext(),
                    0, android.R.id.home, 0, 0, mTitle);