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

Commit 575d1bea authored by Alan Viverette's avatar Alan Viverette Committed by Android Git Automerger
Browse files

am 86706558: am e1af5ff0: Merge "Remove duplicate Toolbar method for setting...

am 86706558: am e1af5ff0: Merge "Remove duplicate Toolbar method for setting content description" into lmp-dev

* commit '86706558783fd105ae239796664a267cfd9a645a':
  Remove duplicate Toolbar method for setting content description
parents acbd8e0e 202789a6
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -39754,8 +39754,6 @@ package android.widget {
    method public void setLogoDescription(java.lang.CharSequence);
    method public void setNavigationContentDescription(java.lang.CharSequence);
    method public void setNavigationContentDescription(int);
    method public void setNavigationDescription(int);
    method public void setNavigationDescription(java.lang.CharSequence);
    method public void setNavigationIcon(int);
    method public void setNavigationIcon(android.graphics.drawable.Drawable);
    method public void setNavigationOnClickListener(android.view.View.OnClickListener);
+36 −55
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.widget;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.ActionBar;
import android.content.Context;
import android.content.res.TypedArray;
@@ -653,21 +654,6 @@ public class Toolbar extends ViewGroup {
        }
    }

    /**
     * Set the icon to use for the toolbar's navigation button.
     *
     * <p>The navigation button appears at the start of the toolbar if present. Setting an icon
     * will make the navigation button visible.</p>
     *
     * <p>If you use a navigation icon you should also set a description for its action using
     * {@link #setNavigationDescription(int)}. This is used for accessibility and tooltips.</p>
     *
     * @param resId Resource ID of a drawable to set
     */
    public void setNavigationIcon(int resId) {
        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
@@ -675,6 +661,7 @@ public class Toolbar extends ViewGroup {
     *
     * @return The navigation button's content description
     */
    @Nullable
    public CharSequence getNavigationContentDescription() {
        return mNavButtonView != null ? mNavButtonView.getContentDescription() : null;
    }
@@ -684,11 +671,11 @@ public class Toolbar extends ViewGroup {
     * description will be read via screen readers or other accessibility systems to explain
     * the action of the navigation button.
     *
     * @param description Content description to set
     * @param resId Resource ID of a content description string to set, or 0 to
     *              clear the description
     */
    public void setNavigationContentDescription(CharSequence description) {
        ensureNavButtonView();
        mNavButtonView.setContentDescription(description);
    public void setNavigationContentDescription(int resId) {
        setNavigationContentDescription(resId != 0 ? getContext().getText(resId) : null);
    }

    /**
@@ -696,11 +683,16 @@ public class Toolbar extends ViewGroup {
     * description will be read via screen readers or other accessibility systems to explain
     * the action of the navigation button.
     *
     * @param resId Resource ID of a content description string to set
     * @param description Content description to set, or <code>null</code> to
     *                    clear the content description
     */
    public void setNavigationContentDescription(int resId) {
    public void setNavigationContentDescription(@Nullable CharSequence description) {
        if (!TextUtils.isEmpty(description)) {
            ensureNavButtonView();
        mNavButtonView.setContentDescription(resId != 0 ? getContext().getText(resId) : null);
        }
        if (mNavButtonView != null) {
            mNavButtonView.setContentDescription(description);
        }
    }

    /**
@@ -710,11 +702,28 @@ public class Toolbar extends ViewGroup {
     * will make the navigation button visible.</p>
     *
     * <p>If you use a navigation icon you should also set a description for its action using
     * {@link #setNavigationDescription(int)}. This is used for accessibility and tooltips.</p>
     * {@link #setNavigationContentDescription(int)}. This is used for accessibility and
     * tooltips.</p>
     *
     * @param icon Drawable to set
     * @param resId Resource ID of a drawable to set
     */
    public void setNavigationIcon(Drawable icon) {
    public void setNavigationIcon(int resId) {
        setNavigationIcon(getContext().getDrawable(resId));
    }

    /**
     * Set the icon to use for the toolbar's navigation button.
     *
     * <p>The navigation button appears at the start of the toolbar if present. Setting an icon
     * will make the navigation button visible.</p>
     *
     * <p>If you use a navigation icon you should also set a description for its action using
     * {@link #setNavigationContentDescription(int)}. This is used for accessibility and
     * tooltips.</p>
     *
     * @param icon Drawable to set, may be null to clear the icon
     */
    public void setNavigationIcon(@Nullable Drawable icon) {
        if (icon != null) {
            ensureNavButtonView();
            if (mNavButtonView.getParent() == null) {
@@ -733,39 +742,11 @@ public class Toolbar extends ViewGroup {
     *
     * @return The navigation icon drawable
     */
    @Nullable
    public Drawable getNavigationIcon() {
        return mNavButtonView != null ? mNavButtonView.getDrawable() : null;
    }

    /**
     * Set a description for the navigation button.
     *
     * <p>This description string is used for accessibility, tooltips and other facilities
     * to improve discoverability.</p>
     *
     * @param resId Resource ID of a string to set
     */
    public void setNavigationDescription(int resId) {
        setNavigationDescription(getContext().getText(resId));
    }

    /**
     * Set a description for the navigation button.
     *
     * <p>This description string is used for accessibility, tooltips and other facilities
     * to improve discoverability.</p>
     *
     * @param description String to set as the description
     */
    public void setNavigationDescription(CharSequence description) {
        if (!TextUtils.isEmpty(description)) {
            ensureNavButtonView();
        }
        if (mNavButtonView != null) {
            mNavButtonView.setContentDescription(description);
        }
    }

    /**
     * Set a listener to respond to navigation events.
     *
+2 −2
Original line number Diff line number Diff line
@@ -154,7 +154,7 @@ public class ToolbarActionBar extends ActionBar {

    @Override
    public void setHomeActionContentDescription(CharSequence description) {
        mToolbar.setNavigationDescription(description);
        mToolbar.setNavigationContentDescription(description);
    }

    @Override
@@ -164,7 +164,7 @@ public class ToolbarActionBar extends ActionBar {

    @Override
    public void setHomeActionContentDescription(int resId) {
        mToolbar.setNavigationDescription(resId);
        mToolbar.setNavigationContentDescription(resId);
    }

    @Override